智盟项目
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.5 KiB

  1. package hdl
  2. import (
  3. "applet/app/e"
  4. //"applet/app/utils"
  5. "applet/app/utils/logx"
  6. "fmt"
  7. "github.com/gin-gonic/gin"
  8. )
  9. // Demo 测试
  10. func Demo(c *gin.Context) {
  11. str := `{"appid":"wx598aaef252cd78e4","bank_type":"OTHERS","cash_fee":"1","fee_type":"CNY","is_subscribe":"N","master_id":"22255132","mch_id":"1534243971","nonce_str":"xiUZXdrEkpY9UdfCGEcBSE2jy7yWmQsk","openid":"odmKs6kNQBnujHv_S8YyME8g0-6c","order_type":"mall_goods","out_trade_no":"570761162512383595","pay_method":"wxpay","result_code":"SUCCESS","return_code":"SUCCESS","sign":"A5C7B43A8437E6AD72BB4FDAA8532A59","time_end":"20210701151722","total_fee":"1","trade_type":"APP","transaction_id":"4200001143202107010591333162"}`
  12. c.Set("data", str)
  13. var tmp map[string]interface{}
  14. err := c.ShouldBindJSON(&tmp)
  15. if err != nil {
  16. _ = logx.Error(err)
  17. return
  18. }
  19. fmt.Println(tmp["master_id"])
  20. e.OutSuc(c, "hello mall", nil)
  21. }
  22. func Demo1(c *gin.Context) {
  23. //eg := commDb.DBs[c.GetString("mid")]
  24. //sess := eg.NewSession()
  25. ////r, err := eg.Table("user_profile").Where("uid=21699").Incr("fin_valid", 10).Exec()
  26. //sql := "update user_profile set fin_valid=fin_valid+? WHERE uid=?"
  27. //r, err := sess.Exec(sql, 10, 21699)
  28. //if err != nil {
  29. // return
  30. //}
  31. //sess.Commit()
  32. //
  33. //fmt.Println("res",utils.SerializeStr(r))
  34. /*engine := commDb.DBs[c.GetString("mid")]
  35. now := time.Now() //获取当前时间
  36. var startDate = now.Format("2006-01-02 15:00:00")
  37. var endDate = now.Add(time.Hour * 2).Format("2006-01-02 15:00:00")
  38. res := svc2.HandleSecondsKillForDate(engine, c.GetString("mid"), startDate, endDate)
  39. startTime := utils.AnyToString(now.Hour())
  40. endTime := utils.AnyToString(now.Add(time.Hour * 2).Hour())
  41. res = svc2.HandleSecondsKillForTime(engine, c.GetString("mid"), startDate, endDate)
  42. res = svc2.HandleSecondsKillForDateTime(engine, c.GetString("mid"), startDate, endDate, startTime, endTime)*/
  43. //reqList := make([]*md.CommissionReq, 0, 10)
  44. //
  45. //req := md.CommissionReq{
  46. // CommissionParam: md.CommissionParam{Commission: "10.00"},
  47. // Uid: "21699",
  48. // IsShare: 0,
  49. // Provider: "mall_goods",
  50. // IsAllLevelReturn: 0,
  51. // GoodsId: "3",
  52. //}
  53. //
  54. //for i := 0; i < 10; i++ {
  55. // req := req
  56. // req.GoodsId = utils.AnyToString(i + 1)
  57. // reqList = append(reqList, &req)
  58. //}
  59. //
  60. //fmt.Println(utils.SerializeStr(reqList))
  61. //
  62. //api, err := svc.BatchGetCommissionByCommApi("123456", reqList)
  63. //if err != nil {
  64. // _ = logx.Error(err)
  65. // fmt.Println(err)
  66. // e.OutErr(c, e.ERR, err)
  67. // return
  68. //}
  69. //e.OutSuc(c, res, nil)
  70. }