|
|
@@ -9,8 +9,10 @@ import cn.zhxu.okhttps.HttpTask
|
|
|
import cn.zhxu.okhttps.OkHttps
|
|
|
import cn.zhxu.okhttps.gson.GsonMsgConvertor
|
|
|
import cn.zhxu.okhttps.okhttp.OkHttpClientWrapper
|
|
|
+import com.grkj.iscs.R
|
|
|
import com.grkj.iscs.model.Constants
|
|
|
import com.grkj.iscs.model.Token
|
|
|
+import com.grkj.iscs.util.log.LogUtil
|
|
|
import okhttp3.logging.HttpLoggingInterceptor
|
|
|
import java.io.IOException
|
|
|
import java.net.SocketTimeoutException
|
|
|
@@ -36,11 +38,11 @@ class NetHttpManager {
|
|
|
.baseUrl(Constants.BASE_URL)
|
|
|
.responseListener { task: HttpTask<*>?, result: HttpResult? ->
|
|
|
if (result?.status != 200) {
|
|
|
-// LogUtil.d(
|
|
|
-// "Api fail : Url : ${task?.url}, " +
|
|
|
-// "Status : ${result?.status}, " +
|
|
|
-// "Params : ${task?.urlParas ?: task?.bodyParas}"
|
|
|
-// )
|
|
|
+ LogUtil.d(
|
|
|
+ "Api fail : Url : ${task?.url}, " +
|
|
|
+ "Status : ${result?.status}, " +
|
|
|
+ "Params : ${task?.urlParas ?: task?.bodyParas}"
|
|
|
+ )
|
|
|
}
|
|
|
true
|
|
|
}
|
|
|
@@ -138,8 +140,7 @@ class NetHttpManager {
|
|
|
) {
|
|
|
var httpTask = myHttp.async(urlStr).setOnException {
|
|
|
evictHttpConnectPool(it)
|
|
|
-// callback(null, context?.getString(R.string.common_net_dis), 0)
|
|
|
- callback(null, "haha", 0)
|
|
|
+ callback(null, context?.getString(R.string.common_net_dis), 0)
|
|
|
}
|
|
|
if (isAuth) httpTask.tag(tagAuth)
|
|
|
if (isSkipPreproc) {
|
|
|
@@ -149,7 +150,6 @@ class NetHttpManager {
|
|
|
.setOnResponse {
|
|
|
exceptionCount = 0
|
|
|
if (it.isSuccessful) {
|
|
|
-// Log.i("wtf1", it.body.toString())
|
|
|
callback(it.body, null, it.status)
|
|
|
} else {
|
|
|
var bobyStr = it.body.toString()
|
|
|
@@ -164,9 +164,7 @@ class NetHttpManager {
|
|
|
}
|
|
|
.setOnException {
|
|
|
evictHttpConnectPool(it)
|
|
|
-// callback(null, context?.getString(R.string.common_net_dis), 0)
|
|
|
- callback(null, "xixi", 0)
|
|
|
- Log.i("wtf2", it.toString())
|
|
|
+ callback(null, context?.getString(R.string.common_net_dis), 0)
|
|
|
}
|
|
|
mapperCallBack?.let {
|
|
|
httpTask.setOnResMapper {
|
|
|
@@ -195,8 +193,7 @@ class NetHttpManager {
|
|
|
if (filePath.isNullOrBlank() && folderPath.isNullOrBlank()) {
|
|
|
downloadCallBack.onResult(
|
|
|
false,
|
|
|
-// errorMsg = context?.getString(R.string.common_download_erro_notag)
|
|
|
- errorMsg = "lala"
|
|
|
+ errorMsg = context?.getString(R.string.common_download_erro_notag)
|
|
|
)
|
|
|
return
|
|
|
}
|
|
|
@@ -234,16 +231,14 @@ class NetHttpManager {
|
|
|
downloadCallBack.onResult(
|
|
|
false,
|
|
|
it.status,
|
|
|
-// errorMsg = context?.getString(R.string.common_net_download)
|
|
|
- errorMsg = "dd"
|
|
|
+ errorMsg = context?.getString(R.string.common_net_download)
|
|
|
)
|
|
|
}
|
|
|
}.setOnException {
|
|
|
evictHttpConnectPool(it)
|
|
|
downloadCallBack.onResult(
|
|
|
false,
|
|
|
-// errorMsg = context?.getString(R.string.common_net_download)
|
|
|
- errorMsg = "qq"
|
|
|
+ errorMsg = context?.getString(R.string.common_net_download)
|
|
|
)
|
|
|
}.get()
|
|
|
} catch (e: Exception) {
|