DengBiao vor 8 Monaten
Ursprung
Commit
1aecbefd8d
1 geänderte Dateien mit 54 neuen und 5 gelöschten Zeilen
  1. +54
    -5
      app/customer/hdl/hdl_demo.go

+ 54
- 5
app/customer/hdl/hdl_demo.go Datei anzeigen

@@ -149,8 +149,61 @@ func WxPay(c *gin.Context) {
}

func Demo(c *gin.Context) {
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
client, err := svc3.NewWxPayClient(c)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
wxSvc := jsapi.JsapiApiService{Client: client}
var m []model.CentralKitchenForSchoolPackageOrd
eg := db.Db
if err1 := eg.Where("state = 1 AND create_at >= '2024-02-16 00:00:00' AND create_at < '2024-02-16 23:59:59'").Desc("id").Find(&m); err1 != nil {
e.OutErr(c, e.ERR, err1.Error())
return
}
companyWithWxpayInfoDb := db.CompanyWithWxpayInfoDb{}
companyWithWxpayInfoDb.Set()

_, err := svc.DealCentralKitchenForSchoolOrderCallBackForWx("141271708763327845", "4200002114202402240122111525", "SUCCESS", "")
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.WxSpMchId)
centralKitchenForSchoolPackageOrd := db.CentralKitchenForSchoolPackageOrd{}
for _, v := range m {
wxMchId, err := companyWithWxpayInfoDb.GetCompanyWithWxpayInfoByEnterprise(v.EnterpriseId)
if err != nil {
fmt.Println(err)
e.OutErr(c, e.ERR, err.Error())
return
}
result, _, err := wxSvc.QueryOrderByOutTradeNo(c,
jsapi.QueryOrderByOutTradeNoRequest{
OutTradeNo: core.String(v.OutTradeNo),
SpMchid: core.String(sysCfg[enum.WxSpMchId]),
SubMchid: core.String(wxMchId),
},
)
if err != nil {
fmt.Println(err)
e.OutErr(c, e.ERR, err.Error())
return
}
successTime, err := utils.ConvertWechatTime(*result.SuccessTime)
if err != nil {
fmt.Println(err)
e.OutErr(c, e.ERR, err.Error())
return
}
v.PayAt = successTime
centralKitchenForSchoolPackageOrd.Set(v.OutTradeNo)
_, err = centralKitchenForSchoolPackageOrd.CentralKitchenForSchoolPackageOrdUpdate(&v, "pay_at")
if err != nil {
fmt.Println(err)
e.OutErr(c, e.ERR, err.Error())
return
}
}
return
_, err = svc.DealCentralKitchenForSchoolOrderCallBackForWx("141271708763327845", "4200002114202402240122111525", "SUCCESS", "")
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
@@ -158,10 +211,6 @@ func Demo(c *gin.Context) {
e.OutSuc(c, "success", nil)
return

sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAppid, enum.OpenAppletAppPrivateKey, enum.OpenAppletPublicKey)

//err, info := svc.CurlEducateFacepayApply(md.CurlEducateFacepayApplyReq{
// Config: struct {
// AliAppId string `json:"ali_app_id" label:"支付宝开放平台-小程序-appid"`


Laden…
Abbrechen
Speichern