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
package tmv3
import (
"context"
"github.com/alibabacloud-go/linkedmall-20230930/v2/client"
"github.com/alibabacloud-go/tea/tea"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/os/gtime"
)
type GoodsSkuReq struct {
DivisionCode string
PurchaserId string
SkuQueryParams []GoodsSkuItem
}
type GoodsSkuItem struct {
ProductId string `json:"productId"`
SkuId string `json:"skuId"`
}
type GoodsSkuRes struct {
RequestId string `json:"requestId"`
SkuSaleInfos []struct {
CanSell bool `json:"canSell"`
FuzzyQuantity string `json:"fuzzyQuantity"`
MarkPrice int `json:"markPrice"`
Price int `json:"price"`
ProductId string `json:"productId"`
Quantity int `json:"quantity"`
ShopId string `json:"shopId"`
SkuId string `json:"skuId"`
SkuStatus string `json:"skuStatus"`
Title string `json:"title"`
} `json:"skuSaleInfos"`
}
// Sku 批量查询选品池SKU销售信息
func (s goodsTm) Sku(ctx context.Context, req GoodsSkuReq) (res *GoodsSkuRes, err error) {
Start := gtime.TimestampMilli()
ctx = context.WithValue(ctx, "URI", "ListSelectionSkuSaleInfos")
defer func() {
Log(ctx, req, res, err, Start)
}()
if req.PurchaserId == "" {
req.PurchaserId = PurchaserId
}
Request := &client.ListSelectionSkuSaleInfosRequest{}
var Body = new(client.SkuSaleInfoListQuery)
Body.SetPurchaserId(req.PurchaserId)
if req.DivisionCode != "" {
Body.SetDivisionCode(req.DivisionCode)
}
var list []*client.SkuQueryParam
for _, item := range req.SkuQueryParams {
list = append(list, &client.SkuQueryParam{
ProductId: tea.String(item.ProductId),
SkuId: tea.String(item.SkuId),
})
}
Body.SetSkuQueryParams(list)
Request.SetBody(Body)
r, err := server.ListSelectionSkuSaleInfos(Request)
if err != nil {
return
}
err = gjson.New(r.Body).Scan(&res)
return
}