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 2d0ba4fd..5fcb81c8 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 @@ -91,6 +91,9 @@ public class YomiGameServiceImpl implements YomiGameService { throw new RuntimeException("用户信息不存在"); } ResultResponse balanceResp = walletGoldClient.getBalance(userId); + if (balanceResp == null || balanceResp.getBody() == null) { + throw new RuntimeException("查询用户余额失败"); + } String token = credResp.getBody().token(); long expireAt = System.currentTimeMillis() / 1000 + yomiConfig.getTokenExpireSeconds(); @@ -124,6 +127,9 @@ public class YomiGameServiceImpl implements YomiGameService { throw new Exception("用户信息不存在"); } ResultResponse response = walletGoldClient.getBalance(userId); + if (response == null || response.getBody() == null) { + throw new Exception("查询用户余额失败"); + } return YomiUserInfoCO.builder() .platUserId(cmd.getPlatUserId()) .platUserOpenId("") // 项目暂无 openId 概念,按协议传空 @@ -162,6 +168,9 @@ public class YomiGameServiceImpl implements YomiGameService { } WalletReceiptResDTO res = walletGoldClient.changeBalance(createReceipt(cmd)).getBody(); + if (res == null || res.getBalance() == null) { + throw new Exception("wallet changeBalance failed, response is null"); + } long currentBalance = res.getBalance().getDollarAmount().longValue(); // 执行成功后写入幂等标记