refactor(mcwl-pay): 调整支付宝提现逻辑和异常处理

master
yang 2025-02-13 17:55:51 +08:00
parent f9f7361a16
commit 295316619c
1 changed files with 7 additions and 6 deletions

View File

@ -319,6 +319,9 @@ public class AliPayServiceImpl implements AliPayService {
return R.fail("请先绑定支付宝账号"); return R.fail("请先绑定支付宝账号");
} }
// 添加提现记录和修改用户钱包
this.addLogAndUpdateUserWallet(sysUser, amount);
// 收款方信息 // 收款方信息
Participant payeeInfo = new Participant(); Participant payeeInfo = new Participant();
@ -338,9 +341,7 @@ public class AliPayServiceImpl implements AliPayService {
System.out.println(response.getBody()); System.out.println(response.getBody());
if (response.isSuccess()) { if (response.isSuccess()) {
// 记录日志和修改用户钱包 return R.ok("提现成功");
this.addLogAndUpdateUserWallet(sysUser, amount);
return R.ok("转账成功");
} }
if (response.getSubCode().equals("PAYER_BALANCE_NOT_ENOUGH")) { if (response.getSubCode().equals("PAYER_BALANCE_NOT_ENOUGH")) {
@ -349,10 +350,10 @@ public class AliPayServiceImpl implements AliPayService {
String content = String.format("账户余额不足:用户%s提现%s", sysUser.getUserName(), amount); String content = String.format("账户余额不足:用户%s提现%s", sysUser.getUserName(), amount);
MailUtil.send(tos, "上海辰风互娱", content, false); MailUtil.send(tos, "上海辰风互娱", content, false);
throw new ServiceException("系统繁忙,请稍后重试"); throw new ServiceException("网络连接出错,请稍后再试");
} }
System.out.println("提现失败:" + response.getSubMsg());
throw new ServiceException("转账失败:" + response.getSubMsg()); throw new ServiceException("提现失败");
} }
@Override @Override