-
Notifications
You must be signed in to change notification settings - Fork 0
/
memberlist.go
53 lines (45 loc) · 1.38 KB
/
memberlist.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
/**
* Created by GoLand.
* User: 姜伟
* Date: 2019/12/29 0029
* Time: 11:30
*/
package member
import (
"github.com/a07061625/gompf/mpf"
"github.com/a07061625/gompf/mpf/api"
"github.com/a07061625/gompf/mpf/api/mpprint"
"github.com/a07061625/gompf/mpf/mpconstant/errorcode"
"github.com/a07061625/gompf/mpf/mpconstant/project"
"github.com/valyala/fasthttp"
)
type memberList struct {
mpprint.BaseFeYin
}
func (ml *memberList) checkData() (*fasthttp.Client, *fasthttp.Request) {
ml.ReqURI = mpprint.FeYinServiceDomain + "/app/" + ml.GetAppId() + "/members?access_token=" + mpprint.NewUtilPrint().GetFeYinAccessToken(ml.GetAppId())
return ml.GetRequest()
}
func (ml *memberList) SendRequest() api.APIResult {
client, req := ml.checkData()
resp, result := ml.SendInner(client, req, errorcode.PrintFeYinRequestGet)
if resp.RespCode > 0 {
return result
}
respData, _ := mpf.JSONUnmarshalMap(resp.Content)
_, ok := respData["errcode"]
if ok {
result.Code = errorcode.PrintFeYinRequestGet
result.Msg = respData["errmsg"].(string)
} else {
result.Data = respData
}
return result
}
func NewMemberList(appId string) *memberList {
ml := &memberList{mpprint.NewBaseFeYin()}
ml.SetAppId(appId)
ml.ReqMethod = fasthttp.MethodGet
ml.ReqContentType = project.HTTPContentTypeForm
return ml
}