diff --git a/app/admin/hdl/hdl_demo.go b/app/admin/hdl/hdl_demo.go index a7a9e86..c0b0a25 100644 --- a/app/admin/hdl/hdl_demo.go +++ b/app/admin/hdl/hdl_demo.go @@ -1,8 +1,12 @@ package hdl import ( + "applet/app/customer/md" + "applet/app/customer/svc" "applet/app/db" + "applet/app/db/model" "applet/app/e" + "applet/app/enum" "fmt" "github.com/gin-gonic/gin" "time" @@ -10,6 +14,43 @@ import ( // Demo 测试 func Demo(c *gin.Context) { + var m []model.CentralKitchenForSchoolPackageOrd + sess := db.Db.Desc("id").Where("state =1") + sess.Find(&m) + sysCfgDb := db.SysCfgDb{} + sysCfgDb.Set() + sysCfg := sysCfgDb.SysCfgFindWithDb(enum.JsapiPayAppAutToken, enum.OpenAlipayAppid, enum.OpenAlipayAppPrivateKey, enum.OpenAlipayPublicKey) + + centralKitchenForSchoolPackageOrd := db.CentralKitchenForSchoolPackageOrd{} + for _, v := range m { + err2, result := svc.CurlAlipayTradeQuery(md.CurlAlipayTradeQueryReq{ + 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: v.OutTradeNo, + AppAuthToken: sysCfg[enum.JsapiPayAppAutToken], + }) + if err2 != nil { + e.OutErr(c, e.ERR, err2.Error()) + return + } + centralKitchenForSchoolPackageOrd.Set(v.OutTradeNo) + v.CreateAt = result.Date + update, err := centralKitchenForSchoolPackageOrd.CentralKitchenForSchoolPackageOrdUpdate(&v, "create_at") + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + return + } + + fmt.Println(">>>>>>>>>>>>", v.OutTradeNo, update) + } + return qrcodeWithBatchRecordsDb := db.AdminDb{} qrcodeWithBatchRecordsDb.Set() data, _, err := qrcodeWithBatchRecordsDb.GetAdminRolePermission(1001) diff --git a/app/customer/hdl/hdl_pay.go b/app/customer/hdl/hdl_pay.go index 12af72d..0759319 100644 --- a/app/customer/hdl/hdl_pay.go +++ b/app/customer/hdl/hdl_pay.go @@ -56,8 +56,8 @@ func BuyPackageForWx(c *gin.Context) { } e.OutSuc(c, map[string]interface{}{ "out_trade_no": outTradeNo, - "prams": resp, - "total": total, + "prams": total, + "total": resp, }, nil) return } diff --git a/app/customer/md/md_curl_smart_pay.go b/app/customer/md/md_curl_smart_pay.go index 0619b2c..535a7a5 100644 --- a/app/customer/md/md_curl_smart_pay.go +++ b/app/customer/md/md_curl_smart_pay.go @@ -48,6 +48,7 @@ type CurlAlipayTradeQueryReq struct { type CurlAlipayTradeQueryResp struct { Code string `json:"code" label:"响应码"` + Date string `json:"date" label:"下单时间"` Msg string `json:"msg" label:"响应消息"` OutTradeNo string `json:"out_trade_no" label:"商户订单号"` TradeNo string `json:"trade_no" label:"支付宝交易号"`