优化返回值

This commit is contained in:
renhaoting 2026-01-13 13:45:03 +08:00
parent 04b35f09a0
commit 577527472a
3 changed files with 9 additions and 6 deletions

View File

@ -110,10 +110,11 @@ class ZeroManager private constructor() {
}
}
fun getZeroWithdrawItem(zeroItem: ZeroBuyItem): WinZeroWithdrawInfoItem {
fun getZeroWithdrawItem(zeroItem: ZeroBuyItem): WinZeroWithdrawInfoItem? {
try {
mRecordLocker.lock()
return mRecordList.filter { zeroItem.id == it.purchase_id }[0]
val matchedList = mRecordList.filter { zeroItem.id == it.purchase_id }
return if (matchedList.isNotEmpty()) matchedList[0] else null
} finally {
mRecordLocker.unlock()
}
@ -273,7 +274,7 @@ class ZeroManager private constructor() {
fun startWithdrawProcess(activity: Activity, item: ZeroBuyItem) {
val zeroWithdrawInfoItem = getZeroWithdrawItem(item)
if (couldStartWithdraw(item)) {
if (zeroWithdrawInfoItem != null && couldStartWithdraw(item)) {
val onConfirmed: (cashNum: Double)->Unit = {
requestZeroWithdrawReward(zeroWithdrawInfoItem)
}
@ -284,7 +285,7 @@ class ZeroManager private constructor() {
WithdrawBindBankDialog(activity = activity, onConfirmed).setWithDrawCashNumStr(zeroWithdrawInfoItem.winCashNumStr!!).show()
}
} else {
when (zeroWithdrawInfoItem.withdrawState) {
when (zeroWithdrawInfoItem?.withdrawState) {
TRANSACTION_STATE_ONGOING -> {
AndroidUtil.showToast(R.string.claim_reward_onging)
}

View File

@ -51,6 +51,8 @@
<string name="zero_win_state_failed">Failed</string>
<string name="zero_win_state_withdrarw_success">Paid</string>
<string name="no_data_hint">There\'s no any data</string>
<string name="claim_reward_onging">This purchase reward claim is ongoing.</string>
<string name="has_claimed_reward">You have claimed this reward.</string>
<string name="benefit_task_top_hint">Finish all tasks to earn!</string>

View File

@ -218,8 +218,8 @@
<string name="recompensa">Recompensa!</string>
<string name="net_error">Erro de rede</string>
<string name="claim_reward_onging">This purchase reward claim is ongoing.</string>
<string name="has_claimed_reward">You have claimed this reward.</string>
<string name="claim_reward_onging">Recompensa em recepção</string>
<string name="has_claimed_reward">Já receberam recompensas</string>
<string name="game_center">Game Center</string>
<string name="withdraw_fail_not_reach_condition">Not reach withdraw condition</string>
<string name="withdraw_fail_already_withdraw">You\'ve already withdrawed</string>