DengBiao 1 år sedan
förälder
incheckning
f3f6ccbbe1
1 ändrade filer med 28 tillägg och 36 borttagningar
  1. +28
    -36
      app/admin/svc/order/svc_central_kitchen_for_school_order.go

+ 28
- 36
app/admin/svc/order/svc_central_kitchen_for_school_order.go Visa fil

@@ -9,7 +9,6 @@ import (
"applet/app/enum"
"applet/app/utils"
"errors"
"fmt"
"time"
)

@@ -156,12 +155,38 @@ func CentralKitchenForSchoolOrderRefundAudit(req md.CentralKitchenForSchoolOrder
if req.State == 1 {
returnDay.State = enum.CentralKitchenForSchoolUserRefundDayStateForAuditPass
userWithDay.State = enum.CentralKitchenForSchoolUserWithDayStateForCancel

//调用支付宝进行退款
err6, _ := svc2.CurlAlipayTradeRefund(md2.CurlAlipayTradeRefundReq{
Config: struct {
PayAliAppId string `json:"pay_ali_app_id" label:"支付宝开放平台-第三方应用-appid"`
PayAliPrivateKey string `json:"pay_ali_private_key" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"`
PayAliPublicKey string `json:"pay_ali_public_key" label:"支付宝开放平台-第三方应用-接口加签-支付宝公钥"`
}{
PayAliAppId: sysCfg[enum.OpenAlipayAppid],
PayAliPrivateKey: sysCfg[enum.OpenAlipayAppPrivateKey],
PayAliPublicKey: sysCfg[enum.OpenAlipayPublicKey],
},
OutTradeNo: returnDay.OutTradeNo,
RefundAmount: returnDay.Amount,
RefundReason: "央厨订餐退款",
OutRequestNo: returnDay.OutRequestNo,
AppAuthToken: sysCfg[enum.JsapiPayAppAutToken],
})
if err6 != nil {
_ = session.Rollback()
return err6
}

returnDay.State = enum.CentralKitchenForSchoolUserRefundDayStateForAuditComplete
returnDay.RefundDate = time.Now().Format("2006-01-02 15:04:05")
} else {
returnDay.State = enum.CentralKitchenForSchoolUserRefundDayStateForAuditReject
userWithDay.State = enum.CentralKitchenForSchoolUserWithDayStateForWait
}

returnDay.Memo = req.Memo
updateAck, err2 := centralKitchenForSchoolUserRefundDayDb.CentralKitchenForSchoolUserRefundDayUpdate(returnDay.Id, returnDay, "state", "memo")
updateAck, err2 := centralKitchenForSchoolUserRefundDayDb.CentralKitchenForSchoolUserRefundDayUpdate(returnDay.Id, returnDay, "state", "memo", "refund_date")
if err2 != nil {
_ = session.Rollback()
return err2
@@ -190,41 +215,8 @@ func CentralKitchenForSchoolOrderRefundAudit(req md.CentralKitchenForSchoolOrder
return err5
}

//3、调用支付宝进行退款
if req.State == 1 {
err6, _ := svc2.CurlAlipayTradeRefund(md2.CurlAlipayTradeRefundReq{
Config: struct {
PayAliAppId string `json:"pay_ali_app_id" label:"支付宝开放平台-第三方应用-appid"`
PayAliPrivateKey string `json:"pay_ali_private_key" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"`
PayAliPublicKey string `json:"pay_ali_public_key" label:"支付宝开放平台-第三方应用-接口加签-支付宝公钥"`
}{
PayAliAppId: sysCfg[enum.OpenAlipayAppid],
PayAliPrivateKey: sysCfg[enum.OpenAlipayAppPrivateKey],
PayAliPublicKey: sysCfg[enum.OpenAlipayPublicKey],
},
OutTradeNo: returnDay.OutTradeNo,
RefundAmount: returnDay.Amount,
RefundReason: "央厨订餐退款",
OutRequestNo: returnDay.OutRequestNo,
AppAuthToken: sysCfg[enum.JsapiPayAppAutToken],
})
if err6 != nil {
_ = session.Rollback()
return err6
}
returnDay.State = enum.CentralKitchenForSchoolUserRefundDayStateForAuditComplete
returnDay.RefundDate = time.Now().Format("2006-01-02 15:04:05")
updateAck2, err7 := centralKitchenForSchoolUserWithDayDb.CentralKitchenForSchoolUserWithDayUpdate(userWithDay.Id, userWithDay, "state", "refund_date")
fmt.Println(">>>>>>>>>>>>>>>>>updateAck2<<<<<<<<<<<<<<", updateAck2)
if err7 != nil {
_ = session.Rollback()
return err7
}
if updateAck2 <= 0 {
_ = session.Rollback()
err = errors.New("更新退款订单记录时间失败")
return
}

}
}



Laddar…
Avbryt
Spara