github.com/chanxuehong/wechat@v0.0.0-20230222024006-36f0325263cd/mp/bizwifi/homepage/get.go (about) 1 package homepage 2 3 import ( 4 "github.com/chanxuehong/wechat/mp/core" 5 ) 6 7 type Homepage struct { 8 ShopId int64 `json:"shop_id"` // 门店ID 9 TemplateId int64 `json:"template_id"` // 模板类型 10 URL string `json:"url"` // 商家主页链接 11 } 12 13 func Get(clt *core.Client, shopId int64) (homepage *Homepage, err error) { 14 request := struct { 15 ShopId int64 `json:"shop_id"` 16 }{ 17 ShopId: shopId, 18 } 19 20 var result struct { 21 core.Error 22 Homepage `json:"data"` 23 } 24 25 incompleteURL := "https://api.weixin.qq.com/bizwifi/homepage/get?access_token=" 26 if err = clt.PostJSON(incompleteURL, &request, &result); err != nil { 27 return 28 } 29 30 if result.ErrCode != core.ErrCodeOK { 31 err = &result.Error 32 return 33 } 34 35 homepage = &result.Homepage 36 return 37 }