优化
This commit is contained in:
@ -109,7 +109,9 @@ public class PayNotifyController {
|
||||
String re = notifyRedisTemplate.opsForValue().get("ADD" + notify.getOutTradeNo());
|
||||
if(StringUtils.isNotBlank(re)){
|
||||
log.info("开始进行余额增加,获取的金额:"+re);
|
||||
cardApi.recharge(new BigDecimal(re));
|
||||
int index = re.indexOf("-");
|
||||
String userId = re.substring(index + 1);
|
||||
cardApi.recharge(new BigDecimal(re.substring(0,index)),Long.valueOf(userId));
|
||||
notifyRedisTemplate.delete("ADD" + notify.getOutTradeNo());
|
||||
}
|
||||
return "success";
|
||||
|
@ -50,6 +50,7 @@ import java.util.Objects;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
|
||||
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
@ -174,7 +175,8 @@ public class PayOrderServiceImpl implements PayOrderService {
|
||||
// 订单相关字段
|
||||
.setPrice(order.getPrice()).setExpireTime(order.getExpireTime());
|
||||
PayOrderRespDTO unifiedOrderResp = client.unifiedOrder(unifiedOrderReqDTO);
|
||||
payRedis.opsForValue().set("ADD"+unifiedOrderReqDTO.getOutTradeNo(),unifiedOrderReqDTO.getPrice().toString());
|
||||
payRedis.opsForValue().set("ADD"+unifiedOrderReqDTO.getOutTradeNo()
|
||||
,unifiedOrderReqDTO.getPrice().toString()+"-"+getLoginUserId());
|
||||
log.info("REDISID:"+"ADD"+unifiedOrderReqDTO.getOutTradeNo()+" 总金额:"+unifiedOrderReqDTO.getPrice().toString());
|
||||
// 4. 如果调用直接支付成功,则直接更新支付单状态为成功。例如说:付款码支付,免密支付时,就直接验证支付成功
|
||||
if (unifiedOrderResp != null) {
|
||||
|
Reference in New Issue
Block a user