智慧食堂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 rivejä
2.1 KiB

  1. package hdl
  2. import (
  3. "applet/app/customer/md"
  4. "applet/app/customer/svc"
  5. "applet/app/db"
  6. "applet/app/db/model"
  7. "applet/app/e"
  8. "applet/app/enum"
  9. "fmt"
  10. "github.com/gin-gonic/gin"
  11. "time"
  12. )
  13. // Demo 测试
  14. func Demo(c *gin.Context) {
  15. var m []model.CentralKitchenForSchoolPackageOrd
  16. sess := db.Db.Desc("id").Where("state =1")
  17. sess.Find(&m)
  18. sysCfgDb := db.SysCfgDb{}
  19. sysCfgDb.Set()
  20. sysCfg := sysCfgDb.SysCfgFindWithDb(enum.JsapiPayAppAutToken, enum.OpenAlipayAppid, enum.OpenAlipayAppPrivateKey, enum.OpenAlipayPublicKey)
  21. centralKitchenForSchoolPackageOrd := db.CentralKitchenForSchoolPackageOrd{}
  22. for _, v := range m {
  23. err2, result := svc.CurlAlipayTradeQuery(md.CurlAlipayTradeQueryReq{
  24. Config: struct {
  25. PayAliAppId string `json:"pay_ali_app_id" label:"支付宝开放平台-第三方应用-appid"`
  26. PayAliPrivateKey string `json:"pay_ali_private_key" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"`
  27. PayAliPublicKey string `json:"pay_ali_public_key" label:"支付宝开放平台-第三方应用-接口加签-支付宝公钥"`
  28. }{
  29. PayAliAppId: sysCfg[enum.OpenAlipayAppid],
  30. PayAliPrivateKey: sysCfg[enum.OpenAlipayAppPrivateKey],
  31. PayAliPublicKey: sysCfg[enum.OpenAlipayPublicKey],
  32. },
  33. OutTradeNo: v.OutTradeNo,
  34. AppAuthToken: sysCfg[enum.JsapiPayAppAutToken],
  35. })
  36. if err2 != nil {
  37. e.OutErr(c, e.ERR, err2.Error())
  38. return
  39. }
  40. centralKitchenForSchoolPackageOrd.Set(v.OutTradeNo)
  41. v.CreateAt = result.Date
  42. update, err := centralKitchenForSchoolPackageOrd.CentralKitchenForSchoolPackageOrdUpdate(&v, "create_at")
  43. if err != nil {
  44. e.OutErr(c, e.ERR, err.Error())
  45. return
  46. }
  47. fmt.Println(">>>>>>>>>>>>", v.OutTradeNo, update)
  48. }
  49. return
  50. qrcodeWithBatchRecordsDb := db.AdminDb{}
  51. qrcodeWithBatchRecordsDb.Set()
  52. data, _, err := qrcodeWithBatchRecordsDb.GetAdminRolePermission(1001)
  53. if err != nil {
  54. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  55. return
  56. }
  57. e.OutSuc(c, data, nil)
  58. go GoOnExecuting()
  59. return
  60. }
  61. func GoOnExecuting() {
  62. for i := 0; i < 20; i++ {
  63. time.Sleep(1 * time.Second)
  64. fmt.Println(i)
  65. }
  66. }