github.com/chanxuehong/wechat@v0.0.0-20230222024006-36f0325263cd/mp/shakearound/device/bindlocation.go (about)

     1  package device
     2  
     3  import (
     4  	"github.com/chanxuehong/wechat/mp/core"
     5  )
     6  
     7  // 配置设备与门店的关联关系
     8  func BindLocation(clt *core.Client, deviceIdentifier *DeviceIdentifier, poiId int64) (err error) {
     9  	request := struct {
    10  		DeviceIdentifier *DeviceIdentifier `json:"device_identifier,omitempty"`
    11  		PoiId            int64             `json:"poi_id"`
    12  	}{
    13  		DeviceIdentifier: deviceIdentifier,
    14  		PoiId:            poiId,
    15  	}
    16  
    17  	var result core.Error
    18  
    19  	incompleteURL := "https://api.weixin.qq.com/shakearound/device/bindlocation?access_token="
    20  	if err = clt.PostJSON(incompleteURL, &request, &result); err != nil {
    21  		return
    22  	}
    23  
    24  	if result.ErrCode != core.ErrCodeOK {
    25  		err = &result
    26  		return
    27  	}
    28  	return
    29  }