删除支付宝&提现相关代码
This commit is contained in:
@@ -2,8 +2,6 @@ package com.chwl.app.ui.im;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.chwl.app.earn.activity.EarnRecordActivity;
|
||||
import com.trello.rxlifecycle3.components.support.RxAppCompatActivity;
|
||||
@@ -52,7 +50,6 @@ import com.chwl.core.room.bean.RoomInfo;
|
||||
import com.chwl.core.room.model.AvRoomModel;
|
||||
import com.chwl.core.utils.net.BeanObserver;
|
||||
import com.chwl.core.utils.net.RxHelper;
|
||||
import com.chwl.core.withdraw.WithdrawModel;
|
||||
import com.chwl.library.net.rxnet.callback.CallBack;
|
||||
import com.chwl.library.utils.JavaUtil;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
@@ -47,20 +47,6 @@ public class CommonWebViewFragment extends BaseBindingFragment<FragmentCommonWeb
|
||||
Logger.e("shouldOverrideUrlLoading--------" + url);
|
||||
//modules/noble/paySuccess.html
|
||||
//modules/noble/order.html?nobleIndex=1 // 获取上下文, H5PayDemoActivity为当前页面
|
||||
// ------ 对alipays:相关的scheme处理 -------
|
||||
if (url.startsWith("alipays:") || url.startsWith("alipay")) {
|
||||
try {
|
||||
CommonWebViewFragment.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(url)));
|
||||
} catch (Exception e) {
|
||||
new BaseAlertDialogBuilder(CommonWebViewFragment.this.mContext)
|
||||
.setMessage(ResUtil.getString(R.string.ui_webview_commonwebviewfragment_01))
|
||||
.setPositiveButton(ResUtil.getString(R.string.ui_webview_commonwebviewfragment_02), (dialog, which) -> {
|
||||
Uri alipayUrl = Uri.parse("https://d.alipay.com");
|
||||
CommonWebViewFragment.this.startActivity(new Intent("android.intent.action.VIEW", alipayUrl));
|
||||
}).setNegativeButton(ResUtil.getString(R.string.ui_webview_commonwebviewfragment_03), null).show();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (url.contains("tel:")) {
|
||||
//删除直接拨打电话的功能
|
||||
return true;
|
||||
|
@@ -15,16 +15,6 @@ public class RouterType {
|
||||
*/
|
||||
public static final int H5 = 2;
|
||||
|
||||
/**
|
||||
* 3-钱包页;
|
||||
*/
|
||||
public static final int WALLET = 3;
|
||||
|
||||
/**
|
||||
* 4-红包;
|
||||
*/
|
||||
public static final int RED = 4;
|
||||
|
||||
/**
|
||||
* 5-充值页;
|
||||
*/
|
||||
@@ -65,30 +55,11 @@ public class RouterType {
|
||||
*/
|
||||
public static final int TEAM = 11;
|
||||
|
||||
/**
|
||||
* 背景
|
||||
*/
|
||||
public static final int BG = 12;
|
||||
|
||||
/**
|
||||
* 星秀玩友
|
||||
*/
|
||||
public static final int NEW_USER = 13;
|
||||
/**
|
||||
* 邀请
|
||||
*/
|
||||
public static final int INVITATION = 14;
|
||||
|
||||
/**
|
||||
* 公聊大厅
|
||||
*/
|
||||
public static final int PUBLIC_CHAT_HALL = 15;
|
||||
|
||||
/**
|
||||
* 绑定 支付宝 账号
|
||||
*/
|
||||
public static final int BINDING_ALI_PAY_ACCOUNT = 16;
|
||||
|
||||
/**
|
||||
* 绑定手机号
|
||||
*/
|
||||
@@ -131,15 +102,6 @@ public class RouterType {
|
||||
|
||||
public static final int PERSION_SETTING = 30;
|
||||
|
||||
/**
|
||||
* 弹窗
|
||||
*/
|
||||
public static final int POP_OUT = 40;
|
||||
|
||||
/**
|
||||
* 我的声音列表
|
||||
*/
|
||||
public static final int MY_VOICE = 41;
|
||||
/**
|
||||
* 声音匹配首页
|
||||
*/
|
||||
@@ -149,10 +111,6 @@ public class RouterType {
|
||||
*/
|
||||
public static final int OPPOSITE_SEX_MATCHING = 43;
|
||||
|
||||
/**
|
||||
* 嗨聊派对
|
||||
*/
|
||||
public static final int CHAT_PARTY = 44;
|
||||
/**
|
||||
* 城市匹配
|
||||
*/
|
||||
@@ -161,24 +119,11 @@ public class RouterType {
|
||||
* 游戏匹配
|
||||
*/
|
||||
public static final int GAME_MATCHING = 46;
|
||||
/**
|
||||
* 话题
|
||||
*/
|
||||
public static final int MINI_WORLD = 47;
|
||||
|
||||
/**
|
||||
* 首页-测一测
|
||||
*/
|
||||
public static final int MINI_WORLD_TEST = 48;
|
||||
|
||||
/**
|
||||
* 话题客态页
|
||||
*/
|
||||
public static final int MINI_WORLD_DETAIL = 49;
|
||||
/**
|
||||
* ios分享使用,android未用到
|
||||
*/
|
||||
public static final int IOS_USED_ONE = 50;
|
||||
/**
|
||||
* 发布动态
|
||||
*/
|
||||
@@ -234,14 +179,6 @@ public class RouterType {
|
||||
* 67-我的公会
|
||||
*/
|
||||
public static final int MODULE_CLAN = 67;
|
||||
/**
|
||||
* 68-青少年模式
|
||||
*/
|
||||
public static final int PATRIARCH_MODE = 68;
|
||||
/**
|
||||
* 69-赛程管理
|
||||
*/
|
||||
public static final int SCHEDULE_MANAGE = 69;
|
||||
/**
|
||||
* 70-访客记录
|
||||
*/
|
||||
@@ -272,8 +209,6 @@ public class RouterType {
|
||||
*/
|
||||
public static final int MY_SET = 75;
|
||||
|
||||
public static final int TOPIC = 76;
|
||||
|
||||
/**
|
||||
* 收益记录(目前只是本地用到,所以用了100000)
|
||||
*/
|
||||
|
@@ -40,7 +40,6 @@ import com.chwl.core.user.event.LoadLoginUserInfoEvent;
|
||||
import com.chwl.core.utils.CurrentTimeUtils;
|
||||
import com.chwl.core.utils.SharedPreferenceUtils;
|
||||
import com.chwl.core.utils.net.RxHelper;
|
||||
import com.chwl.core.withdraw.WithdrawModel;
|
||||
import com.chwl.library.net.rxnet.RxNet;
|
||||
import com.chwl.library.utils.JavaUtil;
|
||||
import com.chwl.library.utils.ListUtils;
|
||||
@@ -261,12 +260,6 @@ public class InitialModel extends BaseModel implements IInitialModel {
|
||||
// 贵族配置json
|
||||
NobleDataManager.get().setOnlineConfigs(initInfo.getNobleResource());
|
||||
}
|
||||
|
||||
if (initInfo.getTax() != null) {
|
||||
//提现 税率
|
||||
WithdrawModel.get().setTaxInfo(initInfo.getTax());
|
||||
}
|
||||
|
||||
// 兑换比率
|
||||
if (initInfo.getExchangeGoldRate() != 0) {
|
||||
SharedPreferenceUtils.setExchangeGoldRate(initInfo.getExchangeGoldRate());
|
||||
|
@@ -28,8 +28,6 @@ public interface IPayModel extends IModel {
|
||||
|
||||
void setCurrentWalletInfo(WalletInfo walletInfo);
|
||||
|
||||
void requestChargeOrOrderInfo();
|
||||
|
||||
// 查询钱包的方法,需要加权限ticket
|
||||
Single<WalletInfo> getWalletInfo(long uid, String cache);
|
||||
|
||||
@@ -45,13 +43,6 @@ public interface IPayModel extends IModel {
|
||||
|
||||
Single<ChargeListResult> getChargeList(int channelType, long uid);
|
||||
|
||||
//发起充值u
|
||||
Single<JsonObject> requestCharge(Context context, String chargeProdId, String payChannel);
|
||||
|
||||
Single<Integer> requestCDKeyCharge(String code);
|
||||
|
||||
Single<WalletInfo> exchangeGold(int diamondNum, int hammerNum, String pwd);
|
||||
|
||||
/**
|
||||
* 修改支付密码时候,绑定手机时候获取手机验证码
|
||||
*
|
||||
@@ -77,36 +68,9 @@ public interface IPayModel extends IModel {
|
||||
*/
|
||||
Single<String> verifyCode(String phoneAreaCode, String mobile, String code);
|
||||
|
||||
/**
|
||||
* 修改支付密码时候,绑定手机
|
||||
*
|
||||
* @param uid
|
||||
* @param phone
|
||||
* @param code
|
||||
* @param ticket
|
||||
* @return
|
||||
*/
|
||||
Single<ServiceResult<String>> bindPhone(String uid,
|
||||
String phone,
|
||||
String code,
|
||||
String ticket);
|
||||
|
||||
Single<String> getSmsBindAli();
|
||||
|
||||
/**
|
||||
* 是否首次充值
|
||||
*/
|
||||
Single<Boolean> isFirstCharge();
|
||||
|
||||
boolean isFirstChargeSuccess();
|
||||
|
||||
void setFirstChargeSuccess(boolean firstChargeSuccess);
|
||||
|
||||
Single<String> giveGold(long toUid, String goldNum, String password);
|
||||
|
||||
Single<List<FirstChargeGoods>> getFirstChargeList();
|
||||
|
||||
Single<NewUserChargeInfo> getNewUserChargeInfo();
|
||||
|
||||
Single<String> verifyOrder(String chargeRecordId,
|
||||
String googlePlayProdId,
|
||||
@@ -115,10 +79,6 @@ public interface IPayModel extends IModel {
|
||||
|
||||
Single<PayRecordId> placeOrder(String googlePlayProdId);
|
||||
|
||||
Single<List<Banner>> loadChargeBanner();
|
||||
|
||||
Single<String> getChargeContact();
|
||||
|
||||
Single<ChargeChannelInfo> getChargeChannel();
|
||||
|
||||
}
|
||||
|
@@ -105,10 +105,6 @@ public class PayModel extends BaseModel implements IPayModel {
|
||||
}
|
||||
}
|
||||
|
||||
public void onRecieveGiftKnapMsg() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentWalletInfo(WalletInfo walletInfo) {
|
||||
this.walletInfo = walletInfo;
|
||||
@@ -147,11 +143,6 @@ public class PayModel extends BaseModel implements IPayModel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestChargeOrOrderInfo() {
|
||||
|
||||
}
|
||||
|
||||
//获取钱包信息
|
||||
@Override
|
||||
public Single<WalletInfo> getWalletInfo(long uid, String cache) {
|
||||
@@ -196,64 +187,6 @@ public class PayModel extends BaseModel implements IPayModel {
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Single<JsonObject> requestCharge(Context context, String chargeProdId, String payChannel) {
|
||||
return api.requestCharge(
|
||||
String.valueOf(AuthModel.get().getCurrentUid()),
|
||||
chargeProdId,
|
||||
String.valueOf(payChannel),
|
||||
NetworkUtils.getIPAddress(context),
|
||||
AuthModel.get().getTicket()
|
||||
)
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<Integer> requestCDKeyCharge(String code) {
|
||||
|
||||
return api.requestCDKeyCharge(
|
||||
String.valueOf(AuthModel.get().getCurrentUid()),
|
||||
code,
|
||||
AuthModel.get().getTicket()
|
||||
)
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
.flatMap(info -> {
|
||||
walletInfo = info;
|
||||
return Single.just(info.getAmount());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 钻石兑换钻石
|
||||
*
|
||||
* @param diamondNum 钻石数
|
||||
* @param hammerNum 得到的锤子数
|
||||
* @param pwd 支付密码
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<WalletInfo> exchangeGold(int diamondNum, int hammerNum, String pwd) {
|
||||
return api.changeGold(
|
||||
String.valueOf(AuthModel.get().getCurrentUid()),
|
||||
String.valueOf(diamondNum),
|
||||
String.valueOf(hammerNum),
|
||||
pwd,
|
||||
AuthModel.get().getTicket()
|
||||
)
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
.doOnSuccess(info -> {
|
||||
walletInfo = info;
|
||||
EventBus.getDefault().post(new UpdateWalletInfoEvent());
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改支付密码时候,绑定手机时候获取手机验证码
|
||||
*
|
||||
@@ -299,75 +232,6 @@ public class PayModel extends BaseModel implements IPayModel {
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改支付密码时候,绑定手机
|
||||
*
|
||||
* @param uid
|
||||
* @param phone
|
||||
* @param code
|
||||
* @param ticket
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<ServiceResult<String>> bindPhone(String uid,
|
||||
String phone,
|
||||
String code,
|
||||
String ticket) {
|
||||
return api.bindPhone(uid, DESUtils.DESAndBase64(phone), code, ticket).compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<String> getSmsBindAli() {
|
||||
return api.getSmsBindAli(String.valueOf(AuthModel.get().getCurrentUid()))
|
||||
.flatMap(new Function<ServiceResult<String>, SingleSource<String>>() {
|
||||
@Override
|
||||
public SingleSource<String> apply(ServiceResult<String> stringServiceResult) throws Exception {
|
||||
if (stringServiceResult.isSuccess()) {
|
||||
return Single.just(ResUtil.getString(R.string.xchat_android_core_pay_paymodel_02));
|
||||
} else {
|
||||
return Single.error(new Throwable(stringServiceResult.getMessage()));
|
||||
}
|
||||
}
|
||||
})
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 减少本地缓存的钻石,同时设置WalletInfo到旧版的逻辑中
|
||||
*
|
||||
* @param price -
|
||||
*/
|
||||
public void decreaseLocalGold(float price) {
|
||||
if (walletInfo != null) {
|
||||
double gold = walletInfo.getDiamondNum();
|
||||
if (walletInfo.getDiamondNum() > 0) {
|
||||
walletInfo.setDiamondNum(gold - price);
|
||||
}
|
||||
// 兼容旧版扣钱
|
||||
compatOtherWalletInfo(walletInfo);
|
||||
// 通知需要更新的地方
|
||||
IMNetEaseManager.get().getChatRoomEventObservable().onNext(
|
||||
new RoomEvent().setEvent(RoomEvent.WALLET_UPDATE)
|
||||
.setWalletInfo(walletInfo));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果本地没有钱包信息,加载网络的数据
|
||||
*
|
||||
* @return 返回本地缓存的一个钱包信息
|
||||
*/
|
||||
public Single<WalletInfo> getMyLocalWalletInfo() {
|
||||
if (walletInfo != null) {
|
||||
return Single.just(walletInfo);
|
||||
} else {
|
||||
return getMyRemoteWalletInfo();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Single<WalletInfo> getMyRemoteWalletInfo() {
|
||||
long uid = AuthModel.get().getCurrentUid();
|
||||
return getWalletInfo(uid, CACHE_STRATEGY_NO_CACHE)
|
||||
@@ -397,61 +261,17 @@ public class PayModel extends BaseModel implements IPayModel {
|
||||
setCurrentWalletInfo(walletInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否首次充值
|
||||
*/
|
||||
@Override
|
||||
public Single<Boolean> isFirstCharge() {
|
||||
return api.apiIsFirstCharge()
|
||||
.compose(RxHelper.handleCommon());
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onFirstRechargeEvent(FirstRechargeEvent event) {
|
||||
setFirstChargeSuccess(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFirstChargeSuccess() {
|
||||
return firstChargeSuccess;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFirstChargeSuccess(boolean firstChargeSuccess) {
|
||||
this.firstChargeSuccess = firstChargeSuccess;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<String> giveGold(long toUid, String goldNum, String password) {
|
||||
return api.giveGold(toUid, goldNum, password)
|
||||
.compose(RxHelper.handleStringData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取首充产品列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<List<FirstChargeGoods>> getFirstChargeList() {
|
||||
return api.getFirstChargeList()
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchAndExce());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取新用户限时首充产品列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<NewUserChargeInfo> getNewUserChargeInfo() {
|
||||
return api.getNewUserChargeInfo()
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchAndExce());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<String> verifyOrder(String chargeRecordId,
|
||||
String googlePlayProdId,
|
||||
@@ -478,14 +298,6 @@ public class PayModel extends BaseModel implements IPayModel {
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<List<Banner>> loadChargeBanner() {
|
||||
return api.getChargeBanner()
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
.map(ChargeBannerInfo::getBanners);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<String> getChargeContact() {
|
||||
return api.getChargeContact()
|
||||
@@ -493,14 +305,6 @@ public class PayModel extends BaseModel implements IPayModel {
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<ChargeChannelInfo> getChargeChannel() {
|
||||
return api.getChargeChannel()
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
|
||||
public interface Api {
|
||||
|
||||
/**
|
||||
@@ -536,48 +340,6 @@ public class PayModel extends BaseModel implements IPayModel {
|
||||
@Query("pub_uid") long pub_uid);
|
||||
|
||||
|
||||
/**
|
||||
* 发起充值
|
||||
*
|
||||
* @param uid
|
||||
* @param chargeProdId
|
||||
* @param payChannel
|
||||
* @param clientIp
|
||||
* @return
|
||||
*/
|
||||
@POST("/charge/apply")
|
||||
Single<ServiceResult<JsonObject>> requestCharge(@Query("uid") String uid,
|
||||
@Query("chargeProdId") String chargeProdId,
|
||||
@Query("payChannel") String payChannel,
|
||||
@Query("clientIp") String clientIp,
|
||||
@Query("ticket") String ticket);
|
||||
|
||||
/**
|
||||
* @param uid
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@POST("/redeemcode/use")
|
||||
Single<WalletInfoResult> requestCDKeyCharge(@Query("uid") String uid,
|
||||
@Query("code") String code,
|
||||
@Query("ticket") String ticket);
|
||||
|
||||
|
||||
/**
|
||||
* 钻石兑换
|
||||
*
|
||||
* @param uid
|
||||
* @param diamondNum
|
||||
* @return
|
||||
*/
|
||||
@POST("/change/gold")
|
||||
Single<WalletInfoResult> changeGold(@Query("uid") String uid,
|
||||
@Query("diamondNum") String diamondNum,
|
||||
@Query("keyNum") String keyNum,
|
||||
@Query("paymentPwd") String paymentPwd,
|
||||
@Query("ticket") String ticket);
|
||||
|
||||
|
||||
/**
|
||||
* 修改支付密码时候,绑定手机时候获取手机验证码
|
||||
*
|
||||
@@ -607,69 +369,6 @@ public class PayModel extends BaseModel implements IPayModel {
|
||||
@Query("mobile") String mobile,
|
||||
@Query("code") String code);
|
||||
|
||||
/**
|
||||
* 修改支付密码时候,绑定手机
|
||||
*
|
||||
* @param uid
|
||||
* @param phone
|
||||
* @param code
|
||||
* @param ticket
|
||||
* @return
|
||||
*/
|
||||
@POST("withDraw/phone")
|
||||
Single<ServiceResult<String>> bindPhone(@Query("uid") String uid,
|
||||
@Query("phone") String phone,
|
||||
@Query("code") String code,
|
||||
@Query("ticket") String ticket);
|
||||
|
||||
/**
|
||||
* 哈哈获取绑定支付宝验证码
|
||||
*
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@POST("/withDraw/verification/code")
|
||||
Single<ServiceResult<String>> getSmsBindAli(@Query("uid") String uid);
|
||||
|
||||
/**
|
||||
* 是否首次充值
|
||||
*/
|
||||
@GET("/chargeRecord/isFirstCharge")
|
||||
Single<ServiceResult<Boolean>> apiIsFirstCharge();
|
||||
|
||||
/**
|
||||
* 钻石转赠
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/user/diamond/give")
|
||||
Single<ServiceResult<String>> giveGold(@Field("toUid") long toUid,
|
||||
@Field("diamondNum") String diamondNum,
|
||||
@Field("payPwd") String payPwd);
|
||||
|
||||
/**
|
||||
* 获取首充产品列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/first/charge/list")
|
||||
Single<ServiceResult<List<FirstChargeGoods>>> getFirstChargeList();
|
||||
|
||||
/**
|
||||
* 获取新用户限时首充产品列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/first/charge/limit/list")
|
||||
Single<ServiceResult<NewUserChargeInfo>> getNewUserChargeInfo();
|
||||
|
||||
@GET("/charge/guide/channel")
|
||||
Single<ServiceResult<ChargeChannelInfo>> getChargeChannel();
|
||||
|
||||
@GET("/charge/guide/banner")
|
||||
Single<ServiceResult<ChargeBannerInfo>> getChargeBanner();
|
||||
|
||||
@GET("/charge/guide/contact")
|
||||
Single<ServiceResult<String>> getChargeContact();
|
||||
|
||||
|
@@ -1,42 +0,0 @@
|
||||
package com.chwl.core.withdraw;
|
||||
|
||||
import com.chwl.core.base.IModel;
|
||||
import com.chwl.core.initial.bean.TaxInfo;
|
||||
import com.chwl.core.withdraw.bean.ExchangerInfo;
|
||||
import com.chwl.core.withdraw.bean.WithdrawInfo;
|
||||
import com.chwl.core.withdraw.bean.WithdrwaListInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2017/7/24.
|
||||
*/
|
||||
|
||||
public interface IWithdrawModel extends IModel{
|
||||
// 获取提现列表
|
||||
Single<List<WithdrwaListInfo>> getWithdrawList();
|
||||
|
||||
// 获取提现信息
|
||||
Single<WithdrawInfo> getWithdrawUserInfo(long uid);
|
||||
|
||||
// 兑换接口,发起兑换
|
||||
Single<ExchangerInfo> requestExchange(long uid, int pid, String pwd, int accountType);
|
||||
|
||||
//获取手机验证码
|
||||
Single<String> getSmsCode(long uid, String ticket);
|
||||
|
||||
//绑定支付宝
|
||||
Single<String> binderAlipay(String aliPayAccount, String aliPayAccountName, String code);
|
||||
|
||||
//获取提现税率
|
||||
public TaxInfo getTaxInfo();
|
||||
|
||||
//设置提现税率
|
||||
public void setTaxInfo(TaxInfo taxInfo);
|
||||
|
||||
Single<String> getBindBankCardTips();
|
||||
|
||||
Single<String> bindBankCard(String bankCardNum, String bankCardName, String smsCode);
|
||||
}
|
@@ -1,276 +0,0 @@
|
||||
package com.chwl.core.withdraw;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.chwl.core.R;
|
||||
import com.chwl.core.auth.AuthModel;
|
||||
import com.chwl.core.base.BaseModel;
|
||||
import com.chwl.core.bean.response.ServiceResult;
|
||||
import com.chwl.core.bean.response.result.ExchangeInfoResult;
|
||||
import com.chwl.core.bean.response.result.WithdrawListResult;
|
||||
import com.chwl.core.bean.response.result.WithdrawUserInfoResult;
|
||||
import com.chwl.core.initial.bean.TaxInfo;
|
||||
import com.chwl.core.user.UserModel;
|
||||
import com.chwl.core.utils.APIEncryptUtil;
|
||||
import com.chwl.core.utils.net.RxHelper;
|
||||
import com.chwl.core.withdraw.bean.BindAliInfo;
|
||||
import com.chwl.core.withdraw.bean.ExchangerInfo;
|
||||
import com.chwl.core.withdraw.bean.RefreshInfo;
|
||||
import com.chwl.core.withdraw.bean.WithdrawInfo;
|
||||
import com.chwl.core.withdraw.bean.WithdrwaListInfo;
|
||||
import com.chwl.core.withdraw.event.ExchangeInfoEvent;
|
||||
import com.chwl.library.net.rxnet.RxNet;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
import com.chwl.library.utils.codec.DESUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2017/7/24.
|
||||
*/
|
||||
|
||||
public class WithdrawModel extends BaseModel implements IWithdrawModel {
|
||||
private final Api api = RxNet.create(Api.class);
|
||||
private TaxInfo taxInfo;
|
||||
|
||||
/**
|
||||
* 提现时,金额过大,需要先实名认证
|
||||
*/
|
||||
public static final int NOT_REAL_NAME_BEFORE_WITHDRAW = 10111;
|
||||
|
||||
private static final class Helper {
|
||||
public static final WithdrawModel INSTANCE = new WithdrawModel();
|
||||
}
|
||||
|
||||
public static WithdrawModel get() {
|
||||
return Helper.INSTANCE;
|
||||
}
|
||||
|
||||
|
||||
//获取提现列表
|
||||
@Override
|
||||
public Single<List<WithdrwaListInfo>> getWithdrawList() {
|
||||
return api.getWithdrawList()
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
|
||||
}
|
||||
//获取提现页用户信息
|
||||
@Override
|
||||
public Single<WithdrawInfo> getWithdrawUserInfo(long uid) {
|
||||
return api.getWithdrawInfo(
|
||||
String.valueOf(uid)
|
||||
)
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
|
||||
}
|
||||
//发起兑换
|
||||
@Override
|
||||
public Single<ExchangerInfo> requestExchange(long uid, int pid, String pwd, int accountType) {
|
||||
return api.requestExchange(
|
||||
String.valueOf(uid),
|
||||
String.valueOf(pid),
|
||||
pwd,
|
||||
accountType,
|
||||
AuthModel.get().getTicket()
|
||||
)
|
||||
.flatMap(exchangeInfoResult -> {
|
||||
if (exchangeInfoResult == null) {
|
||||
return Single.error(new Throwable());
|
||||
}
|
||||
if (exchangeInfoResult.isSuccess()) {
|
||||
return Single.just(exchangeInfoResult.getData());
|
||||
} else {
|
||||
return Single.error(new Throwable(exchangeInfoResult.getMessage()));
|
||||
}
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.doOnSuccess(new Consumer<ExchangerInfo>() {
|
||||
@Override
|
||||
public void accept(ExchangerInfo exchangerInfo) throws Exception {
|
||||
EventBus.getDefault().post(new ExchangeInfoEvent(exchangerInfo));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
//获取绑定支付宝验证码
|
||||
@Override
|
||||
public Single<String> getSmsCode(long uid, String ticket) {
|
||||
Map<String, String> paramsEncrypt = new HashMap<>();
|
||||
paramsEncrypt.put("ticket", ticket);
|
||||
paramsEncrypt.put("uid", String.valueOf(uid));
|
||||
String paramsStr = null;
|
||||
String signStr = null;
|
||||
try {
|
||||
// paramsStr = APIEncryptUtil.encryptParams(paramsEncrypt);
|
||||
signStr = APIEncryptUtil.paramsToSign(paramsEncrypt);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return api.getSms(
|
||||
paramsStr,
|
||||
signStr
|
||||
)
|
||||
.flatMap((Function<ServiceResult, SingleSource<String>>) serviceResult -> {
|
||||
String msg = serviceResult == null ? "" : serviceResult.getMessage();
|
||||
if (serviceResult != null && serviceResult.isSuccess()) {
|
||||
return Single.just(msg);
|
||||
}
|
||||
return Single.error(new Throwable(msg));
|
||||
})
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
|
||||
}
|
||||
//绑定支付宝
|
||||
@Override
|
||||
public Single<String> binderAlipay(String aliPayAccount, String aliPayAccountName, String code) {
|
||||
return api.bindAlipay(
|
||||
String.valueOf(AuthModel.get().getCurrentUid()),
|
||||
DESUtils.DESAndBase64(aliPayAccount),
|
||||
DESUtils.DESAndBase64(aliPayAccountName),
|
||||
code,
|
||||
AuthModel.get().getTicket()
|
||||
)
|
||||
.flatMap((Function<ServiceResult<BindAliInfo>, SingleSource<String>>) result -> {
|
||||
if (result != null && result.isSuccess()) {
|
||||
return Single.just(ResUtil.getString(R.string.xchat_android_core_withdraw_withdrawmodel_01));
|
||||
}
|
||||
return Single.error(new Throwable(RxHelper.getValidMessage(result)));
|
||||
})
|
||||
.doOnSuccess(new Consumer<String>() {
|
||||
@Override
|
||||
public void accept(String s) throws Exception {
|
||||
EventBus.getDefault().post(new RefreshInfo());
|
||||
}
|
||||
})
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaxInfo getTaxInfo() {
|
||||
return this.taxInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTaxInfo(TaxInfo taxInfo) {
|
||||
this.taxInfo = taxInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<String> getBindBankCardTips() {
|
||||
return api.apiBindBankCardTips()
|
||||
.compose(RxHelper.handleCommon(() -> ""));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<String> bindBankCard(String bankCardNum, String bankCardName, String smsCode) {
|
||||
return api.apiBindBankCard(bankCardNum, bankCardName, smsCode)
|
||||
.compose(RxHelper.handleIgnoreData())
|
||||
.doOnSuccess(s -> {
|
||||
EventBus.getDefault().post(new RefreshInfo());
|
||||
UserModel.get().updateCurrentUserInfo().subscribe();
|
||||
});
|
||||
}
|
||||
|
||||
interface Api{
|
||||
/**
|
||||
* 获取提现列表
|
||||
* @return
|
||||
*/
|
||||
@GET("/withDraw/findList")
|
||||
Single<WithdrawListResult> getWithdrawList();
|
||||
|
||||
|
||||
/**
|
||||
* 获取提现页用户信息
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@GET("/withDraw/exchange")
|
||||
Single<WithdrawUserInfoResult> getWithdrawInfo(@Query("uid") String uid);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 发起兑换 提现接口
|
||||
* @param uid -
|
||||
* @param pid -
|
||||
* @param ticket -
|
||||
* @param accountType 提现账号类型,1-提现到支付宝,3-提现到银行卡
|
||||
* @return
|
||||
*/
|
||||
@POST("/withDraw/v2/withDrawCash")
|
||||
Single<ExchangeInfoResult> requestExchange(@Query("uid") String uid,
|
||||
@Query("pid") String pid,
|
||||
@Query("paymentPwd") String paymentPwd,
|
||||
@Query("accountType") int accountType,
|
||||
@Query("ticket") String ticket);
|
||||
|
||||
|
||||
/**
|
||||
* 获取绑定支付宝验证码
|
||||
* @param uid
|
||||
* @param sign
|
||||
* @return
|
||||
*/
|
||||
@POST("/withDraw/getSms")
|
||||
Single<ServiceResult> getSms(@Query("params") String uid,
|
||||
@Query("sign") String sign);
|
||||
|
||||
|
||||
/**
|
||||
* 绑定支付宝
|
||||
* @param uid
|
||||
* @param aliPayAccount
|
||||
* @param aliPayAccountName
|
||||
* @param code
|
||||
* @param ticket
|
||||
* @return
|
||||
*/
|
||||
@POST("/withDraw/bound")
|
||||
Single<ServiceResult<BindAliInfo>> bindAlipay(@Query("uid") String uid,
|
||||
@Query("zxcAccount") String aliPayAccount,
|
||||
@Query("zxcAccountName") String aliPayAccountName,
|
||||
@Query("code") String code,
|
||||
@Query("ticket") String ticket);
|
||||
|
||||
/**
|
||||
* 提现提示方案
|
||||
* @return -
|
||||
*/
|
||||
@GET("/withDraw/bankCard/tips")
|
||||
Single<ServiceResult<String>> apiBindBankCardTips();
|
||||
|
||||
/**
|
||||
* 绑定提现银行卡
|
||||
* @param bankCardNum 卡号
|
||||
* @param bankCardName 名字
|
||||
* @param smsCode 验证码
|
||||
* @return -
|
||||
*/
|
||||
@POST("/withDraw/bankCard/bind")
|
||||
Single<ServiceResult<JsonElement>> apiBindBankCard(@Query("bankCardNum") String bankCardNum,
|
||||
@Query("bankCardName") String bankCardName,
|
||||
@Query("smsCode") String smsCode);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
package com.chwl.core.withdraw.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 绑定支付宝成功返回的对象
|
||||
* Created by lvzebiao on 2018/9/28.
|
||||
*/
|
||||
@Data
|
||||
public class BindAliInfo {
|
||||
/**
|
||||
* {"uid":297,"hasRegPacket":false,"zxcAccount":"123","zxcAccountName":"007"}
|
||||
*/
|
||||
private long uid;
|
||||
private boolean hasRegPacket;
|
||||
private String zxcAccount;
|
||||
private String zxcAccountName;
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
package com.chwl.core.withdraw.bean;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2017/7/26.
|
||||
*/
|
||||
|
||||
public class RefreshInfo {
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
package com.chwl.core.withdraw.event;
|
||||
|
||||
import com.chwl.core.base.BaseDataEvent;
|
||||
import com.chwl.core.withdraw.bean.ExchangerInfo;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/9/17.
|
||||
*/
|
||||
|
||||
public class ExchangeInfoEvent extends BaseDataEvent<ExchangerInfo> {
|
||||
public ExchangeInfoEvent(ExchangerInfo data) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public ExchangeInfoEvent(String error) {
|
||||
super(error);
|
||||
}
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
package com.chwl.core.withdraw.event;
|
||||
|
||||
import com.chwl.core.base.BaseDataEvent;
|
||||
import com.chwl.core.withdraw.bean.WithdrawInfo;
|
||||
|
||||
/**
|
||||
* create by lvzebiao on 2018/9/8
|
||||
*/
|
||||
public class WithdrawInfoEvent extends BaseDataEvent<WithdrawInfo> {
|
||||
public WithdrawInfoEvent(WithdrawInfo data) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
public WithdrawInfoEvent(String error) {
|
||||
super(error);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user