|
|
@@ -1,5 +1,9 @@
|
|
|
package com.yingyangfly.baselib.net
|
|
|
|
|
|
+import com.alibaba.android.arouter.launcher.ARouter
|
|
|
+import com.yingyangfly.baselib.router.RouterUrlCommon
|
|
|
+import com.yingyangfly.baselib.utils.JumpUtil
|
|
|
+
|
|
|
/**
|
|
|
* @author gold
|
|
|
* @date 2022/9/2 下午12:24
|
|
|
@@ -19,11 +23,17 @@ open class BaseResp<T>(
|
|
|
* 网络数据请求成功
|
|
|
*/
|
|
|
inline fun y(func: (data: T?) -> Unit) {
|
|
|
- if (this.code == ResponseCode.SUCCESS) {
|
|
|
- func(data)
|
|
|
- } else {
|
|
|
- n {
|
|
|
- this.message
|
|
|
+ when (this.code) {
|
|
|
+ ResponseCode.SUCCESS -> {
|
|
|
+ func(data)
|
|
|
+ }
|
|
|
+ ResponseCode.TOKENLOSEEFFICACY -> {
|
|
|
+ JumpUtil.jumpActivity(RouterUrlCommon.login)
|
|
|
+ }
|
|
|
+ else -> {
|
|
|
+ n {
|
|
|
+ this.message
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|