金额为0继续处理

This commit is contained in:
tianfeng 2026-05-29 15:40:12 +08:00
parent fb54999074
commit 6d4d3308b8

View File

@ -152,6 +152,14 @@ public class YomiGameServiceImpl implements YomiGameService {
return new YomiBalanceCO(balanceResp.getBody().getDollarAmount().longValue()); return new YomiBalanceCO(balanceResp.getBody().getDollarAmount().longValue());
} }
long currentBalance;
if (cmd.getGold() == 0) {
ResultResponse<PennyAmount> balanceResp = walletGoldClient.getBalance(userId);
if (balanceResp == null || balanceResp.getBody() == null) {
throw new Exception("wallet getBalance failed, response is null");
}
currentBalance = balanceResp.getBody().getDollarAmount().longValue();
} else {
WalletReceiptResDTO res = walletGoldClient.changeBalance( WalletReceiptResDTO res = walletGoldClient.changeBalance(
gameEventService.buildReceipt(cmd.getPlatToken(), userId, cmd.getReasonType(), gameEventService.buildReceipt(cmd.getPlatToken(), userId, cmd.getReasonType(),
GoldOrigin.YOMI_GAME, gameIdStr, GoldOrigin.YOMI_GAME, gameIdStr,
@ -160,7 +168,8 @@ public class YomiGameServiceImpl implements YomiGameService {
if (res == null || res.getBalance() == null) { if (res == null || res.getBalance() == null) {
throw new Exception("wallet changeBalance failed, response is null"); throw new Exception("wallet changeBalance failed, response is null");
} }
long currentBalance = res.getBalance().getDollarAmount().longValue(); currentBalance = res.getBalance().getDollarAmount().longValue();
}
gameEventService.markProcessed(idempotentKey, IDEMPOTENT_EXPIRE_SECONDS); gameEventService.markProcessed(idempotentKey, IDEMPOTENT_EXPIRE_SECONDS);