金额为0继续处理

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

View File

@ -152,15 +152,24 @@ public class YomiGameServiceImpl implements YomiGameService {
return new YomiBalanceCO(balanceResp.getBody().getDollarAmount().longValue());
}
WalletReceiptResDTO res = walletGoldClient.changeBalance(
gameEventService.buildReceipt(cmd.getPlatToken(), userId, cmd.getReasonType(),
GoldOrigin.YOMI_GAME, gameIdStr,
String.valueOf(cmd.getGameRoundId()), cmd.getGold())
).getBody();
if (res == null || res.getBalance() == null) {
throw new Exception("wallet changeBalance failed, response is null");
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(
gameEventService.buildReceipt(cmd.getPlatToken(), userId, cmd.getReasonType(),
GoldOrigin.YOMI_GAME, gameIdStr,
String.valueOf(cmd.getGameRoundId()), cmd.getGold())
).getBody();
if (res == null || res.getBalance() == null) {
throw new Exception("wallet changeBalance failed, response is null");
}
currentBalance = res.getBalance().getDollarAmount().longValue();
}
long currentBalance = res.getBalance().getDollarAmount().longValue();
gameEventService.markProcessed(idempotentKey, IDEMPOTENT_EXPIRE_SECONDS);