fix yomi idempotent null check and extend ttl
This commit is contained in:
parent
71b2157b5b
commit
515bf651f4
@ -59,7 +59,7 @@ import java.util.concurrent.TimeUnit;
|
||||
public class YomiGameServiceImpl implements YomiGameService {
|
||||
|
||||
private static final String IDEMPOTENT_KEY_PREFIX = "yomi:change_balance:req:";
|
||||
private static final long IDEMPOTENT_EXPIRE_SECONDS = 300L;
|
||||
private static final long IDEMPOTENT_EXPIRE_SECONDS = 600L;
|
||||
|
||||
private final YomiConfig yomiConfig;
|
||||
private final RedisTemplate<String, String> redisTemplate;
|
||||
@ -153,8 +153,12 @@ public class YomiGameServiceImpl implements YomiGameService {
|
||||
String processed = redisTemplate.opsForValue().get(idempotentKey);
|
||||
if (processed != null) {
|
||||
log.info("yomi余额变动重复请求,直接返回: requestId={}", cmd.getRequestId());
|
||||
long currentBalance = walletGoldClient.getBalance(userId).getBody().getDollarAmount().longValue();
|
||||
return new YomiBalanceCO(currentBalance);
|
||||
ResultResponse<PennyAmount> balanceResp = walletGoldClient.getBalance(userId);
|
||||
if (balanceResp == null || balanceResp.getBody() == null) {
|
||||
log.warn("yomi幂等返回时查询余额失败: platUserId={}", userId);
|
||||
return new YomiBalanceCO(0L);
|
||||
}
|
||||
return new YomiBalanceCO(balanceResp.getBody().getDollarAmount().longValue());
|
||||
}
|
||||
|
||||
WalletReceiptResDTO res = walletGoldClient.changeBalance(createReceipt(cmd)).getBody();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user