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
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 GoodsSpuReq struct {
DivisionCode string
PurchaserId string
ProductIds []string
}
type GoodsSpuRes struct {
ProductSaleInfos []struct {
CanSell bool `json:"canSell"`
FuzzyQuantity string `json:"fuzzyQuantity"`
LmItemId string `json:"lmItemId"`
ProductId string `json:"productId"`
ProductStatus string `json:"productStatus"`
Quantity int `json:"quantity"`
ShopId string `json:"shopId"`
Skus []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:"skus"`
Title string `json:"title"`
} `json:"productSaleInfos"`
RequestId string `json:"requestId"`
}
// Spu 批量查询选品池商品销售信息
func (s goodsTm) Spu(ctx context.Context, req GoodsSpuReq) (res *GoodsSpuRes, err error) {
Start := gtime.TimestampMilli()
ctx = context.WithValue(ctx, "URI", "ListSelectionProductSaleInfos")
defer func() {
Log(ctx, req, res, err, Start)
}()
if req.PurchaserId == "" {
req.PurchaserId = PurchaserId
}
Request := &client.ListSelectionProductSaleInfosRequest{}
var Body = new(client.ProductSaleInfoListQuery)
Body.SetPurchaserId(req.PurchaserId)
if req.DivisionCode != "" {
Body.SetDivisionCode(req.DivisionCode)
}
var list []*string
for _, item := range req.ProductIds {
list = append(list, tea.String(item))
}
Body.SetProductIds(list)
Request.SetBody(Body)
r, err := server.ListSelectionProductSaleInfos(Request)
if err != nil {
return
}
//
err = gjson.New(r.Body).Scan(&res)
return
}