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