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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
package ikc
import (
"context"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/frame/g"
)
type goodsIkc struct {
}
//Goods 商品
var Goods = goodsIkc{}
type GoodsListReq struct {
LiveId string `json:"liveId"`
PageNo int `json:"pageNo"`
PageSize int `json:"pageSize"`
SortedType int `json:"sortedType"` //顺序 1:正序,2倒序 默认2
SortedModel int `json:"sortedModel"` //排序模式 1:默认(售罄沉底、运营指定顺序、上架次数、播号) 3:销量(累计30天) 6:上新次数 7:销售价 9:折扣 10:开始时间 默认排序模式只有倒序
}
type goodsListRes struct {
ResultCode int `json:"resultCode"`
ResultMessage string `json:"resultMessage"`
Data struct {
Total int `json:"total"`
ProductList []struct {
ActivityId string `json:"activityId"`
ProductId string `json:"productId"`
Status int `json:"status"`
Brand string `json:"brand"`
BrandUrl string `json:"brandUrl"`
TagPrice float64 `json:"tagPrice"`
CategoryCode string `json:"categoryCode"`
Category string `json:"category"`
Picture []string `json:"picture"`
BrandSizeUrl string `json:"brandSizeUrl"`
Price float64 `json:"price"`
Name string `json:"name"`
SettlementPrice float64 `json:"settlementPrice"`
Profit float64 `json:"profit"`
Description string `json:"description"`
Pinlei1 string `json:"pinlei1"`
Pinlei1Name string `json:"pinlei1name"`
Pinlei2 string `json:"pinlei2"`
Pinlei2Name string `json:"pinlei2name"`
VideoUrl string `json:"videoUrl"`
VideoCoverUrl string `json:"videoCoverUrl"`
StyleNo string `json:"styleNo"`
MerStyleNo string `json:"merStyleNo"`
ProductNum string `json:"productNum"`
SupportExchange int `json:"supportExchange"`
Color string `json:"color"`
BaseProperties []interface{} `json:"baseProperties"`
MeasureProperties []interface{} `json:"measureProperties"`
ProductMateria []interface{} `json:"productMateria"`
SkuList []struct {
SkuId string `json:"skuId"`
AttributeList []struct {
AttributeName string `json:"attributeName"`
AttributeValue string `json:"attributeValue"`
} `json:"attributeList"`
LeftStoreNum int `json:"leftStoreNum"`
} `json:"skuList"`
SkusAttributeList []struct {
AttributeName string `json:"attributeName"`
AttributeValue string `json:"attributeValue"`
} `json:"skusAttributeList"`
ProfitAdditional struct {
MarketId string `json:"marketId"`
ProfitAdditional float64 `json:"profitAdditional"`
} `json:"profitAdditional"`
PromoTags []struct {
Code string `json:"code"`
Name string `json:"name"`
Type int `json:"type"`
} `json:"promoTags"`
RefundInsurance bool `json:"refundInsurance"`
IsExchangeRefundGoods int `json:"isExchangeRefundGoods"`
} `json:"productList"`
} `json:"data"`
}
//List 列表
func (*goodsIkc) List(ctx context.Context, req GoodsListReq) (res *goodsListRes, err error) {
method := "product/list"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
type GoodsDetailRes struct {
ResultCode int `json:"resultCode"`
ResultMessage string `json:"resultMessage"`
Data struct {
Product struct {
ActivityId string `json:"activityId"`
ProductId string `json:"productId"`
Status int `json:"status"`
Brand string `json:"brand"`
BrandUrl string `json:"brandUrl"`
TagPrice float64 `json:"tagPrice"`
CategoryCode string `json:"categoryCode"`
Category string `json:"category"`
Picture []string `json:"picture"`
BrandSizeUrl string `json:"brandSizeUrl"`
Price float64 `json:"price"`
Name string `json:"name"`
SettlementPrice float64 `json:"settlementPrice"`
Profit float64 `json:"profit"`
Description string `json:"description"`
Pinlei1 string `json:"pinlei1"`
Pinlei1Name string `json:"pinlei1name"`
Pinlei2 string `json:"pinlei2"`
Pinlei2Name string `json:"pinlei2name"`
VideoUrl string `json:"videoUrl"`
VideoCoverUrl string `json:"videoCoverUrl"`
StyleNo string `json:"styleNo"`
MerStyleNo string `json:"merStyleNo"`
ProductNum string `json:"productNum"`
SupportExchange int `json:"supportExchange"`
Color string `json:"color"`
BaseProperties []struct {
AttributeName string `json:"attributeName"`
AttributeValue string `json:"attributeValue"`
} `json:"baseProperties"`
MeasureProperties []struct {
AttributeName string `json:"attributeName"`
AttributeValue string `json:"attributeValue"`
} `json:"measureProperties"`
ProductMateria []interface{} `json:"productMateria"`
SkuList []struct {
SkuId string `json:"skuId"`
AttributeList []struct {
AttributeName string `json:"attributeName"`
AttributeValue string `json:"attributeValue"`
} `json:"attributeList"`
LeftStoreNum int `json:"leftStoreNum"`
} `json:"skuList"`
SkusAttributeList []struct {
AttributeName string `json:"attributeName"`
AttributeValue string `json:"attributeValue"`
} `json:"skusAttributeList"`
Weight string `json:"weight"`
Volume string `json:"volume"`
ProfitAdditional struct {
MarketId string `json:"marketId"`
ProfitAdditional float64 `json:"profitAdditional"`
} `json:"profitAdditional"`
PromoTags []struct {
Code string `json:"code"`
Name string `json:"name"`
Type int `json:"type"`
} `json:"promoTags"`
RefundInsurance bool `json:"refundInsurance"`
IsExchangeRefundGoods int `json:"isExchangeRefundGoods"`
} `json:"product"`
} `json:"data"`
}
//Detail 详情
func (*goodsIkc) Detail(ctx context.Context, GoodsID, activeId string) (res *GoodsDetailRes, err error) {
method := "product/detail"
result, err := post(ctx, method, g.Map{
"productId": GoodsID,
"activeId": activeId,
})
_ = gjson.New(result).Scan(&res)
return
}
type GoodsStockReq struct {
LiveId string `json:"liveId"`
SkuIds []string `json:"skuIds"`
}
type GoodsStockRes struct {
ResultCode int `json:"resultCode"`
ResultMessage string `json:"resultMessage"`
Data struct {
LiveId string `json:"liveId"`
InventoryList []struct {
SkuId string `json:"skuId"`
CurrentStock string `json:"currentStock"`
} `json:"inventoryList"`
} `json:"data"`
}
//Stock 库存
func (*goodsIkc) Stock(ctx context.Context, req GoodsStockReq) (res *GoodsStockRes, err error) {
method := "inventory/query"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
type GoodsBatchReq struct {
Params []GoodsBatchItem `json:"params"`
}
type GoodsBatchItem struct {
GoodsID string `json:"productId"`
ActivityId string `json:"activityId"`
}
type GoodsBatchRes struct {
ResultCode int `json:"resultCode"`
ResultMessage string `json:"resultMessage"`
Data struct {
Products []struct {
ActivityId string `json:"activityId"`
ProductId string `json:"productId"`
Status int `json:"status"`
Brand string `json:"brand"`
BrandUrl string `json:"brandUrl"`
TagPrice float64 `json:"tagPrice"`
CategoryCode string `json:"categoryCode"`
Category string `json:"category"`
Price float64 `json:"price"`
Name string `json:"name"`
SettlementPrice float64 `json:"settlementPrice"`
Profit float64 `json:"profit"`
Description string `json:"description"`
Pinlei1 string `json:"pinlei1"`
Pinlei1Name string `json:"pinlei1name"`
Pinlei2 string `json:"pinlei2"`
Pinlei2Name string `json:"pinlei2name"`
StyleNo string `json:"styleNo"`
MerStyleNo string `json:"merStyleNo"`
ProductNum string `json:"productNum"`
SupportExchange int `json:"supportExchange"`
Color string `json:"color"`
SkuList []struct {
SkuId string `json:"skuId"`
AttributeList []struct {
AttributeName string `json:"attributeName"`
AttributeValue string `json:"attributeValue"`
} `json:"attributeList"`
LeftStoreNum int `json:"leftStoreNum"`
} `json:"skuList"`
SkusAttributeList []struct {
AttributeName string `json:"attributeName"`
AttributeValue string `json:"attributeValue"`
} `json:"skusAttributeList"`
ProfitAdditional struct {
MarketId string `json:"marketId"`
ProfitAdditional float64 `json:"profitAdditional"`
} `json:"profitAdditional"`
PromoTags []struct {
Code string `json:"code"`
Name string `json:"name"`
Type int `json:"type"`
} `json:"promoTags"`
RefundInsurance bool `json:"refundInsurance"`
IsExchangeRefundGoods int `json:"isExchangeRefundGoods"`
} `json:"products"`
} `json:"data"`
}
//Batch 批量查询
func (*goodsIkc) Batch(ctx context.Context, req GoodsBatchReq) (res *GoodsBatchRes, err error) {
method := "product/listByIds"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}
type GoodsFreightReq struct {
Province string `json:"province"`
City string `json:"city"`
Area string `json:"area"`
List []GoodsFreightItem `json:"productList"`
}
type GoodsFreightItem struct {
LiveId string `json:"liveId"` //活动 ID
ProductId string `json:"productId"` //商品 ID
Count string `json:"count"` //商品数量
}
type GoodsFreightRes struct {
ResultCode int `json:"resultCode"`
ResultMessage string `json:"resultMessage"`
Data struct {
ProductList []struct {
LiveId string `json:"liveId"`
ProductId string `json:"productId"`
AllowDeliver int `json:"allowDeliver"`
DenyReason string `json:"denyReason,omitempty"`
} `json:"productList"`
FreightList []struct {
Freight float64 `json:"freight"`
ProductList []struct {
LiveId string `json:"liveId"`
ProductId string `json:"productId"`
Count int `json:"count"`
} `json:"productList"`
} `json:"freightList"`
} `json:"data"`
}
//Freight 查询运费
func (*goodsIkc) Freight(ctx context.Context, req GoodsFreightReq) (res *GoodsFreightRes, err error) {
method := "freight/query"
result, err := post(ctx, method, req)
_ = gjson.New(result).Scan(&res)
return
}