forked from chanxuehong/wechat
-
Notifications
You must be signed in to change notification settings - Fork 3
/
bindlocation.go
34 lines (28 loc) · 1.03 KB
/
bindlocation.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
// @description wechat 是腾讯微信公众平台 api 的 golang 语言封装
// @link https://gopkg.in/chanxuehong/wechat.v1 for the canonical source repository
// @license https://github.com/chanxuehong/wechat/blob/v1/LICENSE
// @authors chanxuehong(chanxuehong@gmail.com), magicshui(shuiyuzhe@gmail.com), Harry Rong(harrykobe@gmail.com)
package device
import (
"gopkg.in/chanxuehong/wechat.v1/mp"
)
// 配置设备与门店的关联关系
func BindLocation(clt *mp.Client, deviceIdentifier *DeviceIdentifier, poiId int64) (err error) {
request := struct {
DeviceIdentifier *DeviceIdentifier `json:"device_identifier,omitempty"`
PoiId int64 `json:"poi_id"`
}{
DeviceIdentifier: deviceIdentifier,
PoiId: poiId,
}
var result mp.Error
incompleteURL := "https://api.weixin.qq.com/shakearound/device/bindlocation?access_token="
if err = clt.PostJSON(incompleteURL, &request, &result); err != nil {
return
}
if result.ErrCode != mp.ErrCodeOK {
err = &result
return
}
return
}