/
infolistonline.go
46 lines (39 loc) · 1.14 KB
/
infolistonline.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
/**
* Created by GoLand.
* User: 姜伟
* Date: 2020/1/11 0011
* Time: 22:54
*/
package customservice
import (
"github.com/a07061625/gompf/mpf"
"github.com/a07061625/gompf/mpf/api"
"github.com/a07061625/gompf/mpf/api/wx"
"github.com/a07061625/gompf/mpf/mpconstant/errorcode"
)
type infoListOnline struct {
wx.BaseWxAccount
appId string
}
func (ilo *infoListOnline) SendRequest() api.APIResult {
ilo.ReqURI = "https://api.weixin.qq.com/cgi-bin/customservice/getonlinekflist?access_token=" + wx.NewUtilWx().GetSingleAccessToken(ilo.appId)
client, req := ilo.GetRequest()
resp, result := ilo.SendInner(client, req, errorcode.WxAccountRequestGet)
if resp.RespCode > 0 {
return result
}
respData, _ := mpf.JSONUnmarshalMap(resp.Content)
_, ok := respData["kf_online_list"]
if ok {
result.Data = respData
} else {
result.Code = errorcode.WxAccountRequestGet
result.Msg = respData["errmsg"].(string)
}
return result
}
func NewInfoListOnline(appId string) *infoListOnline {
ilo := &infoListOnline{wx.NewBaseWxAccount(), ""}
ilo.appId = appId
return ilo
}