Procházet zdrojové kódy

预约 逻辑修改

liujiangyao před 7 roky
rodič
revize
b280950e11

+ 10 - 1
app/src/main/java/com/sheep/gamegroup/model/entity/Ext.java

@@ -10,6 +10,15 @@ public class Ext {
     private String url;
     private String title;
     private String task_desc_url;
+    private int TypeId;
+
+    public int getTypeId() {
+        return TypeId;
+    }
+
+    public void setTypeId(int typeId) {
+        TypeId = typeId;
+    }
 
     public String getTask_desc_url() {
         return task_desc_url;
@@ -20,7 +29,7 @@ public class Ext {
     }
 
     public int getId() {
-        return id;
+        return id == 0?TypeId:id;
     }
 
     public void setId(int id) {

+ 9 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/SlideshowEty.java

@@ -15,10 +15,19 @@ public class SlideshowEty {
             private int Type = 1;// 0,类型 1跳转试玩赚钱、2单个任务详情、3信用卡办理、4 H5页面
             private String UpdateTime;// 0,
             private String Url;// private String stringprivate String
+    private int TypeId;
     private String Title;
 
     private String objects;//预留字段
 
+    public int getTypeId() {
+        return TypeId;
+    }
+
+    public void setTypeId(int typeId) {
+        TypeId = typeId;
+    }
+
     public String getTitle() {
         return Title;
     }

+ 37 - 18
app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java

@@ -1179,8 +1179,15 @@ public class CommonUtil {
                                                 action1.call(1);
                                         }
                                     }));
-                        } else {
-                            G.showToast(baseMessage);
+                        } else if(baseMessage.getCode() == 0){
+                            try {
+                                if (action1 != null)
+                                    action1.call(TextUtils.isEmpty(baseMessage.getData()+"")?0:Integer.valueOf(baseMessage.getData()+""));
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+                        }else {
+                            G.showToast(baseMessage.getMsg());
                         }
                     }
 
@@ -2137,29 +2144,41 @@ public class CommonUtil {
     /**
      * 玩转游戏 按钮设置
      * type 1
+     * 0,--------1,已接受任务 2,正在进行中,3完成任务,4放弃任务,5任务失败,6审核失败,7提交审核,8任务已下线,9至少完成了一个任务了
      */
-    public void palyGameDetailBtnValue(final Context context, final GameEntity gameEntity, TextView detail_task_tv_center, int type){
+    public void palyGameDetailBtnValue(final Context context, final GameEntity gameEntity, final TextView detail_task_tv_center, final int type){
         final TaskReleaseEty releaseEty = gameEntity.getRelease_task();
         final TaskEty taskEty = releaseEty != null?releaseEty.getTask():null;
         if(releaseEty != null && taskEty != null) {//游戏任务
 
             if (taskEty.isGameReservationCantDownload()) {//预约
-                detail_task_tv_center.setText("预约下载");
-                detail_task_tv_center.setEnabled(true);
-                if(type == 0){
-                    detail_task_tv_center.setOnClickListener(new View.OnClickListener() {
-                        @Override
-                        public void onClick(View view) {
-                            CommonUtil.getInstance().reservationGameTask(context, releaseEty, new Action1<Integer>() {
-                                @Override
-                                public void call(Integer integer) {
+                if(gameEntity.getStatus() == 1 || gameEntity.getStatus() == 2 || gameEntity.getStatus() == 3){
+                    detail_task_tv_center.setText("已经预约");
+                    detail_task_tv_center.setEnabled(false);
+                }else {
+                    detail_task_tv_center.setText("预约下载");
+                    detail_task_tv_center.setEnabled(true);
+                    if(type == 0){
+                        detail_task_tv_center.setOnClickListener(new View.OnClickListener() {
+                            @Override
+                            public void onClick(View view) {
+                                CommonUtil.getInstance().reservationGameTask(context, releaseEty, new Action1<Integer>() {
+                                    @Override
+                                    public void call(Integer integer) {
+                                        if(integer > 0){
+                                            gameEntity.setAccepted_task_id(integer);
+                                            detail_task_tv_center.setText("已预约");
+                                            detail_task_tv_center.setEnabled(false);
 
-                                }
-                            });
-                        }
-                    });
+                                        }
+                                    }
+                                });
+                            }
+                        });
 
+                    }
                 }
+
             } else {
                 releaseEty.getDownloadHelper().updateDownloadTaskView((Activity) context, taskEty, detail_task_tv_center, null, type);
             }
@@ -2176,7 +2195,7 @@ public class CommonUtil {
      * 领取礼包
      * @param item
      */
-    public void receiveGiftById(final Context context, final GiftBagApp item, final Action1<Integer> action1) {
+    public void receiveGiftById(final Context context, final GiftBagApp item, final Action1<Integer> action1, final String packageName) {
         SheepApp.getInstance().getNetComponent().getApiService().receiveGiftBag(item.getGift_bag().getId())
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
@@ -2187,7 +2206,7 @@ public class CommonUtil {
                         item.setCode(code);
                         if(action1 != null)
                             action1.call(TO_REFRESH);
-                        ViewUtil.shareGetWelfareDialog((Activity) context, item);
+                        ViewUtil.shareGetWelfareDialog((Activity) context, item, packageName);
                     }
 
                     @Override

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

@@ -113,7 +113,7 @@ public class FgtPlaGameGift extends BaseFragment {
                                         btn_tv.setEnabled(false);
                                         notifyDataSetChanged();
                                     }
-                                });
+                                },gameEntity.getApp().getPackage_name());
                             }
 
                         }