Bladeren bron

修复首页banner中任务详情类型中的数据格式变化

zengjiebin 8 jaren geleden
bovenliggende
commit
e28fc47300

+ 7 - 2
app/src/main/java/com/kfzs/duanduan/fragment/FgtSmallSheep.java

@@ -51,6 +51,7 @@ import com.sheep.gamegroup.model.entity.SlideshowEty;
 import com.sheep.gamegroup.model.entity.TaskAcceptedEty;
 import com.sheep.gamegroup.model.entity.TaskReleaseEty;
 import com.sheep.gamegroup.model.entity.UserEntity;
+import com.sheep.gamegroup.model.util.EntityUtils;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.presenter.SmallSheepContract;
 import com.sheep.gamegroup.presenter.SmallSheepPresenter;
@@ -873,8 +874,12 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
                                 .goTryplayView(activity, null);
                         break;
                     case 2:
-                        Jump2View.getInstance()
-                                .goTaskDetailView(activity, clickedGameObj.getObjects());
+                        try {
+                            Jump2View.getInstance()
+                                    .goTaskDetailView(activity, EntityUtils.getExtInfo(clickedGameObj.getExt()).getId());
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
                         break;
                     case 3:
                         Jump2View.getInstance()

+ 0 - 12
app/src/main/java/com/sheep/gamegroup/model/entity/TaskEty.java

@@ -194,18 +194,6 @@ public class TaskEty implements Serializable{
     }
 
 
-
-    public Ext getExtInfo(){
-        Ext extInfo;
-        try {
-            extInfo = JSONObject.parseObject(ext, Ext.class);
-        } catch (Exception e) {
-            e.printStackTrace();
-            extInfo = JSONObject.parseObject(JSONObject.toJSONString(ext), Ext.class);
-        }
-        return extInfo;
-    }
-
     public boolean needDownloadApp() {
         return task_type == 1 || task_type == 3;
     }

+ 12 - 0
app/src/main/java/com/sheep/gamegroup/model/util/EntityUtils.java

@@ -1,7 +1,9 @@
 package com.sheep.gamegroup.model.util;
 
+import com.alibaba.fastjson.JSONObject;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
+import com.sheep.gamegroup.model.entity.Ext;
 
 import org.joda.time.DateTime;
 
@@ -13,4 +15,14 @@ public final class EntityUtils {
             .registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter())
             .create();
 
+    public static Ext getExtInfo(String ext){
+        Ext extInfo;
+        try {
+            extInfo = JSONObject.parseObject(ext, Ext.class);
+        } catch (Exception e) {
+            e.printStackTrace();
+            extInfo = JSONObject.parseObject(JSONObject.toJSONString(ext), Ext.class);
+        }
+        return extInfo;
+    }
 }

+ 5 - 3
app/src/main/java/com/sheep/gamegroup/view/activity/DialogActivity.java

@@ -32,9 +32,11 @@ import com.sheep.gamegroup.di.components.DaggerTaskDialogComponent;
 import com.sheep.gamegroup.di.modules.TaskDialogModule;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.DialogEntity;
+import com.sheep.gamegroup.model.entity.Ext;
 import com.sheep.gamegroup.model.entity.TaskAcceptedEty;
 import com.sheep.gamegroup.model.entity.TaskEty;
 import com.sheep.gamegroup.model.entity.TaskState;
+import com.sheep.gamegroup.model.util.EntityUtils;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.presenter.TaskDialogContract;
 import com.sheep.gamegroup.presenter.TaskDialogPresenter;
@@ -270,14 +272,14 @@ public class DialogActivity extends Activity implements TaskDialogContract.View
 //                    finish();
                     break;
                 case 10://信用卡
-
+                    Ext ext;
                     if(taskEty == null) {
                         G.showToast("服务器数据错误,请联系客服或者稍候重试");
-                    } else if(taskEty.getExtInfo() == null || TextUtils.isEmpty(taskEty.getExtInfo().getUrl())){
+                    } else if((ext = EntityUtils.getExtInfo(taskEty.getExt())) == null || TextUtils.isEmpty(ext.getUrl())){
                         Jump2View.getInstance().goTaskDetailView(activity,  taskEty.getId());
                     } else {
                         Jump2View.getInstance()
-                                .goWeb(activity, taskEty.getExtInfo().getUrl(), taskEty.getTask_name());
+                                .goWeb(activity, ext.getUrl(), taskEty.getTask_name());
                     }
                     break;
             }

+ 5 - 2
app/src/main/java/com/sheep/gamegroup/view/activity/TaskDetailAct.java

@@ -32,9 +32,11 @@ import com.sheep.gamegroup.di.components.DaggerTaskDetailComponent;
 import com.sheep.gamegroup.di.modules.TaskDetailModule;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.DialogEntity;
+import com.sheep.gamegroup.model.entity.Ext;
 import com.sheep.gamegroup.model.entity.TaskAcceptedEty;
 import com.sheep.gamegroup.model.entity.TaskEty;
 import com.sheep.gamegroup.model.entity.TaskReleaseEty;
+import com.sheep.gamegroup.model.util.EntityUtils;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.presenter.TaskDetailContract;
 import com.sheep.gamegroup.presenter.TaskDetailPresenter;
@@ -434,11 +436,12 @@ public class TaskDetailAct extends AbsChooseImageActivity implements TaskDetailC
                         PackageUtil.startApp(SheepApp.mContext, taskEty.getPackage_names());
                         break;
                     case 10:
-                        if(taskEty == null || taskEty.getExtInfo() == null || TextUtils.isEmpty(taskEty.getExtInfo().getUrl())){
+                        Ext ext;
+                        if(taskEty == null || (ext = EntityUtils.getExtInfo(taskEty.getExt())) == null || TextUtils.isEmpty(ext.getUrl())){
                             G.showToast("服务器数据错误,请联系客服或者稍候重试");
                         } else {
                             Jump2View.getInstance()
-                                    .goWeb(activity, taskEty.getExtInfo().getUrl(), taskEty.getTask_name());
+                                    .goWeb(activity, ext.getUrl(), taskEty.getTask_name());
                         }
                         break;
                 }

+ 2 - 1
app/src/main/java/com/sheep/gamegroup/view/activity/TaskDetailCreditCardAct.java

@@ -24,6 +24,7 @@ import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.CreditCard;
 import com.sheep.gamegroup.model.entity.TaskEty;
 import com.sheep.gamegroup.model.entity.TaskReleaseEty;
+import com.sheep.gamegroup.model.util.EntityUtils;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.util.DeviceUtil;
 import com.sheep.gamegroup.util.Jump2View;
@@ -262,7 +263,7 @@ public class TaskDetailCreditCardAct extends AbsChooseImageActivity {
     }
 
     private void goWeb() {
-        SheepApp.getInstance().getNetComponent().getApiService().getCredit(taskEty.getExtInfo().getId())
+        SheepApp.getInstance().getNetComponent().getApiService().getCredit(EntityUtils.getExtInfo(taskEty.getExt()).getId())
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
                 .subscribe(new SheepSubscriber<BaseMessage>(activity) {

+ 2 - 1
app/src/main/java/com/sheep/gamegroup/view/adapter/CreditCardProgressQueryAdp.java

@@ -11,6 +11,7 @@ import android.widget.TextView;
 import com.bumptech.glide.Glide;
 import com.sheep.gamegroup.model.entity.CreditCardProgressQuery;
 import com.sheep.gamegroup.model.entity.TaskReleaseEty;
+import com.sheep.gamegroup.model.util.EntityUtils;
 import com.sheep.gamegroup.util.BtStatusUtil;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.view.activity.ActCreditCardTaskList;
@@ -75,7 +76,7 @@ public class CreditCardProgressQueryAdp extends BaseAdapter {
         holder.credit_card_task_find_tv.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                Jump2View.getInstance().goWeb(context, ety.getTask().getExtInfo().getQuery_url(), "进度查询");
+                Jump2View.getInstance().goWeb(context, EntityUtils.getExtInfo(ety.getTask().getExt()).getQuery_url(), "进度查询");
             }
         });
         holder.credit_card_task_upload_tv.setEnabled(BtStatusUtil.getEnabled(creditCardProgressQuery.getStatus()));