Przeglądaj źródła

优化登录过期

zengjiebin 7 lat temu
rodzic
commit
ac14f3f3a3

+ 3 - 2
app/src/main/java/com/sheep/gamegroup/model/util/SheepSubscriber.java

@@ -82,13 +82,13 @@ public abstract class SheepSubscriber<T> implements Observer<T> {
                     if (curAct != null) {
                         if (curAct instanceof LoginAct || UMConfigUtils.isNotNeedAct(curAct)) {//本身就是登录界面 或者可以不用登录就存在的界面,如:支付界面
                         } else {
-                            SpUtils.saveToken(SheepApp.getInstance(), "");
-                            Jump2View.getInstance().gotoLoginAgain(baseMessage.getMsg());
+                            Jump2View.getInstance().gotoLoginAgain();
                             return;
                         }
                     } else {
 
                     }
+                    return;
                 }
                 //未绑定手机号
                 if (throwable.code == 302 && baseMessage.getCode() == 30001) {
@@ -96,6 +96,7 @@ public abstract class SheepSubscriber<T> implements Observer<T> {
                     return;
                 } else if (baseMessage.getCode() == 1002) {
                     Jump2View.getInstance().gotoLoginAgain();
+                    return;
                 }
 
                 if (baseMessage.getCode() == 0)

+ 5 - 1
app/src/main/java/com/sheep/gamegroup/util/Jump2View.java

@@ -1501,9 +1501,13 @@ public class Jump2View {
     }
 
     public void gotoLoginAgain(String o) {
+        String token = SpUtils.getToken(SheepApp.getInstance());
+        if(TextUtils.isEmpty(token)) {
+            return;
+        }
         SpUtils.saveToken(SheepApp.getInstance(), "");
         DataUtil.getInstance().clearData();
-        G.showToast(TextUtils.isEmpty(o) ? "请重新登录" : o);
+        G.showToast(TextUtils.isEmpty(o) ? "登录信息已过期,请重新登录" : o);
         Intent intent = new Intent(SheepApp.getInstance(), ActMain.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         intent.putExtra("INTENT_ACTION", "LOGOUT");
         SheepApp.getInstance().startActivity(intent);