This commit is contained in:
邹宗楠
2022-07-12 14:29:46 +08:00
parent c262cdf644
commit 9ecc91077b
2 changed files with 9 additions and 7 deletions

View File

@@ -58,10 +58,11 @@ func AddUserWithdrawal(ctx *jxcontext.Context, param *model.AddWithdrawalRecordR
}
// 发起支付
if err := SendPayInfo2Ali(payOrder, param); err != nil {
alipayOrder, err := SendPayInfo2Ali(payOrder, param)
if err != nil {
return err
}
if err := UpdateUserMoney(payOrder, userBill); err != nil {
if err := UpdateUserMoney(alipayOrder, userBill); err != nil {
return err
}
@@ -216,7 +217,7 @@ func ManagerExamineWithdrawal(userId, orderId string, examineStatus int, phone,
}
// 发起支付
if err := SendPayInfo2Ali(order, &model.AddWithdrawalRecordReq{
alipayOrder, err := SendPayInfo2Ali(order, &model.AddWithdrawalRecordReq{
WithdrawalMoney: order.PayMoney,
AlipayAccount: order.AlipayAccount,
AlipayName: order.AlipayName,
@@ -224,10 +225,11 @@ func ManagerExamineWithdrawal(userId, orderId string, examineStatus int, phone,
Lat: order.Lat,
CityCode: order.CityCode,
DistrictCode: order.DistrictCode,
}); err != nil {
})
if err != nil {
return err
}
if err := UpdateUserMoney(order, userBill); err != nil {
if err := UpdateUserMoney(alipayOrder, userBill); err != nil {
return err
}
return nil

View File

@@ -9,7 +9,7 @@ import (
)
// SendPayInfo2Ali 发起支付
func SendPayInfo2Ali(payOrder *model.WithdrawalRecord, param *model.AddWithdrawalRecordReq) error {
func SendPayInfo2Ali(payOrder *model.WithdrawalRecord, param *model.AddWithdrawalRecordReq) (*model.WithdrawalRecord, error) {
if payOrder.WithdrawalMoney <= alipayapi.MinWithdrawalMoney {
aliResult, err := api.AliPayAPI.Withdrawal4AliPay(&alipayapi.WithdrawalParam{
OutBizNo: payOrder.OrderID,
@@ -30,7 +30,7 @@ func SendPayInfo2Ali(payOrder *model.WithdrawalRecord, param *model.AddWithdrawa
payOrder.PayTime = utils.Str2Time(aliResult.TransDate)
}
}
return nil
return payOrder, nil
}
// UpdateUserMoney 修改数据库