github.com/chanxuehong/wechat@v0.0.0-20230222024006-36f0325263cd/mp/poi/update.go (about) 1 package poi 2 3 import ( 4 "github.com/chanxuehong/wechat/mp/core" 5 ) 6 7 type UpdateParameters struct { 8 BaseInfo struct { 9 PoiId int64 `json:"poi_id"` 10 11 // 下面7个字段,若有填写内容则为覆盖更新,若无内容则视为不修改,维持原有内容。 12 // photo_list 字段为全列表覆盖,若需要增加图片,需将之前图片同样放入list 中,在其后增加新增图片。 13 // 如:已有A、B、C 三张图片,又要增加D、E 两张图,则需要调用该接口,photo_list 传入A、B、C、D、E 五张图片的链接。 14 Telephone string `json:"telephone,omitempty"` 15 PhotoList []Photo `json:"photo_list,omitempty"` 16 Recommend string `json:"recommend,omitempty"` 17 Special string `json:"special,omitempty"` 18 Introduction string `json:"introduction,omitempty"` 19 OpenTime string `json:"open_time,omitempty"` 20 AvgPrice int `json:"avg_price,omitempty"` 21 } `json:"base_info"` 22 } 23 24 // Update 修改门店服务信息. 25 func Update(clt *core.Client, params *UpdateParameters) (err error) { 26 const incompleteURL = "https://api.weixin.qq.com/cgi-bin/poi/updatepoi?access_token=" 27 28 var request = struct { 29 *UpdateParameters `json:"business,omitempty"` 30 }{ 31 UpdateParameters: params, 32 } 33 var result core.Error 34 if err = clt.PostJSON(incompleteURL, &request, &result); err != nil { 35 return 36 } 37 if result.ErrCode != core.ErrCodeOK { 38 err = &result 39 return 40 } 41 return 42 }