微信相关接口
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.

46 lines
1.2 KiB

  1. package wechat
  2. import (
  3. "testing"
  4. )
  5. func Test_SendTemplateMessage(t *testing.T) {
  6. // appid := "wxedaca3ab498ec6c0"
  7. // appsecret := "6c7e567181dba2fe23692339d19ee16a"
  8. touser := "o4AH1jm_rnjDV4-4nsFhGhk4wIEQ"
  9. template_id := "avBk4QTEoA17c4G72XHet9gpGQtonW0ck2ewQWSsUwU"
  10. url := "https://shopv2.tetele.net"
  11. data := map[string]interface{}{
  12. "first": map[string]interface{}{
  13. "value": "已预约成功",
  14. },
  15. "keyword1": map[string]interface{}{
  16. "value": "巧克力",
  17. },
  18. "keyword2": map[string]interface{}{
  19. "value": "2014年9月22日",
  20. },
  21. "remark": map[string]interface{}{
  22. "value": "请点击详情",
  23. },
  24. }
  25. client_msg_id := ""
  26. miniapp_appid := ""
  27. miniapp_pagepath := ""
  28. // mpAT, err := GetAccessToken(appid, appsecret)
  29. // t.Log("access token:", mpAT)
  30. // if err==nil{
  31. // access_token = mpAT..AccessToken
  32. // }
  33. // if err != nil {
  34. // t.Error("access token error:", err)
  35. // }
  36. access_token := "71_sgGezbuBtu94tgRuhzSJHiDvgoOI2mS5kpYyeaynnvILmpPPHEclUmhKq74fj0M3HRjZk7hcNfB54tAJvNZPOrZleXQX2dyWZm_8tyu5m1YpAb8qLrwRnUNRdowMJXhAIAVSG"
  37. ret, err := SendTemplateMessage(access_token, touser, template_id, url, data, client_msg_id, miniapp_appid, miniapp_pagepath)
  38. t.Log(ret)
  39. t.Log(err)
  40. }