Browse Source

12

add_mode
DengBiao 1 year ago
parent
commit
f3f6ccbbe1
1 changed files with 28 additions and 36 deletions
  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 View File

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


@@ -156,12 +155,38 @@ func CentralKitchenForSchoolOrderRefundAudit(req md.CentralKitchenForSchoolOrder
if req.State == 1 { if req.State == 1 {
returnDay.State = enum.CentralKitchenForSchoolUserRefundDayStateForAuditPass returnDay.State = enum.CentralKitchenForSchoolUserRefundDayStateForAuditPass
userWithDay.State = enum.CentralKitchenForSchoolUserWithDayStateForCancel 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 { } else {
returnDay.State = enum.CentralKitchenForSchoolUserRefundDayStateForAuditReject returnDay.State = enum.CentralKitchenForSchoolUserRefundDayStateForAuditReject
userWithDay.State = enum.CentralKitchenForSchoolUserWithDayStateForWait userWithDay.State = enum.CentralKitchenForSchoolUserWithDayStateForWait
} }

returnDay.Memo = req.Memo 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 { if err2 != nil {
_ = session.Rollback() _ = session.Rollback()
return err2 return err2
@@ -190,41 +215,8 @@ func CentralKitchenForSchoolOrderRefundAudit(req md.CentralKitchenForSchoolOrder
return err5 return err5
} }


//3、调用支付宝进行退款
if req.State == 1 { 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
}

} }
} }




Loading…
Cancel
Save