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
package tm
import (
"context"
"github.com/gogf/gf/encoding/gjson"
)
type category struct {
}
var Category = category{}
type CategoryDetailRes struct {
Code string `json:"Code"` //成功 0000
Message string `json:"Message"`
RequestId string `json:"RequestId"`
CategoryList []struct {
CategoryId int `json:"CategoryId"`
Name string `json:"Name"`
} `json:"CategoryList"`
}
func (category) Detail(ctx context.Context, req string) (res *CategoryDetailRes, err error) {
method := "GetCategoryChain"
request := map[string]string{
"BizUid": server.BizUid,
"CategoryId": req,
}
result, err := post(ctx, method, request)
err = gjson.New(result).Scan(&res)
return
}
type CategoryListRes struct {
Code string `json:"Code"` //成功 0000
Message string `json:"Message"`
RequestId string `json:"RequestId"`
CategoryList struct {
Category []struct {
CategoryId int `json:"CategoryId"`
Name string `json:"Name"`
} `json:"Category"`
} `json:"CategoryList"`
}
func (category) List(ctx context.Context, req string) (res *CategoryListRes, err error) {
method := "GetCategoryList"
request := map[string]string{
"CategoryId": req,
}
result, err := post(ctx, method, request)
err = gjson.New(result).Scan(&res)
return
}