billyyoyo лет назад: 6
Родитель
Сommit
775fd2d8e1

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/di/modules/NetModule.java

@@ -52,7 +52,7 @@ public class NetModule {
                 .baseUrl(SheepApp.getInstance().getConnectAddress().getAppUrl()+"v1/")
 //                .baseUrl("http://ss.17xmy.com/v1/")
 //                .baseUrl("http://192.168.0.109:8080/v1/")
-//                .baseUrl("http://10.8.240.193:8080/v1/")
+//                .baseUrl("http://10.8.240.180:8080/v1/")
                 .addConverterFactory(StringConverterFactory.create())
                 .addConverterFactory(FastJsonConverterFactory.create())
 //                .addConverterFactory(GsonConverterFactory.create(EntityUtils.gson))//

+ 6 - 0
app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java

@@ -227,6 +227,12 @@ public interface ApiService {
     Observable<BaseMessage> acceptedTask(@Body JSONObject param);
 
     /**
+     * 给商城任务随机商品
+     */
+    @POST("app/accepted_task/random_goods_for/{id}")
+    Observable<BaseMessage> randomGoodsForTask(@Path("id") int taskId);
+
+    /**
      * 获取自己正在运行的任务
      * show_game_task: 0 不显示游戏任务
      */

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

@@ -28,6 +28,15 @@ public class TaskAcceptedEty implements Serializable{
     private int allowSubmit;//失败或者下线后,是否可以再次提交截图 2 不可以 1 可以
     //用于自定义字段,如自定义手机号
     private String unique_identification;//UniqueIdentification string       `orm:"column(unique_identification);null" description:"唯一标识" json:"unique_identification"`
+    private ShopGoodsInfo goods_info;
+
+    public ShopGoodsInfo getGoods_info() {
+        return goods_info;
+    }
+
+    public void setGoods_info(ShopGoodsInfo goods_info) {
+        this.goods_info = goods_info;
+    }
 
     public int getChild_task_id() {
         return child_task_id;

+ 1 - 0
app/src/main/java/com/sheep/gamegroup/module/search/FgtSearch.java

@@ -102,6 +102,7 @@ public class FgtSearch extends BaseFragment implements ISearch {
         taskCount = 0;
         giftCount = 0;
         articleCount = 0;
+        goodsCount = 0;
         hideEmpty();
         search(true);
     }

+ 76 - 9
app/src/main/java/com/sheep/gamegroup/view/activity/TaskDetailAct.java

@@ -16,6 +16,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.kfzs.duanduan.cardview.ScreenUtil;
 import com.kfzs.duanduan.utils.ApkUtils;
+import com.kfzs.duanduan.utils.NumberFormatUtils;
 import com.liulishuo.okdownload.DownloadTask;
 import com.liulishuo.okdownload.OkDownload;
 import com.liulishuo.okdownload.StatusUtil;
@@ -39,11 +40,13 @@ import com.sheep.gamegroup.model.entity.DialogEntity;
 import com.sheep.gamegroup.model.entity.Ext;
 import com.sheep.gamegroup.model.entity.InputAndUrlList;
 import com.sheep.gamegroup.model.entity.ScreenshotsEntity;
+import com.sheep.gamegroup.model.entity.ShopGoodsInfo;
 import com.sheep.gamegroup.model.entity.TaskAcceptedEty;
 import com.sheep.gamegroup.model.entity.TaskChild;
 import com.sheep.gamegroup.model.entity.TaskDescEntity;
 import com.sheep.gamegroup.model.entity.TaskEty;
 import com.sheep.gamegroup.model.entity.Release_task;
+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.TaskDetailContract;
@@ -266,13 +269,29 @@ public class TaskDetailAct extends AbsChooseImageActivity implements TaskDetailC
     @BindView(R.id.ignore_video_btn)
     View ignore_video_btn;
 
+    //商品信息
+    @BindView(R.id.goods_info_bar)
+    View goods_info_bar;
+    @BindView(R.id.goods_name_view)
+    TextView goods_name_view;
+    @BindView(R.id.goods_price_view)
+    TextView goods_price_view;
+    @BindView(R.id.goods_market_view)
+    TextView goods_market_view;
+    @BindView(R.id.goods_exp_view)
+    TextView goods_exp_view;
+    @BindView(R.id.goods_icon_view)
+    ImageView goods_icon_view;
+
     //是否需要在onResume中刷新页面
     private boolean isFresh = false;
     private boolean isDownloadImmeditely = false;
     private boolean autoAcceptTask = true;
 
     @Override
-    protected boolean showWhiteStatusBar(){return true;}
+    protected boolean showWhiteStatusBar() {
+        return true;
+    }
 
     @Override
     protected int getLayoutId() {
@@ -395,10 +414,17 @@ public class TaskDetailAct extends AbsChooseImageActivity implements TaskDetailC
             detailTaskTv.setBackground(activity.getResources().getDrawable(R.drawable.selector_button_full_main));
         }
         //设置是否显示取消任务按钮
-        if (gettaskAcceptedEty != null && (gettaskAcceptedEty.getStatus() == 1 || gettaskAcceptedEty.getStatus() == 2) &&
-                taskEty.canCancelTask()) {
-            task_detail_reward.setVisibility(View.GONE);
-            task_detail_cancel.setVisibility(View.VISIBLE);
+        if (gettaskAcceptedEty != null) {
+            if ((gettaskAcceptedEty.getStatus() == 1 || gettaskAcceptedEty.getStatus() == 2) && taskEty.canCancelTask()) {
+                task_detail_reward.setVisibility(View.GONE);
+                task_detail_cancel.setVisibility(View.VISIBLE);
+            }
+            if (gettaskAcceptedEty.getGoods_info() != null) {
+                ViewUtil.setVisibility(goods_info_bar, true);
+                showGoods(gettaskAcceptedEty.getGoods_info());
+            } else {
+                ViewUtil.setVisibility(goods_info_bar, false);
+            }
         } else {
             task_detail_reward.setVisibility(View.VISIBLE);
             task_detail_cancel.setVisibility(View.GONE);
@@ -415,10 +441,10 @@ public class TaskDetailAct extends AbsChooseImageActivity implements TaskDetailC
             ViewUtil.setText(video_task_tip, "看完教程视频,立减" + taskReleaseEty.getVideo_amount() + "元");
         }
         ViewUtil.setText(most_discount_tag, taskReleaseEty.isShop() ? "商品抵扣" : "提现金额");
-        if(taskReleaseEty.isShop()){
+        if (taskReleaseEty.isShop()) {
             ViewUtil.setText(most_discount_tv, "最高抵扣" + taskReleaseEty.getShop_amount() + "元");
         } else {
-            if(DataUtil.getInstance().getUserEntity().isVIP()){
+            if (DataUtil.getInstance().getUserEntity().isVIP()) {
                 ViewUtil.setText(most_discount_tv, "+" + taskReleaseEty.getVIPBonusText() + "元");
             } else {
                 ViewUtil.setText(most_discount_tv, "+" + taskReleaseEty.getBonusText() + "元");
@@ -1519,8 +1545,12 @@ public class TaskDetailAct extends AbsChooseImageActivity implements TaskDetailC
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
                     @Override
                     public void onError(BaseMessage baseMessage) {
-                        hideProgress();
-                        G.showToast(baseMessage.getErrorMsg());
+                        if (baseMessage.getCode() == 400001) {
+                            randomGoods();
+                        } else {
+                            hideProgress();
+                            G.showToast(baseMessage.getErrorMsg());
+                        }
                     }
 
                     @Override
@@ -1540,6 +1570,43 @@ public class TaskDetailAct extends AbsChooseImageActivity implements TaskDetailC
                 });
     }
 
+    public void randomGoods() {
+        SheepApp.getInstance()
+                .getNetComponent()
+                .getApiService()
+                .randomGoodsForTask(releaseTaskId)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        hideProgress();
+                        acceptedTask();
+                    }
+
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        hideProgress();
+                        G.showToast(baseMessage.getErrorMsg());
+                    }
+                });
+    }
+
+    public void showGoods(ShopGoodsInfo goods) {
+        ViewUtil.setImage(goods_icon_view, goods.getImage());
+        ViewUtil.setText(goods_name_view, goods.getName());
+        UserEntity user = DataUtil.getInstance().getUserEntity();
+        if (user.isVIP()) {
+            ViewUtil.setText(goods_price_view, "¥" + NumberFormatUtils.retainMost2W(goods.getVipPrice()) + "元");
+            ViewUtil.setText(goods_exp_view, "+" + NumberFormatUtils.retainMost2W(goods.getVip_deductible_amount() * 10000) + "经验值");
+            ViewUtil.setText(goods_market_view, "直购 ¥" + NumberFormatUtils.retainMost2W(goods.getVip_goods_price()));
+        } else {
+            ViewUtil.setText(goods_price_view, "¥" + NumberFormatUtils.retainMost2W(goods.getPrice()) + "元");
+            ViewUtil.setText(goods_exp_view, "+" + NumberFormatUtils.retainMost2W(goods.getDeductible_amount() * 10000) + "经验值");
+            ViewUtil.setText(goods_market_view, "直购 ¥" + NumberFormatUtils.retainMost2W(goods.getGoods_price()));
+        }
+    }
 
     public void freshData() {
         if (releaseTaskId != -1 && isFresh) {

+ 1 - 0
app/src/main/res/drawable/shape_rect_gray_solid.xml

@@ -2,4 +2,5 @@
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle">
     <solid android:color="@color/gray_F0F0F0"/>
+    <corners android:radius="5dp"/>
 </shape>

+ 1 - 1
app/src/main/res/layout/item_every_day_share.xml

@@ -7,7 +7,7 @@
     android:layout_marginTop="@dimen/dp_10"
     android:layout_marginLeft="@dimen/dp_10"
     android:layout_marginRight="@dimen/dp_10"
-    android:background="@drawable/shape_rect_gray_solid"
+    android:background="@color/gray_F0F0F0"
     android:padding="@dimen/dp_10">
 
     <TextView

+ 115 - 27
app/src/main/res/layout/task_detail_layout.xml

@@ -427,6 +427,88 @@
                                 android:textSize="12sp" />
                         </LinearLayout>
 
+                        <android.support.constraint.ConstraintLayout
+                            android:id="@+id/goods_info_bar"
+                            android:visibility="gone"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:layout_marginTop="8dp"
+                            android:background="@drawable/shape_rect_gray_solid_5"
+                            android:gravity="center_vertical"
+                            android:orientation="horizontal"
+                            android:padding="12dp">
+
+                            <ImageView
+                                android:id="@+id/goods_icon_view"
+                                android:layout_width="120dp"
+                                android:layout_height="120dp"
+                                android:src="@mipmap/ic_launcher"
+                                app:layout_constraintLeft_toLeftOf="parent"
+                                app:layout_constraintTop_toTopOf="parent" />
+
+                            <TextView
+                                android:id="@+id/goods_name_view"
+                                android:layout_width="match_parent"
+                                android:layout_height="wrap_content"
+                                android:layout_marginRight="8dp"
+                                android:text="迪奥(Dior)迪奥小姐花漾淡香氛 (EDT) 50ml(喷装 清新淡花香调 初恋的气息 花漾淡香水)"
+                                android:lines="3"
+                                android:textColor="#ff333333"
+                                android:textSize="15sp"
+                                android:layout_marginLeft="127dp"
+                                app:layout_constraintTop_toTopOf="parent" />
+
+                            <TextView
+                                android:id="@+id/goods_tag_view"
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:text="回报购"
+                                android:textColor="#000000"
+                                android:textSize="11sp"
+                                app:layout_constraintTop_toBottomOf="@+id/goods_name_view"
+                                app:layout_constraintLeft_toRightOf="@+id/goods_icon_view"
+                                android:layout_marginRight="8dp"
+                                android:layout_marginLeft="8dp"
+                                android:layout_marginTop="12dp"/>
+
+                            <TextView
+                                android:id="@+id/goods_price_view"
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:text="$1.00"
+                                android:layout_marginLeft="8dp"
+                                app:layout_constraintLeft_toRightOf="@+id/goods_tag_view"
+                                app:layout_constraintBottom_toBottomOf="@+id/goods_tag_view"
+                                android:textColor="#fff21245"
+                                android:textSize="18sp"
+                                />
+
+                            <TextView
+                                android:id="@+id/goods_exp_view"
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:text="+50000经验"
+                                android:textColor="#fff21245"
+                                android:textSize="10sp"
+                                android:layout_marginLeft="8dp"
+                                android:layout_marginTop="4dp"
+                                app:layout_constraintTop_toBottomOf="@+id/goods_tag_view"
+                                app:layout_constraintLeft_toRightOf="@+id/goods_icon_view"/>
+
+                            <TextView
+                                android:id="@+id/goods_market_view"
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:text="直购 ¥69.00"
+                                android:textColor="#ff000000"
+                                android:textSize="10sp"
+                                android:layout_marginLeft="8dp"
+                                android:layout_marginTop="4dp"
+                                app:layout_constraintTop_toBottomOf="@+id/goods_exp_view"
+                                app:layout_constraintLeft_toRightOf="@+id/goods_icon_view"/>
+
+                        </android.support.constraint.ConstraintLayout>
+
                         <LinearLayout
                             android:id="@+id/watch_video_bar"
                             android:layout_width="match_parent"
@@ -450,20 +532,23 @@
                                 android:layout_height="14dp"
                                 android:layout_marginLeft="4dp"
                                 android:src="@mipmap/icon_select" />
+
                             <View
-                                android:layout_weight="1"
                                 android:layout_width="match_parent"
-                                android:layout_height="14dp"/>
+                                android:layout_height="14dp"
+                                android:layout_weight="1" />
+
                             <TextView
                                 android:id="@+id/play_video_btn"
+                                android:layout_width="72dp"
+                                android:layout_height="26dp"
+                                android:background="@drawable/rounder_e2f4fe_13"
+                                android:gravity="center"
                                 android:text="观看教程"
-                                android:textSize="13sp"
                                 android:textColor="#2ebef2"
-                                android:gravity="center"
-                                android:background="@drawable/rounder_e2f4fe_13"
-                                android:layout_width="72dp"
-                                android:layout_height="26dp" />
+                                android:textSize="13sp" />
                         </LinearLayout>
+
                         <LinearLayout
                             android:id="@+id/recharge_game_bar"
                             android:layout_width="match_parent"
@@ -472,6 +557,7 @@
                             android:gravity="center_vertical"
                             android:orientation="horizontal"
                             android:padding="8dp">
+
                             <TextView
                                 android:id="@+id/recharge_game_tag"
                                 android:layout_width="wrap_content"
@@ -487,6 +573,7 @@
                                 android:layout_marginLeft="4dp"
                                 android:src="@mipmap/text_delete" />
                         </LinearLayout>
+
                         <LinearLayout
                             android:layout_width="match_parent"
                             android:layout_height="wrap_content"
@@ -494,6 +581,7 @@
                             android:gravity="center_vertical"
                             android:orientation="horizontal"
                             android:padding="8dp">
+
                             <TextView
                                 android:id="@+id/task_complete_tag"
                                 android:layout_width="wrap_content"
@@ -616,53 +704,53 @@
 
         <RelativeLayout
             android:id="@+id/video_player_layer"
-            android:background="#90000000"
-            android:visibility="gone"
             android:layout_width="match_parent"
-            android:layout_height="match_parent">
+            android:layout_height="match_parent"
+            android:background="#90000000"
+            android:visibility="gone">
 
             <TextView
                 android:id="@+id/ignore_video_btn"
-                android:text="跳过"
-                android:textColor="@color/white"
-                android:textSize="14sp"
+                android:layout_width="54dp"
+                android:layout_height="30dp"
                 android:layout_above="@+id/video_player_view"
                 android:layout_alignRight="@+id/video_player_view"
                 android:layout_marginBottom="16dp"
-                android:gravity="center"
                 android:background="@drawable/shape_white_20_solid_rectangle_15"
-                android:layout_width="54dp"
-                android:layout_height="30dp" />
+                android:gravity="center"
+                android:text="跳过"
+                android:textColor="@color/white"
+                android:textSize="14sp" />
 
             <com.sheep.gamegroup.view.customview.SheepGSYVideoView
                 android:id="@+id/video_player_view"
                 android:layout_width="match_parent"
-                android:layout_marginLeft="24dp"
-                android:layout_marginRight="24dp"
                 android:layout_height="100dp"
-                android:layout_centerInParent="true" />
+                android:layout_centerInParent="true"
+                android:layout_marginLeft="24dp"
+                android:layout_marginRight="24dp" />
 
             <TextView
                 android:id="@+id/video_task_tip"
-                android:text="看完教程视频,立减元"
-                android:textColor="@color/white"
-                android:textSize="14sp"
+                android:layout_width="wrap_content"
+                android:layout_height="30dp"
                 android:layout_below="@+id/video_player_view"
                 android:layout_centerHorizontal="true"
                 android:layout_marginTop="16dp"
-                android:gravity="center"
                 android:background="@drawable/shape_white_20_solid_rectangle_15"
+                android:gravity="center"
                 android:paddingLeft="20dp"
                 android:paddingRight="20dp"
-                android:layout_width="wrap_content"
-                android:layout_height="30dp" />
+                android:text="看完教程视频,立减元"
+                android:textColor="@color/white"
+                android:textSize="14sp" />
 
             <ImageView
                 android:id="@+id/act_hard_work_iv"
                 android:layout_width="150dp"
                 android:layout_height="150dp"
-                android:layout_centerHorizontal="true"
-                android:layout_below="@+id/video_task_tip" />
+                android:layout_below="@+id/video_task_tip"
+                android:layout_centerHorizontal="true" />
         </RelativeLayout>
     </RelativeLayout>