一物一码
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.
 
 
 
 
 
 

89 lines
2.7 KiB

  1. package hdl
  2. import (
  3. "applet/app/e"
  4. "applet/app/utils"
  5. //"applet/app/utils"
  6. "applet/app/utils/logx"
  7. "fmt"
  8. "github.com/gin-gonic/gin"
  9. )
  10. // Demo 测试
  11. func Demo(c *gin.Context) {
  12. 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"}`
  13. c.Set("data", str)
  14. var tmp map[string]interface{}
  15. err := c.ShouldBindJSON(&tmp)
  16. if err != nil {
  17. _ = logx.Error(err)
  18. return
  19. }
  20. fmt.Println(tmp["master_id"])
  21. e.OutSuc(c, "hello mall", nil)
  22. }
  23. func Demo1(c *gin.Context) {
  24. post, err := utils.CurlPost("http://pay.com/wx/redPackage/index", map[string]string{
  25. "re_openid": "oLAbGuMC5o6fJRcLSicj0MENGoEo",
  26. "amount": "100.00",
  27. }, nil)
  28. if err != nil {
  29. fmt.Println(err)
  30. }
  31. fmt.Println(post)
  32. //eg := commDb.DBs[c.GetString("mid")]
  33. //sess := eg.NewSession()
  34. ////r, err := eg.Table("user_profile").Where("uid=21699").Incr("fin_valid", 10).Exec()
  35. //sql := "update user_profile set fin_valid=fin_valid+? WHERE uid=?"
  36. //r, err := sess.Exec(sql, 10, 21699)
  37. //if err != nil {
  38. // return
  39. //}
  40. //sess.Commit()
  41. //
  42. //fmt.Println("res",utils.SerializeStr(r))
  43. /*engine := commDb.DBs[c.GetString("mid")]
  44. now := time.Now() //获取当前时间
  45. var startDate = now.Format("2006-01-02 15:00:00")
  46. var endDate = now.Add(time.Hour * 2).Format("2006-01-02 15:00:00")
  47. res := svc2.HandleSecondsKillForDate(engine, c.GetString("mid"), startDate, endDate)
  48. startTime := utils.AnyToString(now.Hour())
  49. endTime := utils.AnyToString(now.Add(time.Hour * 2).Hour())
  50. res = svc2.HandleSecondsKillForTime(engine, c.GetString("mid"), startDate, endDate)
  51. res = svc2.HandleSecondsKillForDateTime(engine, c.GetString("mid"), startDate, endDate, startTime, endTime)*/
  52. //reqList := make([]*md.CommissionReq, 0, 10)
  53. //
  54. //req := md.CommissionReq{
  55. // CommissionParam: md.CommissionParam{Commission: "10.00"},
  56. // Uid: "21699",
  57. // IsShare: 0,
  58. // Provider: "mall_goods",
  59. // IsAllLevelReturn: 0,
  60. // GoodsId: "3",
  61. //}
  62. //
  63. //for i := 0; i < 10; i++ {
  64. // req := req
  65. // req.GoodsId = utils.AnyToString(i + 1)
  66. // reqList = append(reqList, &req)
  67. //}
  68. //
  69. //fmt.Println(utils.SerializeStr(reqList))
  70. //
  71. //api, err := svc.BatchGetCommissionByCommApi("123456", reqList)
  72. //if err != nil {
  73. // _ = logx.Error(err)
  74. // fmt.Println(err)
  75. // e.OutErr(c, e.ERR, err)
  76. // return
  77. //}
  78. //e.OutSuc(c, res, nil)
  79. }