From 6d4d3308b8bf0ef28b7bec4433ea07f50dd9c4ec Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Fri, 29 May 2026 15:40:12 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=91=E9=A2=9D=E4=B8=BA0=E7=BB=A7=E7=BB=AD?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/service/game/YomiGameServiceImpl.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) 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);