wx_BatchQueryComment.go 1020 B

12345678910111213141516171819202122232425262728293031323334
  1. package wechat
  2. import (
  3. "fmt"
  4. "github.com/iGoogle-ink/gopay"
  5. "github.com/iGoogle-ink/gopay/wechat"
  6. )
  7. func BatchQueryComment() {
  8. //初始化微信客户端
  9. // appId:应用ID
  10. // MchID:商户ID
  11. // ApiKey:Key值
  12. // isProd:是否是正式环境
  13. // 好像不支持沙箱环境,因为沙箱环境默认需要用MD5签名,但是此接口仅支持HMAC-SHA256签名
  14. client := wechat.NewClient("wxdaa2ab9ef87b5497", "1368139502", "GFDS8j98rewnmgl45wHTt980jg543abc", false)
  15. // 初始化参数结构体
  16. bm := make(gopay.BodyMap)
  17. bm.Set("nonce_str", gopay.GetRandomString(32))
  18. bm.Set("sign_type", wechat.SignType_HMAC_SHA256)
  19. bm.Set("begin_time", "20190120000000")
  20. bm.Set("end_time", "20190122174000")
  21. bm.Set("offset", "0")
  22. // 请求拉取订单评价数据,成功后得到结果,沙箱环境下,证书路径参数可传空
  23. wxRsp, err := client.BatchQueryComment(bm, nil, nil, nil)
  24. if err != nil {
  25. fmt.Println("Error:", err)
  26. return
  27. }
  28. fmt.Println("Response:", wxRsp)
  29. }