-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathtester.go
62 lines (53 loc) · 1.77 KB
/
tester.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package wechat3rd
import "github.com/l306287405/wechat3rd/core"
type BindTesterReq struct {
Wechatid string `json:"wechatid"`
}
type BindTesterResp struct {
core.Error
Userstr string `json:"userstr"`
}
//绑定微信用户为体验者
//https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Mini_Program_AdminManagement/Admin.html
func (s *Server) BindTester(authorizerAccessToken string, req *BindTesterReq) (resp *BindTesterResp) {
var (
u = WECHAT_API_URL + "/wxa/bind_tester?"
)
resp = &BindTesterResp{}
resp.Err(core.PostJson(s.AuthToken2url(u, authorizerAccessToken), req, resp))
return
}
type UnbindTesterReq struct {
Wechatid *string `json:"wechatid,omitempty"`
Userstr *string `json:"userstr,omitempty"`
}
//解除绑定体验者
//https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Mini_Program_AdminManagement/unbind_tester.html
func (s *Server) UnbindTester(authorizerAccessToken string, req *UnbindTesterReq) (resp *core.Error) {
var (
u = WECHAT_API_URL + "/wxa/unbind_tester?"
)
resp = &core.Error{}
resp.Err(core.PostJson(s.AuthToken2url(u, authorizerAccessToken), req, resp))
return
}
type MemberAuthItem struct {
Userstr string `json:"userstr"`
}
type MemberAuthResp struct {
core.Error
Members []*MemberAuthItem `json:"members"`
}
//获取体验者列表
//https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Mini_Program_AdminManagement/memberauth.html
func (s *Server) MemberAuth(authorizerAccessToken string) (resp *MemberAuthResp) {
var (
u = WECHAT_API_URL + "/wxa/memberauth?"
req = &struct {
Action string `json:"action"`
}{Action: "get_experiencer"}
)
resp = &MemberAuthResp{}
resp.Err(core.PostJson(s.AuthToken2url(u, authorizerAccessToken), req, resp))
return
}