fix yomi null check for wallet response

This commit is contained in:
tianfeng 2026-05-26 18:39:58 +08:00
parent 515bf651f4
commit 03a276d022

View File

@ -91,6 +91,9 @@ public class YomiGameServiceImpl implements YomiGameService {
throw new RuntimeException("用户信息不存在");
}
ResultResponse<PennyAmount> 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<PennyAmount> 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();
// 执行成功后写入幂等标记