|
@@ -39,6 +39,10 @@ object VolleyRequest {
|
|
|
|
|
|
@Throws
|
|
@Throws
|
|
fun post(context: Context, jsonObject: JSONObject, callback: (ResultInfo) -> Unit) {
|
|
fun post(context: Context, jsonObject: JSONObject, callback: (ResultInfo) -> Unit) {
|
|
|
|
+ doPost(context, jsonObject, callback)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private fun doPost(context: Context, jsonObject: JSONObject, callback: (ResultInfo) -> Unit) {
|
|
val time = System.currentTimeMillis().toString()
|
|
val time = System.currentTimeMillis().toString()
|
|
val randomKey = time + StrUtils.getRandomString(16)
|
|
val randomKey = time + StrUtils.getRandomString(16)
|
|
val rawKey = Md5Utils.encodeByMD5(randomKey)
|
|
val rawKey = Md5Utils.encodeByMD5(randomKey)
|
|
@@ -182,11 +186,13 @@ object VolleyRequest {
|
|
resultInfo.code = getInt("code")
|
|
resultInfo.code = getInt("code")
|
|
resultInfo.msg = getString("msg")
|
|
resultInfo.msg = getString("msg")
|
|
}
|
|
}
|
|
|
|
+ Logger.d(resultInfo.toString())
|
|
callback(resultInfo)
|
|
callback(resultInfo)
|
|
}) {
|
|
}) {
|
|
if (TextUtils.isEmpty(it.localizedMessage)) {
|
|
if (TextUtils.isEmpty(it.localizedMessage)) {
|
|
resultInfo.msg = it.localizedMessage!!
|
|
resultInfo.msg = it.localizedMessage!!
|
|
}
|
|
}
|
|
|
|
+ Logger.d(resultInfo.toString())
|
|
callback(resultInfo)
|
|
callback(resultInfo)
|
|
}
|
|
}
|
|
VolleySingleton.getInstance(context.applicationContext).addToRequestQueue(context.applicationContext, request)
|
|
VolleySingleton.getInstance(context.applicationContext).addToRequestQueue(context.applicationContext, request)
|
|
@@ -216,7 +222,6 @@ object VolleyRequest {
|
|
return if (!TextUtils.isEmpty(message)) {
|
|
return if (!TextUtils.isEmpty(message)) {
|
|
message!!
|
|
message!!
|
|
} else {
|
|
} else {
|
|
-// ResUtils.getResString(context, "yyxx_network_tv_error")
|
|
|
|
"There was an error in the network connection, please try again later"
|
|
"There was an error in the network connection, please try again later"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -230,7 +235,6 @@ object VolleyRequest {
|
|
if (!TextUtils.isEmpty(message)) {
|
|
if (!TextUtils.isEmpty(message)) {
|
|
resultInfo.msg = message!!
|
|
resultInfo.msg = message!!
|
|
} else {
|
|
} else {
|
|
-// resultInfo.msg = ResUtils.getResString(context, "yyxx_network_tv_error")
|
|
|
|
resultInfo.msg = "There was an error in the network connection, please try again later"
|
|
resultInfo.msg = "There was an error in the network connection, please try again later"
|
|
}
|
|
}
|
|
}
|
|
}
|