github.com/chanxuehong/wechat@v0.0.0-20230222024006-36f0325263cd/mp/shakearound/device/applyid.go (about) 1 package device 2 3 import ( 4 "github.com/chanxuehong/wechat/mp/core" 5 ) 6 7 type ApplyIdParameters struct { 8 Quantity int `json:"quantity"` // 必须, 申请的设备ID的数量,单次新增设备超过500个,需走人工审核流程 9 ApplyReason string `json:"apply_reason"` // 必须, 申请理由,不超过100个字 10 Comment string `json:"comment,omitempty"` // 可选, 备注,不超过15个汉字或30个英文字母 11 PoiId *int64 `json:"poi_id,omitempty"` // 可选, 设备关联的门店ID,关联门店后,在门店1KM的范围内有优先摇出信息的机会。 12 } 13 14 type ApplyIdResult struct { 15 ApplyId int64 `json:"apply_id"` // 申请的批次ID,可用在“查询设备列表”接口按批次查询本次申请成功的设备ID。 16 AuditStatus int `json:"audit_status"` // 审核状态。0:审核未通过、1:审核中、2:审核已通过;若单次申请的设备ID数量小于等于500个,系统会进行快速审核;若单次申请的设备ID数量大于500个,会在三个工作日内完成审核 17 AuditComment string `json:"audit_comment"` // 审核备注,包括审核不通过的原因 18 } 19 20 // 申请设备ID 21 func ApplyId(clt *core.Client, para *ApplyIdParameters) (rslt *ApplyIdResult, err error) { 22 var result struct { 23 core.Error 24 ApplyIdResult `json:"data"` 25 } 26 27 incompleteURL := "https://api.weixin.qq.com/shakearound/device/applyid?access_token=" 28 if err = clt.PostJSON(incompleteURL, para, &result); err != nil { 29 return 30 } 31 32 if result.ErrCode != core.ErrCodeOK { 33 err = &result.Error 34 return 35 } 36 37 rslt = &result.ApplyIdResult 38 return 39 }