forked from smartwalle/wlc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollection.go
33 lines (29 loc) · 843 Bytes
/
collection.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
package wlc
import (
"encoding/json"
"net/http"
)
const (
kLoginTraceURL = "http://api2.wlc.nppa.gov.cn/behavior/collection/loginout"
kLoginTraceTestURL = "https://wlc.nppa.gov.cn/test/collection/loginout/"
)
func (this *client) LoginTrace(param LoginTraceParam) (result *LoginTraceRsp, err error) {
data, err := this.request(http.MethodPost, kLoginTraceURL, nil, param)
if err != nil {
return nil, err
}
if err = json.Unmarshal(data, &result); err != nil {
return nil, err
}
return result, nil
}
func (this *client) LoginTraceTest(code string, param LoginTraceParam) (result *LoginTraceRsp, err error) {
data, err := this.request(http.MethodPost, kLoginTraceTestURL+code, nil, param)
if err != nil {
return nil, err
}
if err = json.Unmarshal(data, &result); err != nil {
return nil, err
}
return result, nil
}