diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/YomiGameServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/YomiGameServiceImpl.java index 79582aad..03b1ffdc 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/YomiGameServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/YomiGameServiceImpl.java @@ -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 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);