|
@@ -2,6 +2,9 @@ package com.yingyangfly.baselib.net
|
|
|
|
|
|
import android.util.Log
|
|
|
import com.tencent.bugly.crashreport.CrashReport
|
|
|
+import com.yingyangfly.baselib.router.RouterUrlCommon
|
|
|
+import com.yingyangfly.baselib.utils.JumpUtil
|
|
|
+import com.yingyangfly.baselib.utils.User
|
|
|
import io.reactivex.Observer
|
|
|
import io.reactivex.annotations.NonNull
|
|
|
import io.reactivex.disposables.Disposable
|
|
@@ -16,6 +19,7 @@ abstract class BaseObserver<T> : Observer<XBaseEntity<T>> {
|
|
|
|
|
|
val TAG = "BaseObserver"
|
|
|
private val SUCCESS_CODE = 200
|
|
|
+ private val TOKENLOSEEFFICACY = 403
|
|
|
|
|
|
override fun onSubscribe(@NonNull d: Disposable) {
|
|
|
logd("onSubscribe")
|
|
@@ -31,6 +35,17 @@ abstract class BaseObserver<T> : Observer<XBaseEntity<T>> {
|
|
|
// 异常上报
|
|
|
CrashReport.postCatchedException(e)
|
|
|
}
|
|
|
+ } else if (TOKENLOSEEFFICACY == tBaseEntity.code) {
|
|
|
+ User.saveMobile("")
|
|
|
+ User.saveIdCard("")
|
|
|
+ User.saveUserSex("")
|
|
|
+ User.saveUserAge("")
|
|
|
+ User.saveDoctorAvatar("")
|
|
|
+ User.saveAvatar("")
|
|
|
+ User.saveName("")
|
|
|
+ User.saveUserId("")
|
|
|
+ User.saveOrgCode("")
|
|
|
+ JumpUtil.jumpActivity(RouterUrlCommon.login)
|
|
|
} else {
|
|
|
loge("onNext--Failure--code:" + tBaseEntity.code + "--Message:" + tBaseEntity.message)
|
|
|
onFail(tBaseEntity.message)
|