fix: 修复可能因为 网络问题拿不到钱包信息 导致的崩溃

This commit is contained in:
eggmanQQQ
2024-12-09 11:15:25 +08:00
parent cc1a494102
commit 52dd32c138
2 changed files with 5 additions and 15 deletions

View File

@@ -35,7 +35,7 @@ class CoinTipsView : FrameLayout {
private fun initView(context: Context) {
mRootViewBinding = ViewCoinTipsBinding.inflate(LayoutInflater.from(context),this,true)
mCoin = PayModel.get().currentWalletInfo?.diamondNum?.toInt()?:0
mCoin = (PayModel.get().currentWalletInfo?.diamondNum ?: 0.0).toInt()
mRootViewBinding.price.text = mCoin?.toString()?:""
}
@@ -120,7 +120,7 @@ class CoinTipsView : FrameLayout {
* number != null ,表示 接收中奖消息, 这时展示增加
*/
private fun setCoinText(number: String?,isAdd: Boolean) : String? {
val newCoin = PayModel.get().currentWalletInfo?.diamondNum?.toInt()?:0
val newCoin = (PayModel.get().currentWalletInfo?.diamondNum ?: 0.0).toInt()
val oldCoin = if (mCoin != null ) mCoin else newCoin
val num = newCoin - oldCoin!!

View File

@@ -2,25 +2,16 @@ package com.chwl.core.pay;
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_ACCOUNT;
import android.content.Context;
import com.alibaba.fastjson.JSONObject;
import com.chwl.core.pay.bean.ChargeBean;
import com.google.gson.JsonObject;
import com.chwl.core.XConstants;
import com.chwl.core.R;
import com.chwl.core.XConstants;
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.ChargeListResult;
import com.chwl.core.bean.response.result.WalletInfoResult;
import com.chwl.core.manager.IMNetEaseManager;
import com.chwl.core.manager.RoomEvent;
import com.chwl.core.pay.bean.Banner;
import com.chwl.core.pay.bean.ChargeBannerInfo;
import com.chwl.core.pay.bean.ChargeChannelInfo;
import com.chwl.core.pay.bean.FirstChargeGoods;
import com.chwl.core.pay.bean.NewUserChargeInfo;
import com.chwl.core.pay.bean.ChargeBean;
import com.chwl.core.pay.bean.PayRecordId;
import com.chwl.core.pay.bean.WalletInfo;
import com.chwl.core.pay.event.ChargeCustomNotificationEvent;
@@ -31,7 +22,6 @@ import com.chwl.core.user.event.LoginUserInfoUpdateEvent;
import com.chwl.core.utils.net.IgnoreException;
import com.chwl.core.utils.net.RxHelper;
import com.chwl.library.net.rxnet.RxNet;
import com.chwl.library.utils.NetworkUtils;
import com.chwl.library.utils.ResUtil;
import com.chwl.library.utils.codec.DESUtils;
@@ -72,7 +62,7 @@ public class PayModel extends BaseModel implements IPayModel {
*/
public static final int RECHARGE_LIMIT = 50000;
protected WalletInfo walletInfo;
protected WalletInfo walletInfo = new WalletInfo();
private boolean firstChargeSuccess = false;