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
80
81
package tm
import (
"context"
"encoding/json"
link "github.com/alibabacloud-go/linkedmall-20220531/v2/client"
"github.com/alibabacloud-go/tea/tea"
"github.com/gogf/gf/encoding/gjson"
)
type category struct {
}
var Category = category{}
type QueryMallCategoryListRes struct {
RequestId string `json:"RequestId"`
Message string `json:"Message"`
Model []struct {
CategoryId int `json:"CategoryId"`
ParentId int `json:"ParentId"`
Leaf bool `json:"Leaf"`
Name string `json:"Name"`
} `json:"Model"`
Code string `json:"Code"`
Success bool `json:"Success"`
}
//区域库存商品详情
func (s *category) QueryMallCategoryList(ctx context.Context,item int64) (res *QueryMallCategoryListRes, err error) {
client,err :=initClient()
if err!=nil{
return
}
if client==nil{
return
}
result ,err :=client.QueryMallCategoryList(&link.QueryMallCategoryListRequest{
DistributionMallId: tea.String(server.DistributionMallId),
DistributorId: tea.String(server.DistributorId),
CategoryId: tea.Int64(item),
TenantId: tea.String(server.TenantId),
})
if result==nil{
return
}
log(ctx,gjson.New(item).MustToJsonString(),result.Body,err)
if err!=nil{
return
}
a,_ :=json.Marshal(result.Body)
if err = json.Unmarshal([]byte(a), &res); err != nil {
return
}
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
//}