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

     1  package device
     2  
     3  import (
     4  	"github.com/chanxuehong/wechat/mp/core"
     5  )
     6  
     7  type BindPageParameters struct {
     8  	DeviceIdentifier *DeviceIdentifier `json:"device_identifier,omitempty"` // 必须, 设备标识
     9  	PageIds          []int64           `json:"page_ids,omitempty"`          // 必须, 待关联的页面列表
    10  	Bind             int               `json:"bind"`                        // 必须, 关联操作标志位, 0为解除关联关系,1为建立关联关系
    11  	Append           int               `json:"append"`                      // 必须, 新增操作标志位, 0为覆盖,1为新增
    12  }
    13  
    14  func BindPage(clt *core.Client, para *BindPageParameters) (err error) {
    15  	var result core.Error
    16  
    17  	incompleteURL := "https://api.weixin.qq.com/shakearound/device/bindpage?access_token="
    18  	if err = clt.PostJSON(incompleteURL, para, &result); err != nil {
    19  		return
    20  	}
    21  
    22  	if result.ErrCode != core.ErrCodeOK {
    23  		err = &result
    24  		return
    25  	}
    26  	return
    27  }