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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package hdh
import (
"context"
"encoding/json"
)
//品牌
type BrandListReq struct {
AppID string `json:"appId"`
Page int `json:"page"`
Limit int `json:"limit"`
}
//品牌列表
type BrandListRes struct {
Code string `json:"code"`
Data struct {
DataList []struct {
ID string `json:"id"`
Name string `json:"name"` //品牌名称
Desc string `json:"desc,omitempty"` //品牌描述
LogoURL string `json:"logoUrl,omitempty"` //logo
PosterURL string `json:"posterUrl,omitempty"` //海报
} `json:"dataList"`
NextPage int `json:"nextPage"`
Total int `json:"total"`
TotalPage int `json:"totalPage"`
} `json:"data"`
Message string `json:"message"`
Success int `json:"success"`
}
type BrandInfoReq struct {
AppID string `json:"appId"`
Ids []string `json:"ids"`
}
type BrandInfoRes struct {
Code string `json:"code"`
Data []struct {
Desc string `json:"desc,omitempty"` //品牌描述
ID string `json:"id"` //
LogoURL string `json:"logoUrl,omitempty"` //logo
Name string `json:"name"` //品牌名称
PosterURL string `json:"posterUrl,omitempty"` //海报
} `json:"data"`
Message string `json:"message"`
Success int `json:"success"`
}
//获取品牌列表
func GetBrandList(ctx context.Context, page, limit int) (res *BrandListRes, err error) {
params := BrandListReq{
AppID: "",
Page: page,
Limit: limit,
}
result, err := post(ctx, "/brand/get_brand_list.do", params)
if nil != err {
return
}
err = json.Unmarshal([]byte(result), &res)
return
}
//获取品牌
func GetBrandInfo(ctx context.Context, ids []string) (res *BrandInfoRes, err error) {
params := BrandInfoReq{
AppID: "",
Ids: ids,
}
result, err := post(ctx, "/brand/get_brands.do", params)
if nil != err {
return
}
err = json.Unmarshal([]byte(result), &res)
return
}