This commit is contained in:
2026-01-12 19:02:42 +08:00
parent adb678435e
commit 668b3f65e3
2 changed files with 8 additions and 3 deletions

View File

@@ -153,8 +153,13 @@ func (l *ApplyWithdrawalLogic) ApplyWithdrawal(req *types.ApplyWithdrawalReq) (r
return nil, errors.Wrapf(err, "计算税费失败")
}
// 10. 生成提现单号
withdrawNo := fmt.Sprintf("WD%d%s", time.Now().Unix(), agent.Id)
// 10. 生成提现单号WD开头 + GenerateOutTradeNo生成的订单号确保总长度不超过32个字符
orderNo := l.svcCtx.AlipayService.GenerateOutTradeNo()
withdrawNo := "WD" + orderNo
// 确保总长度不超过32个字符
if len(withdrawNo) > 32 {
withdrawNo = withdrawNo[:32]
}
// 11. 使用事务处理提现申请
var withdrawalId string

View File

@@ -230,7 +230,7 @@ func (a *AliPayService) AliTransfer(
// ALIPAY_USER_ID/ALIPAY_LOGON_ID
},
}
logx.Infof("支付宝转账请求,请求数据: %+v", req)
// 执行转账请求
transferRsp, err := a.AlipayClient.FundTransUniTransfer(ctx, req)
logx.Infof("支付宝转账请求,响应数据: %+v", transferRsp)