Преглед изворни кода

修复接口可能无限调用的bug

zengjiebin пре 7 година
родитељ
комит
7b9013a3dc

+ 6 - 2
app/src/main/java/com/sheep/gamegroup/module/game/util/PromoteGoodsHelper.java

@@ -118,8 +118,12 @@ public class PromoteGoodsHelper {
                     @Override
                     public void onError(BaseMessage baseMessage) {
                         if(baseMessage.getCode() != null && baseMessage.getCode() == 400){
-                            //已经翻到最后一个,需要重新获取第一个数据
-                            refreshData();
+                            if(page == 1){//一条数据也没有,直接放弃
+
+                            } else {
+                                //已经翻到最后一个,需要重新获取第一个数据
+                                refreshData();
+                            }
                         } else {
                             ViewUtil.setVisibility(play_game_promote_goods, false);
                         }

+ 4 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/ActMain.java

@@ -172,6 +172,10 @@ public class ActMain extends BaseActYmPermissionCheck {
 
     private int lastPosition = MainTab.FgtSmallSheep.ordinal();//默认选中小绵羊
 
+    public int getLastPosition() {
+        return lastPosition;
+    }
+
     //多次点击预防
     public static final int MIN_CLICK_DELAY_TIME = 200;
     private long lastClickTime = 0;

+ 3 - 1
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtSmallSheep.java

@@ -83,6 +83,7 @@ import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.GlideImageLoader;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.ListUtil;
+import com.sheep.gamegroup.util.MainTab;
 import com.sheep.gamegroup.util.RefreshUtil;
 import com.sheep.gamegroup.util.StringUtils;
 import com.sheep.gamegroup.util.SysAppUtil;
@@ -93,6 +94,7 @@ import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.gamegroup.util.string.SpannableSb;
 import com.sheep.gamegroup.util.viewHelper.LayoutParamsUtil;
 import com.sheep.gamegroup.util.viewHelper.PopupWindowUtil;
+import com.sheep.gamegroup.view.activity.ActMain;
 import com.sheep.gamegroup.view.activity.ActMsg;
 import com.sheep.gamegroup.view.activity.ActWebX5SBD;
 import com.sheep.gamegroup.view.activity.NotificationsUtils;
@@ -1219,7 +1221,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
         CommonUtil.getInstance().callActionWithUserInfo(item -> userEntity = item);
         if (onResumeCount > 0)
             refreshTaskList();
-        if(!hasShowSbd && isVisible()){
+        if(!hasShowSbd && activity instanceof ActMain && ((ActMain) activity).getLastPosition() == MainTab.FgtSmallSheep.ordinal()){
             hasShowSbd = true;
             //延时显示随便打弹出框提示
             PopupWindowUtil.delayShowLayout(activity, new PopupWindowUtil.PopupWindowParams(R.layout.pop_show_sbd_tip).setAnchor(to_search_but_rl)