|
@@ -163,8 +163,7 @@ func CentralKitchenForSchoolOrderRefundList(req md.CentralKitchenForSchoolOrderR |
|
|
func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitchenForSchoolOrderRefundAuditReq) (err error) { |
|
|
func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitchenForSchoolOrderRefundAuditReq) (err error) { |
|
|
sysCfgDb := db.SysCfgDb{} |
|
|
sysCfgDb := db.SysCfgDb{} |
|
|
sysCfgDb.Set() |
|
|
sysCfgDb.Set() |
|
|
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.JsapiPayAppAutToken, enum.OpenAlipayAppid, enum.OpenAlipayAppPrivateKey, enum.OpenAlipayPublicKey, |
|
|
|
|
|
enum.WxMchId, enum.WxJsapiRefundPayNotifyUrl) |
|
|
|
|
|
|
|
|
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.JsapiPayAppAutToken, enum.OpenAlipayAppid, enum.OpenAlipayAppPrivateKey, enum.OpenAlipayPublicKey, enum.WxJsapiRefundPayNotifyUrl) |
|
|
|
|
|
|
|
|
session := db.Db.NewSession() |
|
|
session := db.Db.NewSession() |
|
|
defer session.Close() |
|
|
defer session.Close() |
|
@@ -184,10 +183,14 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch |
|
|
OutRequestNo string `json:"out_request_no"` |
|
|
OutRequestNo string `json:"out_request_no"` |
|
|
Amount float64 `json:"amount"` |
|
|
Amount float64 `json:"amount"` |
|
|
Total string `json:"total"` |
|
|
Total string `json:"total"` |
|
|
|
|
|
WxMchId string `json:"wx_mch_id"` |
|
|
}{} |
|
|
}{} |
|
|
|
|
|
|
|
|
outRequestNoSuffix := "_" + utils.Int64ToStr(time.Now().Unix()) |
|
|
outRequestNoSuffix := "_" + utils.Int64ToStr(time.Now().Unix()) |
|
|
|
|
|
|
|
|
|
|
|
companyWithWxpayInfoDb := db.CompanyWithWxpayInfoDb{} |
|
|
|
|
|
companyWithWxpayInfoDb.Set() |
|
|
|
|
|
|
|
|
for _, v := range req.Ids { |
|
|
for _, v := range req.Ids { |
|
|
//1、更新状态 |
|
|
//1、更新状态 |
|
|
if req.State == 1 { |
|
|
if req.State == 1 { |
|
@@ -227,15 +230,25 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ord.PayWay == enum2.PayWayForWx { |
|
|
if ord.PayWay == enum2.PayWayForWx { |
|
|
|
|
|
var wxMchId = dealReturnOrdMapForWx[returnDay.OutTradeNo].WxMchId |
|
|
|
|
|
if wxMchId == "" { |
|
|
|
|
|
wxMchId, err4 = companyWithWxpayInfoDb.GetCompanyWithWxpayInfoByEnterprise(ord.EnterpriseId) |
|
|
|
|
|
if err4 != nil { |
|
|
|
|
|
_ = session.Rollback() |
|
|
|
|
|
return err4 |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
dealReturnOrdMapForWx[returnDay.OutTradeNo] = struct { |
|
|
dealReturnOrdMapForWx[returnDay.OutTradeNo] = struct { |
|
|
OutRequestNo string `json:"out_request_no"` |
|
|
OutRequestNo string `json:"out_request_no"` |
|
|
Amount float64 `json:"amount"` |
|
|
Amount float64 `json:"amount"` |
|
|
Total string `json:"total"` |
|
|
Total string `json:"total"` |
|
|
|
|
|
WxMchId string `json:"wx_mch_id"` |
|
|
}(struct { |
|
|
}(struct { |
|
|
OutRequestNo string |
|
|
OutRequestNo string |
|
|
Amount float64 |
|
|
Amount float64 |
|
|
Total string |
|
|
Total string |
|
|
}{OutRequestNo: outRequestNo, Amount: dealReturnOrdMapForWx[returnDay.OutTradeNo].Amount + utils.StrToFloat64(returnDay.Amount), Total: ord.TotalPrice}) |
|
|
|
|
|
|
|
|
WxMchId string |
|
|
|
|
|
}{OutRequestNo: outRequestNo, Amount: dealReturnOrdMapForWx[returnDay.OutTradeNo].Amount + utils.StrToFloat64(returnDay.Amount), Total: ord.TotalPrice, WxMchId: wxMchId}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
returnDay.OutRequestNo = outRequestNo |
|
|
returnDay.OutRequestNo = outRequestNo |
|
@@ -265,11 +278,6 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
//else { |
|
|
|
|
|
// returnDay.State = enum.CentralKitchenForSchoolUserRefundDayStateForAuditReject |
|
|
|
|
|
// userWithDay.State = enum.CentralKitchenForSchoolUserWithDayStateForWait |
|
|
|
|
|
//} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//调用支付宝进行退款 |
|
|
//调用支付宝进行退款 |
|
@@ -308,7 +316,7 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch |
|
|
for k, v := range dealReturnOrdMapForWx { |
|
|
for k, v := range dealReturnOrdMapForWx { |
|
|
resp, _, err6 := wxSvc.Create(c, |
|
|
resp, _, err6 := wxSvc.Create(c, |
|
|
refunddomestic.CreateRequest{ |
|
|
refunddomestic.CreateRequest{ |
|
|
SubMchid: core.String(sysCfg[enum.WxMchId]), |
|
|
|
|
|
|
|
|
SubMchid: core.String(v.WxMchId), |
|
|
OutTradeNo: core.String(k), |
|
|
OutTradeNo: core.String(k), |
|
|
OutRefundNo: core.String(v.OutRequestNo), |
|
|
OutRefundNo: core.String(v.OutRequestNo), |
|
|
Reason: core.String("央厨订餐退款"), |
|
|
Reason: core.String("央厨订餐退款"), |
|
|