[BadCase]添加网络请求日志

This commit is contained in:
renwj
2022-04-11 11:59:32 +08:00
parent 2f56706137
commit 105d29a7f7

View File

@@ -21,6 +21,7 @@ internal class BadCaseNetModel {
.get(channel ?: "", pageNo)
.takeIf {
val body = it.body()
CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "get result: $body")
it.isSuccessful && body != null && (body.code == 0 || body.code == 200)
}
?.body()?.also {
@@ -39,16 +40,19 @@ internal class BadCaseNetModel {
}
suspend fun upload(map: Map<String, String>): UploadResult? = try {
CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "upload_params:$map")
MoGoRetrofitFactory
.getInstance(BadCaseHost.getHost())
.create(BadCaseApi::class.java)
.post(map)
.takeIf {
val body = it.body()
CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "upload_result:$body")
return@takeIf it.isSuccessful && (body != null) && (body.code == 0 || body.code == 200)
}
?.body()
} catch (t: Throwable) {
CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "upload_error:$t")
null
}
}