钱包通知字段更新

This commit is contained in:
huangjian
2020-05-11 18:51:53 +08:00
parent 0ebcc679dd
commit ed0ddf04c1
4 changed files with 41 additions and 19 deletions

View File

@@ -178,7 +178,7 @@ public class TreasureBoxHonourActivity extends BaseBindingActivity<ActivityTreas
}
mBinding.svgaOpen.startAnimation();
BoxModel.get()
.openBox(boxType, count, false)
.openBox(boxType, count, true)
.compose(bindToLifecycle())
.doOnError(throwable -> {
mBinding.ivOpen.setEnabled(true);

View File

@@ -4,7 +4,6 @@ import android.content.Context;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject;
import com.netease.nim.uikit.common.util.log.LogUtil;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.auth.event.LoginEvent;
import com.yizhuan.xchat_android_core.base.BaseModel;
@@ -22,6 +21,7 @@ import com.yizhuan.xchat_android_core.pay.event.GetWalletInfoEvent;
import com.yizhuan.xchat_android_core.pay.event.UpdateWalletInfoEvent;
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
import com.yizhuan.xchat_android_library.utils.LogUtil;
import com.yizhuan.xchat_android_library.utils.NetworkUtils;
import org.greenrobot.eventbus.EventBus;
@@ -90,7 +90,7 @@ public class PayModel extends BaseModel implements IPayModel {
}
}
public void onRecieveGiftKnapMsg(){
public void onRecieveGiftKnapMsg() {
}
@@ -109,14 +109,17 @@ public class PayModel extends BaseModel implements IPayModel {
JSONObject attachment = event.getAttachment();
int headType = attachment.getIntValue("first");
int subType = attachment.getIntValue("second");
LogUtil.print(attachment.toJSONString());
if (headType > 0 && subType > 0) {
if (headType == CUSTOM_MSG_HEADER_TYPE_ACCOUNT) {
JSONObject jsonObject = (JSONObject) attachment.get("data");
if (jsonObject == null) return;
WalletInfo walletInfo = new WalletInfo();
walletInfo.setUid(jsonObject.getLong("uid"));
walletInfo.setDepositNum(jsonObject.getIntValue("depositNum"));
walletInfo.setDiamondNum(jsonObject.getLong("diamondNum"));
walletInfo.setGoldNum(jsonObject.getIntValue("goldNum"));
walletInfo.setDiamondNum(jsonObject.getLong("diamonds"));
walletInfo.setGoldNum(jsonObject.getIntValue("golds"));
walletInfo.setCrystals(jsonObject.getDoubleValue("crystals"));
walletInfo.nobleGoldNum = jsonObject.getDoubleValue("nobleGoldNum");
walletInfo.chargeGoldNum = jsonObject.getDoubleValue("chargeGoldNum");
this.walletInfo = walletInfo;
@@ -166,7 +169,6 @@ public class PayModel extends BaseModel implements IPayModel {
}
@Override
public Single<JsonObject> requestCharge(Context context, String chargeProdId, String payChannel) {
return api.requestCharge(
@@ -199,9 +201,10 @@ public class PayModel extends BaseModel implements IPayModel {
/**
* 钻石兑换钻石
*
* @param diamondNum 钻石数
* @param hammerNum 得到的锤子数
* @param pwd 支付密码
* @param hammerNum 得到的锤子数
* @param pwd 支付密码
* @return
*/
@Override
@@ -225,6 +228,7 @@ public class PayModel extends BaseModel implements IPayModel {
/**
* 修改支付密码时候,绑定手机时候获取手机验证码
*
* @param mobile
* @param checkExists
* @param uid
@@ -237,7 +241,7 @@ public class PayModel extends BaseModel implements IPayModel {
boolean checkExists,
long uid,
String ticket,
String type){
String type) {
return api.getCode(mobile, checkExists, uid, ticket, type)
.compose(RxHelper.handleSchedulers());
}
@@ -245,20 +249,21 @@ public class PayModel extends BaseModel implements IPayModel {
/**
* 修改支付密码时候,发送到后台验证手机号与手机验证码是否匹配
*
* @param mobile
* @param code
* @return
*/
@Override
public Single<String> verifyCode(String mobile,
String code){
String code) {
return api.verifyCode(mobile, code)
.flatMap(new Function<ServiceResult<String>, SingleSource<String>>() {
@Override
public SingleSource<String> apply(ServiceResult<String> stringServiceResult) throws Exception {
if (stringServiceResult.isSuccess()) {
return Single.just("成功");
}else {
} else {
return Single.error(new Throwable(stringServiceResult.getMessage()));
}
}
@@ -269,6 +274,7 @@ public class PayModel extends BaseModel implements IPayModel {
/**
* 修改支付密码时候,绑定手机
*
* @param uid
* @param phone
* @param code
@@ -279,7 +285,7 @@ public class PayModel extends BaseModel implements IPayModel {
public Single<ServiceResult<String>> bindPhone(String uid,
String phone,
String code,
String ticket){
String ticket) {
return api.bindPhone(uid, phone, code, ticket).compose(RxHelper.handleSchedulers());
}
@@ -291,7 +297,7 @@ public class PayModel extends BaseModel implements IPayModel {
public SingleSource<String> apply(ServiceResult<String> stringServiceResult) throws Exception {
if (stringServiceResult.isSuccess()) {
return Single.just("成功");
}else {
} else {
return Single.error(new Throwable(stringServiceResult.getMessage()));
}
}
@@ -400,10 +406,9 @@ public class PayModel extends BaseModel implements IPayModel {
* 获取钱包
*
* @param uid
* @param cacheStrategy
* 取值:
* {@link #CACHE_STRATEGY_NO_CACHE}: 强制刷新缓存
* {@link #CACHE_STRATEGY_MAX_STALE} :直接从缓存里取出来
* @param cacheStrategy 取值:
* {@link #CACHE_STRATEGY_NO_CACHE}: 强制刷新缓存
* {@link #CACHE_STRATEGY_MAX_STALE} :直接从缓存里取出来
* @return
*/
@GET("/purse/query")

View File

@@ -12,7 +12,9 @@ import android.os.Parcelable;
public class WalletInfo implements Parcelable {
public long uid;
/** 总钻石(贵族+普通)数量 */
/** /**
* 金币,暂时没用到 用的地方H5的
*/
public double golds;
/** 钻石数量 */
public double diamonds;
@@ -27,8 +29,12 @@ public class WalletInfo implements Parcelable {
* true 显示钻石转赠 false 隐藏钻石转赠
*/
private boolean sendGold;
/**
* 水晶,暂时没用到 用的地方H5的
*/
private double crystals;
public WalletInfo() {
public WalletInfo() {
}
@@ -129,4 +135,12 @@ public class WalletInfo implements Parcelable {
public void setSendGold(boolean sendGold) {
this.sendGold = sendGold;
}
public double isCrystals() {
return crystals;
}
public void setCrystals(double crystals) {
this.crystals = crystals;
}
}

View File

@@ -14,8 +14,10 @@ import com.yizhuan.xchat_android_core.pay.bean.NotRealNameYetException;
import com.yizhuan.xchat_android_core.pay.bean.PmChargeLimitException;
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
import com.yizhuan.xchat_android_library.utils.LogUtil;
import com.yizhuan.xchat_android_library.utils.NetworkUtils;
import java.util.Arrays;
import java.util.Map;
import io.reactivex.Single;
@@ -62,6 +64,7 @@ public class AliPayModel extends BaseModel implements IAliPayModel {
// 收到订单号之后,发起支付
PayTask alipay = new PayTask(context);
Map<String, String> result = alipay.payV2(data, true);
//LogUtil.print(Arrays.toString(result.entrySet().toArray()));
return Single.just(result);
} else {
if (jsonObjectServiceResult.getCode() == PayModel.NOT_REAL_NAME_BEFORE_CHARGING) {