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

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

@@ -182,7 +182,7 @@ public interface ApiService {
      * now only 1:微信
      */
     @POST("app/withdraw/")
-    Observable<BaseMessage> goWithdrawal(@Body JSONObject parame);
+    Observable<BaseMessage> goWithdrawal(@Header("Authorization") String token, @Body JSONObject parame);
 
     /**
      * 提现绑定微信号
@@ -448,7 +448,7 @@ public interface ApiService {
      * @return
      */
     @GET("app/user/get_can_withdraw_amount")
-    Observable<BaseMessage> getCanWithdrawAmount();
+    Observable<BaseMessage> getCanWithdrawAmount(@Header("Authorization") String token);
 
     @GET("loan/userRecord")
     Observable<BaseMessage> userRecord();
@@ -524,7 +524,7 @@ public interface ApiService {
      * 获取提现金额
      */
     @GET("app/withdraw_amount_option")
-    Observable<BaseMessage> getWithdrawAmountOption();
+    Observable<BaseMessage> getWithdrawAmountOption(@Header("Authorization") String token);
 
     /**
      * 任务类型

+ 3 - 3
app/src/main/java/com/sheep/gamegroup/presenter/WithdrawalContract.java

@@ -11,9 +11,9 @@ public interface WithdrawalContract {
 
     interface Presenter{
 
-        void goWithdrawal(JSONObject jsonObject);
-        void getCanWithdrawAmount();
-        void getWithdrawAmountOption();
+        void goWithdrawal(String token, JSONObject jsonObject);
+        void getCanWithdrawAmount(String token);
+        void getWithdrawAmountOption(String token);
 
     }
 

+ 6 - 6
app/src/main/java/com/sheep/gamegroup/presenter/WithdrawalPresenter.java

@@ -27,8 +27,8 @@ public class WithdrawalPresenter implements WithdrawalContract.Presenter {
     }
 
     @Override
-    public void goWithdrawal(JSONObject jsonObject) {
-        apiService.goWithdrawal(jsonObject)
+    public void goWithdrawal(String token, JSONObject jsonObject) {
+        apiService.goWithdrawal(token, jsonObject)
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
@@ -45,8 +45,8 @@ public class WithdrawalPresenter implements WithdrawalContract.Presenter {
     }
 
     @Override
-    public void getCanWithdrawAmount() {
-        apiService.getCanWithdrawAmount()
+    public void getCanWithdrawAmount(String token) {
+        apiService.getCanWithdrawAmount(token)
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
@@ -63,8 +63,8 @@ public class WithdrawalPresenter implements WithdrawalContract.Presenter {
     }
 
     @Override
-    public void getWithdrawAmountOption() {
-        apiService.getWithdrawAmountOption()
+    public void getWithdrawAmountOption(String token) {
+        apiService.getWithdrawAmountOption(token)
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {

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

@@ -283,6 +283,13 @@ public class Jump2View {
         UMConfigUtils.onEvent(UMConfigUtils.Event.SHEEP_TIXIAN);
     }
 
+    public void goWithdrawal(Context context, String token) {
+        Intent intent = new Intent(context, WithdrawalAct.class);
+        intent.putExtra("fromToken", token);
+        context.startActivity(intent);
+        UMConfigUtils.onEvent(UMConfigUtils.Event.SHEEP_TIXIAN);
+    }
+
     /**
      * 跳转到提现页面
      *
@@ -290,6 +297,14 @@ public class Jump2View {
      * @param userEntity
      */
     public void tryGoWithdrawal(Context context, UserEntity userEntity) {
+        tryGoWithdrawal(context, userEntity, null);
+    }
+
+    public void tryGoWithdrawal(Context context, String token) {
+        tryGoWithdrawal(context, null, token);
+    }
+
+    public void tryGoWithdrawal(Context context, UserEntity userEntity, String token) {
         if (userEntity == null) {
             userEntity = DataUtil.getInstance().getUserEntity();
         }
@@ -307,7 +322,11 @@ public class Jump2View {
             goRealNameAuther(context, userEntity, RealNameAuthenAct.GO_WITHDRAWAL);
             return;
         }
-        goWithdrawal(context);
+        if (TextUtils.isEmpty(token)) {
+            goWithdrawal(context);
+        } else {
+            goWithdrawal(context, token);
+        }
     }
 
 

+ 3 - 2
app/src/main/java/com/sheep/gamegroup/view/activity/ActMyMoney.java

@@ -26,6 +26,7 @@ import com.sheep.gamegroup.absBase.ILoadMore;
 import com.sheep.gamegroup.absBase.IRefresh;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.UserAssets;
+import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.gamegroup.model.entity.WebParams;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.module.home.fragment.FgtHome;
@@ -244,10 +245,10 @@ public class ActMyMoney extends BaseActivity {
     public void onViewClicked(View view) {
         switch (view.getId()) {
             case R.id.my_money_withdraw_tv://提现
-                Jump2View.getInstance().tryGoWithdrawal(ActMyMoney.this, null);
+                Jump2View.getInstance().tryGoWithdrawal(ActMyMoney.this, foreignToken);
                 break;
             case R.id.my_money_recharge_tv://充值
-                Jump2View.getInstance().goRechargeAct(ActMyMoney.this, "我的资产");
+                Jump2View.getInstance().goRechargeAct(ActMyMoney.this, "我的资产", foreignToken);
                 break;
             case R.id.my_money_dingxiang_amount://定向货币详情
             case R.id.my_money_dingxiang_tag: {//定向货币详情

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

@@ -8,6 +8,7 @@ import android.text.TextUtils;
 import com.alibaba.fastjson.JSONObject;
 import com.kfzs.duanduan.utils.NumberFormatUtils;
 import com.sheep.gamegroup.model.entity.JPushMessage;
+import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.gamegroup.util.ActionUtil;
 import com.sheep.gamegroup.util.IDConstant;
 import com.sheep.gamegroup.util.Jump2View;
@@ -131,7 +132,7 @@ public class MiddleAct extends Activity {
                 Jump2View.getInstance().goPersonnalCenterView(activity, null);
                 break;
             case 62://提现
-                Jump2View.getInstance().tryGoWithdrawal(activity, null);
+                Jump2View.getInstance().tryGoWithdrawal(activity, (UserEntity) null);
                 break;
             case 621://提现结果页面
                 Jump2View.getInstance().goWithdrawalResultview(activity, NumberFormatUtils.parseFloat(msg.getMsg()));

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

@@ -22,6 +22,7 @@ import com.sheep.gamegroup.absBase.ILoadMore;
 import com.sheep.gamegroup.absBase.IRefresh;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.UserAssets;
+import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.gamegroup.model.entity.WebParams;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.module.home.fragment.FgtHome;
@@ -239,7 +240,7 @@ public class NewYearActMyMoney extends BaseActivity {
     public void onViewClicked(View view) {
         switch (view.getId()) {
             case R.id.my_money_withdraw_tv://提现
-                Jump2View.getInstance().tryGoWithdrawal(NewYearActMyMoney.this, null);
+                Jump2View.getInstance().tryGoWithdrawal(NewYearActMyMoney.this, (UserEntity)null);
                 break;
             case R.id.my_money_recharge_tv://充值
                 Jump2View.getInstance().goRechargeAct(NewYearActMyMoney.this, "我的资产");

+ 16 - 11
app/src/main/java/com/sheep/gamegroup/view/activity/WithdrawalAct.java

@@ -73,7 +73,7 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
     private int withdrawCount;
     private float balanceAmount;//余额
 
-    private UserEntity userEntity;
+    private String fromToken;
 
     @Override
     protected int getLayoutId() {
@@ -87,6 +87,10 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
 
     @Override
     public void initView() {
+        fromToken = getIntent().getStringExtra("fromToken");
+        if(TextUtils.isEmpty(fromToken)){
+            fromToken = SpUtils.getToken(this);
+        }
         activity = this;
         TitleBarUtils
                 .getInstance()
@@ -120,8 +124,8 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
             }
         });
         showProgress();
-        presenter.getCanWithdrawAmount();
-        presenter.getWithdrawAmountOption();
+        presenter.getCanWithdrawAmount(fromToken);
+        presenter.getWithdrawAmountOption(fromToken);
     }
 
     @Override
@@ -148,18 +152,19 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
     }
 
     public void mInitData() {
-        userEntity = DataUtil.getInstance().getUserEntity();
-        if (userEntity != null) {
-            ViewUtil.setText(weixin_name_tv, userEntity.getWx_nickname());
-        }
-        setBalanceAmount();
+        CommonUtil.getInstance().getUserInfo(fromToken, entity->{
+            if (entity != null) {
+                ViewUtil.setText(weixin_name_tv, entity.getWx_nickname());
+            }
+            setBalanceAmount();
+        });
     }
 
     @OnClick({R.id.withdrawal_sure})
     public void onViewClicked(View view) {
         switch (view.getId()) {
             case R.id.withdrawal_sure:
-                ActPayPassword.verifyPwd(this, SpUtils.getToken(this), "",(ret)->{
+                ActPayPassword.verifyPwd(this, fromToken, "",(ret)->{
                    if(!ret){
                        doWithdrawal();
                    }
@@ -182,7 +187,7 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
             jsonObject.put("amount", Float.valueOf(amount));
             jsonObject.put("type", 1);
             showProgress();
-            presenter.goWithdrawal(jsonObject);
+            presenter.goWithdrawal(fromToken, jsonObject);
         } else {
             G.showToast(R.string.loading_data);
         }
@@ -207,7 +212,7 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
     public void updateView(Object o) {
         hideProgress();
         CommonUtil.getInstance().updateUserInfo(null);
-        presenter.getCanWithdrawAmount();
+        presenter.getCanWithdrawAmount(fromToken);
         Jump2View.getInstance().goWithdrawalResultview(activity, NumberFormatUtils.parseFloat(amount));
     }
 

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

@@ -122,7 +122,7 @@ public class NewbieTaskAdp extends BaseAdapter {
                     Jump2View.getInstance().goUnderstandSheep(context, null);
                     break;
                 case 2://完成首次提现
-                    Jump2View.getInstance().tryGoWithdrawal(context, null);
+                    Jump2View.getInstance().tryGoWithdrawal(context, (UserEntity)null);
                     break;
                 case 3://成功邀请好友
                     Intent intent = new Intent(context, ActMain.class);