|
- 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"
- )
-
- // 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)
- if err != nil {
- e.OutErr(c, e.ERR_DB_ORM, err.Error())
- return
- }
- e.OutSuc(c, data, nil)
- go GoOnExecuting()
- return
- }
-
- func GoOnExecuting() {
- for i := 0; i < 20; i++ {
- time.Sleep(1 * time.Second)
- fmt.Println(i)
- }
- }
|