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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package suning
import (
"context"
"encoding/json"
)
type CmmdtyInfoList struct {
SupplierCode string `json:"supplierCode"`
SkuId string `json:"skuId"`
}
type GoodsListPriceReq struct {
SnRequest struct {
SnBody struct {
QueryListpageprice struct {
CityCode string `json:"cityCode"`
CmmdtyInfoList []*CmmdtyInfoList `json:"cmmdtyInfoList"`
ChannelCode string `json:"channelCode"`
} `json:"queryListpageprice"`
} `json:"sn_body"`
} `json:"sn_request"`
}
type GoodsListPriceRes struct {
SnResponseContent struct {
SnBody struct {
QueryListpageprice struct {
Data []struct {
ReturnCode string `json:"returnCode"`
ReturnMsg string `json:"returnMsg"`
DeliveryMode string `json:"deliveryMode"`
CityCode string `json:"cityCode"`
Price string `json:"price"`
NetPrice string `json:"netPrice"`
State string `json:"state"`
SupplierCode string `json:"supplierCode"`
SkuId string `json:"skuId"`
} `json:"data"`
} `json:"queryListpageprice"`
} `json:"sn_body"`
} `json:"sn_responseContent"`
}
// 列表页查询价格库存
func GetGoodsListPrice(ctx context.Context, goodsList []*CmmdtyInfoList, cityCode string) (res GoodsListPriceRes, err error) {
params := GoodsListPriceReq{}
params.SnRequest.SnBody.QueryListpageprice.CmmdtyInfoList = goodsList
params.SnRequest.SnBody.QueryListpageprice.CityCode = cityCode
params.SnRequest.SnBody.QueryListpageprice.ChannelCode = server.ChannelCode
result, err := post(ctx, "suning.sngoods.listpageprice.query", params)
if nil != err {
return
}
err = json.Unmarshal([]byte(result), &res)
return
}
type CmmdtyCatInfoList struct {
Num string `json:"num"`
SupplierCode string `json:"supplierCode"`
SkuId string `json:"skuId"`
}
type GoodsCatPriceReq struct {
SnRequest struct {
SnBody struct {
QueryShoppingcartprice struct {
RegionCode string `json:"regionCode"`
CityCode string `json:"cityCode"`
CmmdtyInfoList []*CmmdtyCatInfoList `json:"cmmdtyInfoList"`
ChannelCode string `json:"channelCode"`
} `json:"queryShoppingcartprice"`
} `json:"sn_body"`
} `json:"sn_request"`
}
type GoodsCatPriceRes struct {
SnResponseContent struct {
SnBody struct {
QueryShoppingcartprice struct {
Data []struct {
ReturnCode string `json:"returnCode"`
RegionCode string `json:"regionCode"`
ReturnMsg string `json:"returnMsg"`
CityCode string `json:"cityCode"`
Price string `json:"price"`
ArrivalQty string `json:"arrivalQty"`
State string `json:"state"`
SupplierCode string `json:"supplierCode"`
DeliveryOrNot string `json:"deliveryOrNot"`
SkuId string `json:"skuId"`
} `json:"data"`
} `json:"queryShoppingcartprice"`
} `json:"sn_body"`
} `json:"sn_responseContent"`
}
// 购物车查询价格库存
func GetGoodsCatPrice(ctx context.Context, goodsList []*CmmdtyCatInfoList, cityCode string) (res GoodsCatPriceRes, err error) {
params := GoodsCatPriceReq{}
params.SnRequest.SnBody.QueryShoppingcartprice.CmmdtyInfoList = goodsList
params.SnRequest.SnBody.QueryShoppingcartprice.CityCode = cityCode
params.SnRequest.SnBody.QueryShoppingcartprice.ChannelCode = server.ChannelCode
result, err := post(ctx, "suning.sngoods.listpageprice.query", params)
if nil != err {
return
}
err = json.Unmarshal([]byte(result), &res)
return
}