|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- package hdl
-
- import (
- "applet/app/e"
- "applet/app/utils"
-
- //"applet/app/utils"
- "applet/app/utils/logx"
- "fmt"
- "github.com/gin-gonic/gin"
- )
-
- // Demo 测试
- func Demo(c *gin.Context) {
- 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"}`
- c.Set("data", str)
- var tmp map[string]interface{}
- err := c.ShouldBindJSON(&tmp)
- if err != nil {
- _ = logx.Error(err)
- return
- }
- fmt.Println(tmp["master_id"])
-
- e.OutSuc(c, "hello mall", nil)
- }
-
- func Demo1(c *gin.Context) {
- post, err := utils.CurlPost("http://pay.com/wx/redPackage/index", map[string]string{
- "re_openid": "oLAbGuMC5o6fJRcLSicj0MENGoEo",
- "amount": "100.00",
- }, nil)
- if err != nil {
- fmt.Println(err)
- }
- fmt.Println(post)
- //eg := commDb.DBs[c.GetString("mid")]
- //sess := eg.NewSession()
- ////r, err := eg.Table("user_profile").Where("uid=21699").Incr("fin_valid", 10).Exec()
- //sql := "update user_profile set fin_valid=fin_valid+? WHERE uid=?"
- //r, err := sess.Exec(sql, 10, 21699)
- //if err != nil {
- // return
- //}
- //sess.Commit()
- //
- //fmt.Println("res",utils.SerializeStr(r))
-
- /*engine := commDb.DBs[c.GetString("mid")]
- now := time.Now() //获取当前时间
- var startDate = now.Format("2006-01-02 15:00:00")
- var endDate = now.Add(time.Hour * 2).Format("2006-01-02 15:00:00")
- res := svc2.HandleSecondsKillForDate(engine, c.GetString("mid"), startDate, endDate)
- startTime := utils.AnyToString(now.Hour())
- endTime := utils.AnyToString(now.Add(time.Hour * 2).Hour())
- res = svc2.HandleSecondsKillForTime(engine, c.GetString("mid"), startDate, endDate)
-
- res = svc2.HandleSecondsKillForDateTime(engine, c.GetString("mid"), startDate, endDate, startTime, endTime)*/
- //reqList := make([]*md.CommissionReq, 0, 10)
- //
- //req := md.CommissionReq{
- // CommissionParam: md.CommissionParam{Commission: "10.00"},
- // Uid: "21699",
- // IsShare: 0,
- // Provider: "mall_goods",
- // IsAllLevelReturn: 0,
- // GoodsId: "3",
- //}
- //
- //for i := 0; i < 10; i++ {
- // req := req
- // req.GoodsId = utils.AnyToString(i + 1)
- // reqList = append(reqList, &req)
- //}
- //
- //fmt.Println(utils.SerializeStr(reqList))
- //
- //api, err := svc.BatchGetCommissionByCommApi("123456", reqList)
- //if err != nil {
- // _ = logx.Error(err)
- // fmt.Println(err)
- // e.OutErr(c, e.ERR, err)
- // return
- //}
-
- //e.OutSuc(c, res, nil)
-
- }
|