fix(mcwl-pay): 修复支付宝提现功能
parent
196ba38b15
commit
ccd4372a68
|
@ -286,7 +286,16 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public R<String> fetch(String amount) throws AlipayApiException, FileNotFoundException {
|
public R<String> fetch(String amount) throws AlipayApiException, FileNotFoundException {
|
||||||
|
String lock = redisCache.getCacheObject("alipay:fetch:user:" + SecurityUtils.getUserId());
|
||||||
|
if (!StrUtil.isEmpty(lock)) {
|
||||||
|
return R.fail(HttpStatus.SHOW_ERROR_MSG, "请勿频繁点击");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
redisCache.setCacheObject("alipay:fetch:user:" + SecurityUtils.getUserId(), "1");
|
||||||
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
|
||||||
|
|
||||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||||
if (sysUser.getWallet() < Double.parseDouble(amount)) {
|
if (sysUser.getWallet() < Double.parseDouble(amount)) {
|
||||||
return R.fail(HttpStatus.SHOW_ERROR_MSG, "钱包余额不足");
|
return R.fail(HttpStatus.SHOW_ERROR_MSG, "钱包余额不足");
|
||||||
|
@ -354,6 +363,10 @@ public class AliPayServiceImpl implements AliPayService {
|
||||||
}
|
}
|
||||||
System.out.println("用户" + SecurityUtils.getLoginUser().getUser().getNickName() + "提现失败:" + response.getSubMsg());
|
System.out.println("用户" + SecurityUtils.getLoginUser().getUser().getNickName() + "提现失败:" + response.getSubMsg());
|
||||||
throw new ServiceException("提现失败", HttpStatus.SHOW_ERROR_MSG);
|
throw new ServiceException("提现失败", HttpStatus.SHOW_ERROR_MSG);
|
||||||
|
} finally {
|
||||||
|
redisCache.deleteObject("alipay:fetch:user:" + SecurityUtils.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -123,8 +123,8 @@ public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTr
|
||||||
CommissionRatio commissionRatio2 = commissionRatioService.lambdaQuery()
|
CommissionRatio commissionRatio2 = commissionRatioService.lambdaQuery()
|
||||||
.eq(CommissionRatio::getType, 1)
|
.eq(CommissionRatio::getType, 1)
|
||||||
.one();
|
.one();
|
||||||
redisCache.setCacheObject(CommissionRationEnum.COMMISSION_RATION_INVITER_USER.getName(), commissionRatio1);
|
redisCache.setCacheObject(CommissionRationEnum.COMMISSION_RATION_INVITER_USER.getName(), commissionRatio1.getRatio().toString());
|
||||||
redisCache.setCacheObject(CommissionRationEnum.COMMISSION_RATION_MERCHANT.getName(), commissionRatio2);
|
redisCache.setCacheObject(CommissionRationEnum.COMMISSION_RATION_MERCHANT.getName(), commissionRatio2.getRatio().toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue