同步PIKO:完成送礼可用金币+钻石功能
This commit is contained in:
@@ -11,6 +11,7 @@ import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chwl.core.pay.event.UpdateWalletInfoEvent;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum;
|
||||
@@ -390,7 +391,12 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
//应通过id去确定要需要更新的礼物背包
|
||||
EventBus.getDefault().post(new UpdateKnapEvent(giftId, finalGiftNum * targetUids.size()));
|
||||
} else {
|
||||
PayModel.get().minusGold(giftInfo.getGoldPrice() * finalGiftNum * targetUids.size());
|
||||
if (serviceResult.getData() != null && serviceResult.getData().getUserPurse() != null) {
|
||||
PayModel.get().setWalletInfo(serviceResult.getData().getUserPurse());
|
||||
EventBus.getDefault().post(new UpdateWalletInfoEvent());
|
||||
} else {
|
||||
PayModel.get().refreshWalletInfo(true);
|
||||
}
|
||||
}
|
||||
GiftMultiReceiverInfo giftMultiReceiverInfo = serviceResult.getData();
|
||||
if (giftId != giftMultiReceiverInfo.getGiftId()) {
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.chwl.core.gift.bean;
|
||||
|
||||
import com.chwl.core.pay.bean.WalletInfo;
|
||||
import com.chwl.core.room.giftvalue.bean.IndexGiftValue;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -26,4 +27,5 @@ public class GiftMultiReceiverInfo implements Serializable {
|
||||
private List<LuckyBagGifts> luckyBagGifts;
|
||||
private List<Long> targetUids;
|
||||
private LuckyGiftList luckyGiftList;
|
||||
private WalletInfo userPurse;
|
||||
}
|
||||
|
@@ -23,6 +23,8 @@ import io.reactivex.Single;
|
||||
*/
|
||||
|
||||
public interface IPayModel extends IModel {
|
||||
void refreshWalletInfo(boolean isNotice);
|
||||
|
||||
WalletInfo getCurrentWalletInfo();
|
||||
|
||||
void minusGold(float price);
|
||||
|
@@ -90,6 +90,15 @@ public class PayModel extends BaseModel implements IPayModel {
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshWalletInfo(boolean isNotice) {
|
||||
getMyRemoteWalletInfo().subscribe(info -> {
|
||||
if (isNotice) {
|
||||
EventBus.getDefault().post(new UpdateWalletInfoEvent());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public WalletInfo getCurrentWalletInfo() {
|
||||
return walletInfo;
|
||||
@@ -134,6 +143,9 @@ public class PayModel extends BaseModel implements IPayModel {
|
||||
walletInfo.setCrystals(jsonObject.getDoubleValue("crystals"));
|
||||
walletInfo.nobleGoldNum = jsonObject.getDoubleValue("nobleGoldNum");
|
||||
walletInfo.chargeGoldNum = jsonObject.getDoubleValue("chargeGoldNum");
|
||||
if (jsonObject.containsKey("canGoldSendGift")) {
|
||||
walletInfo.canGoldSendGift = jsonObject.getBoolean("canGoldSendGift");
|
||||
}
|
||||
this.walletInfo = walletInfo;
|
||||
// 兼容新版
|
||||
setWalletInfo(walletInfo);
|
||||
|
@@ -38,6 +38,10 @@ public class WalletInfo implements Parcelable {
|
||||
private double canGiveGoldNum;
|
||||
/** 1:默认line,2:默认facebook */
|
||||
private int defaultPay;
|
||||
/**
|
||||
* 是否可以在送礼时合并使用金币
|
||||
*/
|
||||
public boolean canGoldSendGift;
|
||||
|
||||
public WalletInfo() {
|
||||
}
|
||||
@@ -53,6 +57,7 @@ public class WalletInfo implements Parcelable {
|
||||
nobleGoldNum = in.readDouble();
|
||||
canGiveGoldNum = in.readDouble();
|
||||
defaultPay = in.readInt();
|
||||
canGoldSendGift = in.readInt() == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,6 +71,7 @@ public class WalletInfo implements Parcelable {
|
||||
dest.writeDouble(nobleGoldNum);
|
||||
dest.writeDouble(canGiveGoldNum);
|
||||
dest.writeInt(defaultPay);
|
||||
dest.writeInt(canGoldSendGift ? 1 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user