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

93 lines
2.8 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. DealCallBack("oLAbGuMC5o6fJRcLSicj0MENGoEo", "1692603601358587_sVxAbe")
  25. post, err := utils.CurlPost("http://pay.com/wx/redPackage/index", utils.SerializeStr(map[string]string{
  26. "openid": "oLAbGuMC5o6fJRcLSicj0MENGoEo",
  27. "amount": "100.00",
  28. }), nil)
  29. if err != nil {
  30. fmt.Println(err)
  31. }
  32. fmt.Println(post)
  33. e.OutSuc(c, post, nil)
  34. //eg := commDb.DBs[c.GetString("mid")]
  35. //sess := eg.NewSession()
  36. ////r, err := eg.Table("user_profile").Where("uid=21699").Incr("fin_valid", 10).Exec()
  37. //sql := "update user_profile set fin_valid=fin_valid+? WHERE uid=?"
  38. //r, err := sess.Exec(sql, 10, 21699)
  39. //if err != nil {
  40. // return
  41. //}
  42. //sess.Commit()
  43. //
  44. //fmt.Println("res",utils.SerializeStr(r))
  45. /*engine := commDb.DBs[c.GetString("mid")]
  46. now := time.Now() //获取当前时间
  47. var startDate = now.Format("2006-01-02 15:00:00")
  48. var endDate = now.Add(time.Hour * 2).Format("2006-01-02 15:00:00")
  49. res := svc2.HandleSecondsKillForDate(engine, c.GetString("mid"), startDate, endDate)
  50. startTime := utils.AnyToString(now.Hour())
  51. endTime := utils.AnyToString(now.Add(time.Hour * 2).Hour())
  52. res = svc2.HandleSecondsKillForTime(engine, c.GetString("mid"), startDate, endDate)
  53. res = svc2.HandleSecondsKillForDateTime(engine, c.GetString("mid"), startDate, endDate, startTime, endTime)*/
  54. //reqList := make([]*md.CommissionReq, 0, 10)
  55. //
  56. //req := md.CommissionReq{
  57. // CommissionParam: md.CommissionParam{Commission: "10.00"},
  58. // Uid: "21699",
  59. // IsShare: 0,
  60. // Provider: "mall_goods",
  61. // IsAllLevelReturn: 0,
  62. // GoodsId: "3",
  63. //}
  64. //
  65. //for i := 0; i < 10; i++ {
  66. // req := req
  67. // req.GoodsId = utils.AnyToString(i + 1)
  68. // reqList = append(reqList, &req)
  69. //}
  70. //
  71. //fmt.Println(utils.SerializeStr(reqList))
  72. //
  73. //api, err := svc.BatchGetCommissionByCommApi("123456", reqList)
  74. //if err != nil {
  75. // _ = logx.Error(err)
  76. // fmt.Println(err)
  77. // e.OutErr(c, e.ERR, err)
  78. // return
  79. //}
  80. //e.OutSuc(c, res, nil)
  81. }