Browse Source

1.拦截器修改异常抛出逻辑

20241218TB223FC(测试jar包)
wangwanlei 8 months ago
parent
commit
aa143c92e7

+ 4
- 5
corelib/src/main/java/com/xhly/corelib/network/ResponseInterceptor.kt View File

39
                 charset = contentType.charset(charset)
39
                 charset = contentType.charset(charset)
40
             }
40
             }
41
             val bodyString = buffer.clone().readString(charset)
41
             val bodyString = buffer.clone().readString(charset)
42
-            val data = GsonUtils.parseJsonWithGson(bodyString, ResponseData::class.java)
43
-            if (data == null) {
44
-                throw RuntimeException("数据为空")
45
-            } else {
42
+         /*   val data = GsonUtils.parseJsonWithGson(bodyString, ResponseData::class.java)
43
+            if (data != null) {
44
+            //TODO 接口统一退出
46
                 if (data.code == 401) {
45
                 if (data.code == 401) {
47
                     //强制退出
46
                     //强制退出
48
                     UIEvent(Const.LOGIN_OUT_401).post()
47
                     UIEvent(Const.LOGIN_OUT_401).post()
49
                 }
48
                 }
50
-            }
49
+            }*/
51
             originalResponse
50
             originalResponse
52
         } catch (e: Exception) {
51
         } catch (e: Exception) {
53
             e.printStackTrace()
52
             e.printStackTrace()

Loading…
Cancel
Save