lingxingapi 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of lingxingapi might be problematic. Click here for more details.
- lingxingapi/__init__.py +7 -0
- lingxingapi/ads/__init__.py +0 -0
- lingxingapi/ads/api.py +5946 -0
- lingxingapi/ads/param.py +192 -0
- lingxingapi/ads/route.py +134 -0
- lingxingapi/ads/schema.py +2615 -0
- lingxingapi/api.py +443 -0
- lingxingapi/base/__init__.py +0 -0
- lingxingapi/base/api.py +409 -0
- lingxingapi/base/param.py +59 -0
- lingxingapi/base/route.py +11 -0
- lingxingapi/base/schema.py +198 -0
- lingxingapi/basic/__init__.py +0 -0
- lingxingapi/basic/api.py +466 -0
- lingxingapi/basic/param.py +72 -0
- lingxingapi/basic/route.py +20 -0
- lingxingapi/basic/schema.py +212 -0
- lingxingapi/errors.py +143 -0
- lingxingapi/fba/__init__.py +0 -0
- lingxingapi/fba/api.py +1691 -0
- lingxingapi/fba/param.py +250 -0
- lingxingapi/fba/route.py +30 -0
- lingxingapi/fba/schema.py +987 -0
- lingxingapi/fields.py +50 -0
- lingxingapi/finance/__init__.py +0 -0
- lingxingapi/finance/api.py +3091 -0
- lingxingapi/finance/param.py +616 -0
- lingxingapi/finance/route.py +44 -0
- lingxingapi/finance/schema.py +1243 -0
- lingxingapi/product/__init__.py +0 -0
- lingxingapi/product/api.py +2643 -0
- lingxingapi/product/param.py +934 -0
- lingxingapi/product/route.py +49 -0
- lingxingapi/product/schema.py +1004 -0
- lingxingapi/purchase/__init__.py +0 -0
- lingxingapi/purchase/api.py +496 -0
- lingxingapi/purchase/param.py +126 -0
- lingxingapi/purchase/route.py +11 -0
- lingxingapi/purchase/schema.py +215 -0
- lingxingapi/sales/__init__.py +0 -0
- lingxingapi/sales/api.py +3200 -0
- lingxingapi/sales/param.py +723 -0
- lingxingapi/sales/route.py +70 -0
- lingxingapi/sales/schema.py +1718 -0
- lingxingapi/source/__init__.py +0 -0
- lingxingapi/source/api.py +1799 -0
- lingxingapi/source/param.py +176 -0
- lingxingapi/source/route.py +38 -0
- lingxingapi/source/schema.py +1011 -0
- lingxingapi/tools/__init__.py +0 -0
- lingxingapi/tools/api.py +291 -0
- lingxingapi/tools/param.py +73 -0
- lingxingapi/tools/route.py +8 -0
- lingxingapi/tools/schema.py +169 -0
- lingxingapi/utils.py +411 -0
- lingxingapi/warehourse/__init__.py +0 -0
- lingxingapi/warehourse/api.py +1778 -0
- lingxingapi/warehourse/param.py +506 -0
- lingxingapi/warehourse/route.py +28 -0
- lingxingapi/warehourse/schema.py +926 -0
- lingxingapi-1.0.0.dist-info/METADATA +67 -0
- lingxingapi-1.0.0.dist-info/RECORD +65 -0
- lingxingapi-1.0.0.dist-info/WHEEL +5 -0
- lingxingapi-1.0.0.dist-info/licenses/LICENSE +22 -0
- lingxingapi-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,2643 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-c
|
|
2
|
+
import datetime
|
|
3
|
+
from typing import Literal
|
|
4
|
+
from lingxingapi import utils, errors
|
|
5
|
+
from lingxingapi.base.api import BaseAPI
|
|
6
|
+
from lingxingapi.base import param as base_param
|
|
7
|
+
from lingxingapi.base import schema as base_schema
|
|
8
|
+
from lingxingapi.product import param, route, schema
|
|
9
|
+
|
|
10
|
+
# Type Aliases ---------------------------------------------------------------------------------------------------------
|
|
11
|
+
PRODUCT_CODE_TYPE = Literal["UPC", "EAN", "ISBN"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# API ------------------------------------------------------------------------------------------------------------------
|
|
15
|
+
class ProductAPI(BaseAPI):
|
|
16
|
+
"""领星API `产品数据` 接口
|
|
17
|
+
|
|
18
|
+
## Notice
|
|
19
|
+
请勿直接实例化此类
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
async def Products(
|
|
23
|
+
self,
|
|
24
|
+
*,
|
|
25
|
+
lskus: str | list[str] | None = None,
|
|
26
|
+
sku_identifiers: str | list[str] | None = None,
|
|
27
|
+
update_start_time: str | int | datetime.date | datetime.datetime | None = None,
|
|
28
|
+
update_end_time: str | int | datetime.date | datetime.datetime | None = None,
|
|
29
|
+
create_start_time: str | int | datetime.date | datetime.datetime | None = None,
|
|
30
|
+
create_end_time: str | int | datetime.date | datetime.datetime | None = None,
|
|
31
|
+
offset: int | None = None,
|
|
32
|
+
length: int | None = None,
|
|
33
|
+
) -> schema.Products:
|
|
34
|
+
"""查询领星本地产品列表
|
|
35
|
+
|
|
36
|
+
## Docs
|
|
37
|
+
- 产品: [查询本地产品列表](https://apidoc.lingxing.com/#/docs/Product/ProductLists)
|
|
38
|
+
|
|
39
|
+
:param lskus `<'str/list'>`: 领星本地SKU或SKU列表, 默认 `None` (查询所有SKU)
|
|
40
|
+
:param sku_identifiers `<'str/list'>`: 领星本地SKU识别码或识别码列表, 默认 `None` (查询所有SKU识别码)
|
|
41
|
+
:param update_start_time `<'str/int/date/datetime'>`: 产品更新开始时间, 左闭右开, 默认 `None`
|
|
42
|
+
:param update_end_time `<'str/int/date/datetime'>`: 产品更新结束时间, 左闭右开, 默认 `None`
|
|
43
|
+
:param create_start_time `<'str/int/date/datetime'>`: 产品创建开始时间, 左闭右开, 默认 `None`
|
|
44
|
+
:param create_end_time `<'str/int/date/datetime'>`: 产品创建结束时间, 左闭右开, 默认 `None`
|
|
45
|
+
:param offset `<'int'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
46
|
+
:param length `<'int'>`: 分页长度, 最大值1000, 默认 `None` (使用: 1000)
|
|
47
|
+
:returns `<'Products'>`: 返回查询到的领星本地产品列表
|
|
48
|
+
```python
|
|
49
|
+
{
|
|
50
|
+
# 状态码
|
|
51
|
+
"code": 0,
|
|
52
|
+
# 提示信息
|
|
53
|
+
"message": "success",
|
|
54
|
+
# 错误信息
|
|
55
|
+
"errors": [],
|
|
56
|
+
# 请求ID
|
|
57
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
58
|
+
# 响应时间
|
|
59
|
+
"response_time": "2025-08-13 19:23:04",
|
|
60
|
+
# 响应数据量
|
|
61
|
+
"response_count": 2,
|
|
62
|
+
# 总数据量
|
|
63
|
+
"total_count": 2,
|
|
64
|
+
# 响应数据
|
|
65
|
+
"data": [
|
|
66
|
+
{
|
|
67
|
+
# 领星本地SKU [原字段 'sku']
|
|
68
|
+
"lsku": "LOCAL********",
|
|
69
|
+
# 领星本地SKU识别码
|
|
70
|
+
"sku_identifier": "S/N1234567890",
|
|
71
|
+
# 领星本地产品ID [原字段 'id']
|
|
72
|
+
"product_id": 1,
|
|
73
|
+
# 领星本地产品名称
|
|
74
|
+
"product_name": "P*********",
|
|
75
|
+
# 领星本地产品分类ID [原字段 'cid']
|
|
76
|
+
"category_id": 1,
|
|
77
|
+
# 领星本地产品分类名称
|
|
78
|
+
"category_name": "香薰机",
|
|
79
|
+
# 领星本地产品品牌ID
|
|
80
|
+
"brand_id": 1,
|
|
81
|
+
# 领星本地产品品牌名称
|
|
82
|
+
"brand_name": "BestTech",
|
|
83
|
+
# 产品图片链接 [原字段 'pic_url']
|
|
84
|
+
"image_url": "https://image.distributetop.com/****.jpeg",
|
|
85
|
+
# 是否为组合产品 (0: 否, 1: 是) [原字段 'is_combo']
|
|
86
|
+
"is_bundled": 0,
|
|
87
|
+
# 产品是否被启用 (0: 未启用, 1: 已启用) [原字段 'open_status']
|
|
88
|
+
"is_enabled": 1,
|
|
89
|
+
# 产品状态 (0: 停售, 1: 在售, 2: 开发中, 3: 清仓) [原字段 'status']
|
|
90
|
+
"status": 1,
|
|
91
|
+
# 产品状态描述 [原字段 'status_text']
|
|
92
|
+
"status_desc": "在售",
|
|
93
|
+
# 创建时间 (北京之间, 时间戳) [原字段 'create_time']
|
|
94
|
+
"create_time_ts": 1753330296,
|
|
95
|
+
# 更新时间 (北京时间, 时间戳) [原字段 'update_time']
|
|
96
|
+
"update_time_ts": 1753330796,
|
|
97
|
+
# 产品开发者用户ID (Account.user_id) [原字段 'product_developer_uid']
|
|
98
|
+
"product_developer_id": 10******,
|
|
99
|
+
# 产品开发者姓名 (Account.display_name) [原字段 'product_developer']
|
|
100
|
+
"product_developer_name": "超级管理员",
|
|
101
|
+
# 产品采购人用户ID (Account.user_id) [原字段 'cg_opt_uid']
|
|
102
|
+
"purchase_staff_id": 10******,
|
|
103
|
+
# 产品采购人姓名 (Account.display_name) [原字段 'cg_opt_username']
|
|
104
|
+
"purchase_staff_name": "超级管理员",
|
|
105
|
+
# 采购交期 (单位: 天) [原字段 'cg_delivery']
|
|
106
|
+
"purchase_delivery_time": 14,
|
|
107
|
+
# 采购运输成本 [原字段 'cg_transport_costs']
|
|
108
|
+
"purchase_shipping_costs": 0.0,
|
|
109
|
+
# 采购成本 [原字段 'cg_price']
|
|
110
|
+
"purchase_price": 100.0,
|
|
111
|
+
# 采购备注 [原字段 'purchase_remark']
|
|
112
|
+
"purchase_note": "",
|
|
113
|
+
# 供应商报价信息列表 [原字段 'supplier_quote']
|
|
114
|
+
"supplier_quotes": [
|
|
115
|
+
{
|
|
116
|
+
# 领星本地产品ID
|
|
117
|
+
"product_id": 4*****,
|
|
118
|
+
# 供应商ID
|
|
119
|
+
"supplier_id": 6***,
|
|
120
|
+
# 供应商名称
|
|
121
|
+
"supplier_name": "遵*****",
|
|
122
|
+
# 供应商编码
|
|
123
|
+
"supplier_code": "SU*****",
|
|
124
|
+
# 供应商等级 [原字段 'level_text']
|
|
125
|
+
"supplier_level": "",
|
|
126
|
+
# 供应商员工数 [原字段 'employees_text']
|
|
127
|
+
"supplier_employees": "",
|
|
128
|
+
# 供应商产品链接 [原字段 'supplier_product_url']
|
|
129
|
+
"supplier_product_urls": [],
|
|
130
|
+
# 供应商备注 [原字段 'remark']
|
|
131
|
+
"supplier_note": "",
|
|
132
|
+
# 是否是首选供应商 (0: 否, 1: 是) [原字段 'is_primary']
|
|
133
|
+
"is_primary_supplier": 1,
|
|
134
|
+
# 报价ID [原字段 'psq_id']
|
|
135
|
+
"quote_id": 21****************,
|
|
136
|
+
# 报价货币符号 [原字段 'cg_currency_icon']
|
|
137
|
+
"quote_currency_icon": "¥",
|
|
138
|
+
# 报价单价 [原字段 'cg_price']
|
|
139
|
+
"quote_price": 100.0,
|
|
140
|
+
# 报价交期 (单位: 天) [原字段 'quote_cg_delivery']
|
|
141
|
+
"quote_delivery_time": 14,
|
|
142
|
+
# 报价备注 [原字段 'quote_remark']
|
|
143
|
+
"quote_note": "",
|
|
144
|
+
# 报价列表 [原字段 'quotes']
|
|
145
|
+
"quotes": [
|
|
146
|
+
{
|
|
147
|
+
# 报价货币代码 [原字段 'currency']
|
|
148
|
+
"currency_code": "CNY",
|
|
149
|
+
# 报价货币符号
|
|
150
|
+
"currency_icon": "¥",
|
|
151
|
+
# 报价是否含税 (0: 否, 1: 是) [原字段 'is_tax']
|
|
152
|
+
"is_tax_inclusive": 1,
|
|
153
|
+
# 报价税率 (百分比)
|
|
154
|
+
"tax_rate": 5.0,
|
|
155
|
+
# 报价梯度 [原字段 'step_prices']
|
|
156
|
+
"price_tiers": [
|
|
157
|
+
{
|
|
158
|
+
# 最小订购量
|
|
159
|
+
"moq": 100,
|
|
160
|
+
# 报价 (不含税) [原字段 'price']
|
|
161
|
+
"price_excl_tax": 100.0,
|
|
162
|
+
# 报价 (含税)
|
|
163
|
+
"price_with_tax": 105.0,
|
|
164
|
+
},
|
|
165
|
+
...
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
...
|
|
169
|
+
],
|
|
170
|
+
},
|
|
171
|
+
...
|
|
172
|
+
],
|
|
173
|
+
# 多属性产品ID [原字段 'ps_id']
|
|
174
|
+
"spu_id": 1,
|
|
175
|
+
# 多属性产品名称 [原字段 'spu']
|
|
176
|
+
"spu_name": "香薰机",
|
|
177
|
+
# 产品属性列表 [原字段 'attribute']
|
|
178
|
+
"attributes": [
|
|
179
|
+
{
|
|
180
|
+
# 产品属性ID
|
|
181
|
+
"attr_id": 1,
|
|
182
|
+
# 产品属性名称
|
|
183
|
+
"attr_name": "颜色",
|
|
184
|
+
# 产品属性值
|
|
185
|
+
"attr_value": "红色",
|
|
186
|
+
},
|
|
187
|
+
...
|
|
188
|
+
],
|
|
189
|
+
# 产品标签列表 [原字段 'global_tags']
|
|
190
|
+
"tags": [
|
|
191
|
+
{
|
|
192
|
+
# 领星标签ID (GlobalTag.tag_id) [原字段 'global_tag_id']
|
|
193
|
+
"tag_id": "9*****************",
|
|
194
|
+
# 领星标签名称 (GlobalTag.tag_name) [原字段 'tag_name']
|
|
195
|
+
"tag_name": "重点款",
|
|
196
|
+
# 领星标签颜色 (如: "#FF0000") [原字段 'color']
|
|
197
|
+
"tag_color": "#3BB84C",
|
|
198
|
+
},
|
|
199
|
+
...
|
|
200
|
+
],
|
|
201
|
+
# 自定义字段
|
|
202
|
+
"custom_fields": [
|
|
203
|
+
{
|
|
204
|
+
# 自定义字段ID
|
|
205
|
+
"field_id": "20************",
|
|
206
|
+
# 自定义字段名称
|
|
207
|
+
"field_name": "字段名",
|
|
208
|
+
# 自定义字段值
|
|
209
|
+
"field_value": "字段值",
|
|
210
|
+
},
|
|
211
|
+
...
|
|
212
|
+
],
|
|
213
|
+
},
|
|
214
|
+
...
|
|
215
|
+
],
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
"""
|
|
219
|
+
url = route.PRODUCTS
|
|
220
|
+
# 解析并验证参数
|
|
221
|
+
args = {
|
|
222
|
+
"lskus": lskus,
|
|
223
|
+
"sku_identifiers": sku_identifiers,
|
|
224
|
+
"update_start_time": update_start_time,
|
|
225
|
+
"update_end_time": update_end_time,
|
|
226
|
+
"create_start_time": create_start_time,
|
|
227
|
+
"create_end_time": create_end_time,
|
|
228
|
+
"offset": offset,
|
|
229
|
+
"length": length,
|
|
230
|
+
}
|
|
231
|
+
try:
|
|
232
|
+
p = param.Products.model_validate(args)
|
|
233
|
+
except Exception as err:
|
|
234
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
235
|
+
|
|
236
|
+
# 发送请求
|
|
237
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
238
|
+
return schema.Products.model_validate(data)
|
|
239
|
+
|
|
240
|
+
async def ProductDetails(
|
|
241
|
+
self,
|
|
242
|
+
*,
|
|
243
|
+
lskus: str | list[str] | None = None,
|
|
244
|
+
sku_identifiers: str | list[str] | None = None,
|
|
245
|
+
product_ids: int | list[int] | None = None,
|
|
246
|
+
) -> schema.ProductDetails:
|
|
247
|
+
"""批量查询领星本地产品详情
|
|
248
|
+
|
|
249
|
+
## Docs
|
|
250
|
+
- 产品: [批量查询本地产品详情](https://apidoc.lingxing.com/#/docs/Product/batchGetProductInfo)
|
|
251
|
+
|
|
252
|
+
:param lskus `<'str/list'>`: 领星本地SKU或SKU列表,
|
|
253
|
+
默认 `None` (三码选一必填), 参数来源 `Product.lsku`
|
|
254
|
+
:param sku_identifiers `<'str/list'>`: 领星本地SKU识别码或识别码列表,
|
|
255
|
+
默认 `None` (三码选一必填), 参数来源 `Product.sku_identifier`
|
|
256
|
+
:param product_ids `<'int/list'>`: 领星本地产品ID或产品ID列表,
|
|
257
|
+
默认 `None` (三码选一必填), 参数来源 `Product.product_id`
|
|
258
|
+
:returns `<'ProductDetails'>`: 返回查询到的领星本地产品详情列表
|
|
259
|
+
```python
|
|
260
|
+
{
|
|
261
|
+
# 状态码
|
|
262
|
+
"code": 0,
|
|
263
|
+
# 提示信息
|
|
264
|
+
"message": "success",
|
|
265
|
+
# 错误信息
|
|
266
|
+
"errors": [],
|
|
267
|
+
# 请求ID
|
|
268
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
269
|
+
# 响应时间
|
|
270
|
+
"response_time": "2025-08-13 19:23:04",
|
|
271
|
+
# 响应数据量
|
|
272
|
+
"response_count": 2,
|
|
273
|
+
# 总数据量
|
|
274
|
+
"total_count": 2,
|
|
275
|
+
# 响应数据
|
|
276
|
+
"data": [
|
|
277
|
+
{
|
|
278
|
+
# 领星本地SKU [原字段 'sku']
|
|
279
|
+
"lsku": "SKU********",
|
|
280
|
+
# 领星本地SKU识别码
|
|
281
|
+
"sku_identifier": "S/N1234567890",
|
|
282
|
+
# 领星本地产品ID [原字段 'id']
|
|
283
|
+
"product_id": 1,
|
|
284
|
+
# 领星本地产品名称
|
|
285
|
+
"product_name": "P*********",
|
|
286
|
+
# 领星本地产品分类ID [原字段 'cid']
|
|
287
|
+
"category_id": 1,
|
|
288
|
+
# 领星本地产品分类名称
|
|
289
|
+
"category_name": "香薰机",
|
|
290
|
+
# 领星本地产品品牌ID
|
|
291
|
+
"brand_id": 1,
|
|
292
|
+
# 领星本地产品品牌名称
|
|
293
|
+
"brand_name": "BestTech",
|
|
294
|
+
# 产品图片链接 [原字段 'pic_url']
|
|
295
|
+
"image_url": "https://image.distributetop.com/****.jpeg",
|
|
296
|
+
# 是否为组合产品 (0: 否, 1: 是) [原字段 'is_combo']
|
|
297
|
+
"is_bundled": 0,
|
|
298
|
+
# 组合产品所包含的单品列表 [原字段 'combo_product_list']
|
|
299
|
+
"bundle_items": [
|
|
300
|
+
{
|
|
301
|
+
# 领星本地SKU [原字段 'sku']
|
|
302
|
+
"lsku": "SKU********",
|
|
303
|
+
# 领星本地产品ID
|
|
304
|
+
"product_id": 1,
|
|
305
|
+
# 产品数量 [原字段 'quantity']
|
|
306
|
+
"product_qty": 100,
|
|
307
|
+
},
|
|
308
|
+
...
|
|
309
|
+
],
|
|
310
|
+
# 产品状态 (0: 停售, 1: 在售, 2: 开发中, 3: 清仓) [原字段 'status']
|
|
311
|
+
"status": 1,
|
|
312
|
+
# 产品型号 [原字段 'model']
|
|
313
|
+
"product_model": "AO-1234",
|
|
314
|
+
# 产品单位 [原字段 'unit']
|
|
315
|
+
"product_unit": "套",
|
|
316
|
+
# 产品描述 [原字段 'description']
|
|
317
|
+
"product_description": "<p>AO-1234</p>",
|
|
318
|
+
# 产品图片列表 [原字段 'picture_list']
|
|
319
|
+
"product_images": [
|
|
320
|
+
{
|
|
321
|
+
# 图片链接 [原字段 'pic_url']
|
|
322
|
+
"image_url": "https://image.distributetop.com/****.jpeg",
|
|
323
|
+
# 是否为主图 (0: 否, 1: 是)
|
|
324
|
+
"is_primary": 1,
|
|
325
|
+
},
|
|
326
|
+
...
|
|
327
|
+
],
|
|
328
|
+
# 产品特殊属性列表 [原字段 'special_attr']
|
|
329
|
+
# (1: 含电, 2: 纯电, 3: 液体, 4: 粉末, 5: 膏体, 6: 带磁)
|
|
330
|
+
"product_special_attrs": [3],
|
|
331
|
+
# 产品开发者用户ID (Account.user_id) [原字段 'product_developer_uid']
|
|
332
|
+
"product_developer_id": 1,
|
|
333
|
+
# 产品开发者姓名 (Account.display_name) [原字段 'product_developer']
|
|
334
|
+
"product_developer_name": "超级管理员",
|
|
335
|
+
# 产品采购人姓名 (Account.display_name) [原字段 'cg_opt_username']
|
|
336
|
+
"purchase_staff_name": "超级管理员",
|
|
337
|
+
# 采购交期 (单位: 天) [原字段 'cg_delivery']
|
|
338
|
+
"purchase_delivery_time": 14,
|
|
339
|
+
# 采购价格货币代码 [原字段 'currency']
|
|
340
|
+
"purchase_currency_code": "USD",
|
|
341
|
+
# 采购价格 [原字段 'cg_price']
|
|
342
|
+
"purchase_price": 100.0,
|
|
343
|
+
# 采购备注 [原字段 'purchase_remark']
|
|
344
|
+
"purchase_note": "",
|
|
345
|
+
# 采购产品材质 [原字段 'cg_product_material']
|
|
346
|
+
"product_material": "塑料",
|
|
347
|
+
# 采购产品总重 (单位: G) [原字段 'cg_product_gross_weight']
|
|
348
|
+
"product_gross_weight": 18.0,
|
|
349
|
+
# 采购产品净重 (单位: G) [原字段 'cg_product_net_weight']
|
|
350
|
+
"product_net_weight": 180.0,
|
|
351
|
+
# 采购产品长度 (单位: CM) [原字段 'cg_product_length']
|
|
352
|
+
"product_length": 7.5,
|
|
353
|
+
# 采购产品宽度 (单位: CM) [原字段 'cg_product_width']
|
|
354
|
+
"product_width": 7.5,
|
|
355
|
+
# 采购产品高度 (单位: CM) [原字段 'cg_product_height']
|
|
356
|
+
"product_height": 7.0,
|
|
357
|
+
# 采购包装长度 (单位: CM) [原字段 'cg_package_length']
|
|
358
|
+
"package_length": 7.5,
|
|
359
|
+
# 采购包装宽度 (单位: CM) [原字段 'cg_package_width']
|
|
360
|
+
"package_width": 7.5,
|
|
361
|
+
# 采购包装高度 (单位: CM) [原字段 'cg_package_height']
|
|
362
|
+
"package_height": 7.0,
|
|
363
|
+
# 采购外箱重量 (单位: KG) [原字段 'cg_box_weight']
|
|
364
|
+
"box_weight": 18.0,
|
|
365
|
+
# 采购外箱长度 (单位: CM) [原字段 'cg_box_length']
|
|
366
|
+
"box_length": 50.0,
|
|
367
|
+
# 采购外箱宽度 (单位: CM) [原字段 'cg_box_width']
|
|
368
|
+
"box_width": 50.0,
|
|
369
|
+
# 采购外箱高度 (单位: CM) [原字段 'cg_box_height']
|
|
370
|
+
"box_height": 50.0,
|
|
371
|
+
# 采购外箱数量 [原字段 'cg_box_pcs']
|
|
372
|
+
"box_qty": 1,
|
|
373
|
+
# 供应商报价信息列表 [原字段 'supplier_quote']
|
|
374
|
+
"supplier_quotes": [
|
|
375
|
+
{
|
|
376
|
+
# 领星本地产品ID
|
|
377
|
+
"product_id": 4*****,
|
|
378
|
+
# 供应商ID
|
|
379
|
+
"supplier_id": 6***,
|
|
380
|
+
# 供应商名称
|
|
381
|
+
"supplier_name": "遵*****",
|
|
382
|
+
# 供应商编码
|
|
383
|
+
"supplier_code": "SU*****",
|
|
384
|
+
# 供应商等级 [原字段 'level_text']
|
|
385
|
+
"supplier_level": "",
|
|
386
|
+
# 供应商员工数 [原字段 'employees_text']
|
|
387
|
+
"supplier_employees": "",
|
|
388
|
+
# 供应商产品链接 [原字段 'supplier_product_url']
|
|
389
|
+
"supplier_product_urls": [],
|
|
390
|
+
# 供应商备注 [原字段 'remark']
|
|
391
|
+
"supplier_note": "",
|
|
392
|
+
# 是否是首选供应商 (0: 否, 1: 是) [原字段 'is_primary']
|
|
393
|
+
"is_primary_supplier": 1,
|
|
394
|
+
# 报价ID [原字段 'psq_id']
|
|
395
|
+
"quote_id": 21****************,
|
|
396
|
+
# 报价货币符号 [原字段 'cg_currency_icon']
|
|
397
|
+
"quote_currency_icon": "¥",
|
|
398
|
+
# 报价单价 [原字段 'cg_price']
|
|
399
|
+
"quote_price": 100.0,
|
|
400
|
+
# 报价交期 (单位: 天) [原字段 'quote_cg_delivery']
|
|
401
|
+
"quote_delivery_time": 14,
|
|
402
|
+
# 报价备注 [原字段 'quote_remark']
|
|
403
|
+
"quote_note": "",
|
|
404
|
+
# 报价列表 [原字段 'quotes']
|
|
405
|
+
"quotes": [
|
|
406
|
+
{
|
|
407
|
+
# 报价货币代码 [原字段 'currency']
|
|
408
|
+
"currency_code": "CNY",
|
|
409
|
+
# 报价货币符号
|
|
410
|
+
"currency_icon": "¥",
|
|
411
|
+
# 报价是否含税 (0: 否, 1: 是) [原字段 'is_tax']
|
|
412
|
+
"is_tax_inclusive": 1,
|
|
413
|
+
# 报价税率 (百分比)
|
|
414
|
+
"tax_rate": 5.0,
|
|
415
|
+
# 报价梯度 [原字段 'step_prices']
|
|
416
|
+
"price_tiers": [
|
|
417
|
+
{
|
|
418
|
+
# 最小订购量
|
|
419
|
+
"moq": 100,
|
|
420
|
+
# 报价 (不含税) [原字段 'price']
|
|
421
|
+
"price_excl_tax": 100.0,
|
|
422
|
+
# 报价 (含税)
|
|
423
|
+
"price_with_tax": 105.0,
|
|
424
|
+
},
|
|
425
|
+
...
|
|
426
|
+
],
|
|
427
|
+
},
|
|
428
|
+
...
|
|
429
|
+
],
|
|
430
|
+
},
|
|
431
|
+
...
|
|
432
|
+
],
|
|
433
|
+
# 报关申报品名 (出口国) [原字段 'bg_customs_export_name']
|
|
434
|
+
"customs_export_name": "香薰机",
|
|
435
|
+
# 报关申报HS编码 (出口国) [原字段 'bg_export_hs_code']
|
|
436
|
+
"customs_export_hs_code": "8*********",
|
|
437
|
+
# 报关申报品名 (进口国) [原字段 'bg_customs_import_name']
|
|
438
|
+
"customs_import_name": "Essential oil diffuser",
|
|
439
|
+
# 报关申报单价 (进口国) [原字段 'bg_customs_import_price']
|
|
440
|
+
"customs_import_price": 1.2,
|
|
441
|
+
# 报关申报HS编码 (进口国) [原字段 'bg_import_hs_code']
|
|
442
|
+
"customs_import_hs_code": "",
|
|
443
|
+
# 报关信息 [原字段 'declaration']
|
|
444
|
+
"customs_declaration": {
|
|
445
|
+
# 报关申报品名 (出口国) [原字段 'customs_export_name']
|
|
446
|
+
"export_name": "",
|
|
447
|
+
# 报关申报HS编码 (出口国) [原字段 'customs_declaration_hs_code']
|
|
448
|
+
"export_hs_code": "",
|
|
449
|
+
# 报关申报品名 (进口国) [原字段 'customs_import_name']
|
|
450
|
+
"import_name": "",
|
|
451
|
+
# 报关申报单价 (进口国) [原字段 'customs_import_price']
|
|
452
|
+
"import_price": 1.2,
|
|
453
|
+
# 报关申报单价货币代码 (进口国) [原字段 'customs_import_price_currency']
|
|
454
|
+
"currency_code": "USD",
|
|
455
|
+
# 报关申报单价货币符号 (进口国) [原字段 'customs_import_price_currency_icon']
|
|
456
|
+
"currency_icon": "",
|
|
457
|
+
# 报关申报产品单位 [原字段 'customs_declaration_unit']
|
|
458
|
+
"unit": "套",
|
|
459
|
+
# 报关申报产品规格 [原字段 'customs_declaration_spec']
|
|
460
|
+
"specification": "香薰机",
|
|
461
|
+
# 报关申报产品原产地 [原字段 'customs_declaration_origin_produce']
|
|
462
|
+
"country_of_origin": "中国",
|
|
463
|
+
# 报关申报内陆来源 [原字段 'customs_declaration_inlands_source']
|
|
464
|
+
"source_from_inland": "中国",
|
|
465
|
+
# 报关申报免税 [原字段 'customs_declaration_exempt']
|
|
466
|
+
"exemption": "",
|
|
467
|
+
# 其他申报要素 [原字段 'other_declare_element']
|
|
468
|
+
"other_details": "",
|
|
469
|
+
},
|
|
470
|
+
"customs_clearance": {
|
|
471
|
+
# 清关内部编码 [原字段 'customs_clearance_internal_code']
|
|
472
|
+
"internal_code": "",
|
|
473
|
+
# 清关产品材质 [原字段 'customs_clearance_material']
|
|
474
|
+
"material": "",
|
|
475
|
+
# 清关产品用途 [原字段 'customs_clearance_usage']
|
|
476
|
+
"usage": "",
|
|
477
|
+
# 清关是否享受优惠 [原字段 'customs_clearance_preferential']
|
|
478
|
+
# (0: 未设置, 1: 不享惠, 2: 享惠, 3: 不确定)
|
|
479
|
+
"preferential": 2,
|
|
480
|
+
# 清关是否享受优惠描述 [原字段 'customs_clearance_preferential_text']
|
|
481
|
+
"preferential_desc": "",
|
|
482
|
+
# 清关品牌类型 [原字段 'customs_clearance_brand_type']
|
|
483
|
+
# (0: 未设置, 1: 无品牌, 2: 境内品牌[自主], 3: 境内品牌[收购], 4: 境外品牌[贴牌], 5: 境外品牌[其他])
|
|
484
|
+
"brand_type": 2,
|
|
485
|
+
# 清关品牌类型描述 [原字段 'customs_clearance_brand_type_text']
|
|
486
|
+
"brand_type_desc": "",
|
|
487
|
+
# 清关产品型号 [原字段 'customs_clearance_product_pattern']
|
|
488
|
+
"model": "香薰机",
|
|
489
|
+
# 清关产品图片链接 [原字段 'customs_clearance_pic_url']
|
|
490
|
+
"image_url": "https://image.umaicloud.com/****.jpg",
|
|
491
|
+
# 配货备注 [原字段 'allocation_remark']
|
|
492
|
+
"allocation_note": "",
|
|
493
|
+
# 织造类型 (0: 未设置, 1: 针织, 2: 梭织) [原字段 'weaving_mode']
|
|
494
|
+
"fabric_type": 0,
|
|
495
|
+
# 织造类型描述 [原字段 'weaving_mode_text']
|
|
496
|
+
"fabric_type_desc": "",
|
|
497
|
+
# 清关申报单价货币代码 [原字段 'customs_clearance_price_currency']
|
|
498
|
+
"clearance_currency_code": "CNY",
|
|
499
|
+
# 清关申报单价货币符号 [原字段 'customs_clearance_price_currency_icon']
|
|
500
|
+
"clearance_currency_icon": "",
|
|
501
|
+
# 清关申报单价 [原字段 'customs_clearance_price']
|
|
502
|
+
"clearance_price": 8.4,
|
|
503
|
+
# 清关税率 [原字段 'customs_clearance_tax_rate']
|
|
504
|
+
"clearance_tax_rate": 0.0,
|
|
505
|
+
# 清关HS编码 [原字段 'customs_clearance_hs_code']
|
|
506
|
+
"clearance_hs_code": "8*********",
|
|
507
|
+
# 清关备注 [原字段 'customs_clearance_remark']
|
|
508
|
+
"clearance_note": "",
|
|
509
|
+
},
|
|
510
|
+
"operators": [
|
|
511
|
+
{
|
|
512
|
+
# 负责人帐号ID (Account.user_id) [原字段 'permission_uid']
|
|
513
|
+
"user_id": 1,
|
|
514
|
+
# 负责人姓名 (Account.display_name) [原字段 'permission_user_name']
|
|
515
|
+
"user_name": "超级管理员",
|
|
516
|
+
},
|
|
517
|
+
...
|
|
518
|
+
],
|
|
519
|
+
# 产品标签列表 [原字段 'global_tags']
|
|
520
|
+
"tags": [
|
|
521
|
+
{
|
|
522
|
+
# 领星标签ID (GlobalTag.tag_id) [原字段 'global_tag_id']
|
|
523
|
+
"tag_id": "9*****************",
|
|
524
|
+
# 领星标签名称 (GlobalTag.tag_name) [原字段 'tag_name']
|
|
525
|
+
"tag_name": "重点款",
|
|
526
|
+
# 领星标签颜色 (如: "#FF0000") [原字段 'color']
|
|
527
|
+
"tag_color": "#3BB84C",
|
|
528
|
+
},
|
|
529
|
+
...
|
|
530
|
+
],
|
|
531
|
+
# 产品附件ID [原字段 'attachment_id']
|
|
532
|
+
"attachment_ids": [],
|
|
533
|
+
# 自定义字段
|
|
534
|
+
"custom_fields": [
|
|
535
|
+
{
|
|
536
|
+
# 自定义字段ID
|
|
537
|
+
"field_id": "20************",
|
|
538
|
+
# 自定义字段名称
|
|
539
|
+
"field_name": "字段名",
|
|
540
|
+
# 自定义字段值
|
|
541
|
+
"field_value": "字段值",
|
|
542
|
+
},
|
|
543
|
+
...
|
|
544
|
+
],
|
|
545
|
+
},
|
|
546
|
+
...
|
|
547
|
+
]
|
|
548
|
+
```
|
|
549
|
+
"""
|
|
550
|
+
url = route.PRODUCT_DETAILS
|
|
551
|
+
# 解析并验证参数
|
|
552
|
+
args = {
|
|
553
|
+
"lskus": lskus,
|
|
554
|
+
"sku_identifiers": sku_identifiers,
|
|
555
|
+
"product_ids": product_ids,
|
|
556
|
+
}
|
|
557
|
+
try:
|
|
558
|
+
p = param.ProductDetails.model_validate(args)
|
|
559
|
+
except Exception as err:
|
|
560
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
561
|
+
|
|
562
|
+
# 发送请求
|
|
563
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
564
|
+
return schema.ProductDetails.model_validate(data)
|
|
565
|
+
|
|
566
|
+
async def EnableProducts(self, *product_ids: int) -> base_schema.ResponseResult:
|
|
567
|
+
"""批量启用领星本地产品
|
|
568
|
+
|
|
569
|
+
## Docs
|
|
570
|
+
- 产品: [产品启用、禁用](https://apidoc.lingxing.com/#/docs/Product/productOperateBatch)
|
|
571
|
+
|
|
572
|
+
:param *product_ids `<'int'>`: 领星本地产品ID, 参数来源 `Product.product_id`
|
|
573
|
+
:returns `<'ResponseResult'>`: 返回启用产品结果
|
|
574
|
+
```python
|
|
575
|
+
{
|
|
576
|
+
# 状态码
|
|
577
|
+
"code": 0,
|
|
578
|
+
# 提示信息
|
|
579
|
+
"message": "success",
|
|
580
|
+
# 错误信息
|
|
581
|
+
"errors": [],
|
|
582
|
+
# 请求ID
|
|
583
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
584
|
+
# 响应时间
|
|
585
|
+
"response_time": "2025-08-13 19:23:04",
|
|
586
|
+
# 响应结果
|
|
587
|
+
"data": None
|
|
588
|
+
}
|
|
589
|
+
```
|
|
590
|
+
"""
|
|
591
|
+
url = route.ENABLE_DISABLE_PRODUCTS
|
|
592
|
+
# 解析并验证参数
|
|
593
|
+
try:
|
|
594
|
+
ids = utils.validate_array_of_unsigned_int(
|
|
595
|
+
product_ids, "领星本地产品ID product_ids"
|
|
596
|
+
)
|
|
597
|
+
except Exception as err:
|
|
598
|
+
raise errors.InvalidParametersError(
|
|
599
|
+
err, url, {"product_ids": product_ids}
|
|
600
|
+
) from err
|
|
601
|
+
|
|
602
|
+
# 发送请求
|
|
603
|
+
data = await self._request_with_sign(
|
|
604
|
+
"POST", url, body={"batch_status": "Enable", "product_ids": ids}
|
|
605
|
+
)
|
|
606
|
+
return base_schema.ResponseResult.model_validate(data)
|
|
607
|
+
|
|
608
|
+
async def DisableProducts(self, *product_ids: int) -> base_schema.ResponseResult:
|
|
609
|
+
"""批量禁用领星本地产品
|
|
610
|
+
|
|
611
|
+
## Docs
|
|
612
|
+
- 产品: [产品启用、禁用](https://apidoc.lingxing.com/#/docs/Product/productOperateBatch)
|
|
613
|
+
|
|
614
|
+
:param *product_ids `<'int'>`: 领星本地产品ID, 参数来源 `Product.product_id`
|
|
615
|
+
:returns `<'ResponseResult'>`: 返回禁用产品结果
|
|
616
|
+
```python
|
|
617
|
+
{
|
|
618
|
+
# 状态码
|
|
619
|
+
"code": 0,
|
|
620
|
+
# 提示信息
|
|
621
|
+
"message": "success",
|
|
622
|
+
# 错误信息
|
|
623
|
+
"errors": [],
|
|
624
|
+
# 请求ID
|
|
625
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
626
|
+
# 响应时间
|
|
627
|
+
"response_time": "2025-08-13 19:23:04",
|
|
628
|
+
# 响应结果
|
|
629
|
+
"data": None
|
|
630
|
+
}
|
|
631
|
+
```
|
|
632
|
+
"""
|
|
633
|
+
url = route.ENABLE_DISABLE_PRODUCTS
|
|
634
|
+
# 解析并验证参数
|
|
635
|
+
try:
|
|
636
|
+
ids = utils.validate_array_of_unsigned_int(
|
|
637
|
+
product_ids, "领星本地产品ID product_ids"
|
|
638
|
+
)
|
|
639
|
+
except Exception as err:
|
|
640
|
+
raise errors.InvalidParametersError(
|
|
641
|
+
err, url, {"product_ids": product_ids}
|
|
642
|
+
) from err
|
|
643
|
+
|
|
644
|
+
# 发送请求
|
|
645
|
+
data = await self._request_with_sign(
|
|
646
|
+
"POST", url, body={"batch_status": "Disable", "product_ids": ids}
|
|
647
|
+
)
|
|
648
|
+
return base_schema.ResponseResult.model_validate(data)
|
|
649
|
+
|
|
650
|
+
async def EditProduct(
|
|
651
|
+
self,
|
|
652
|
+
lsku: str,
|
|
653
|
+
product_name: str,
|
|
654
|
+
*,
|
|
655
|
+
sku_identifier: str | None = None,
|
|
656
|
+
category_id: int | None = None,
|
|
657
|
+
category_name: str | None = None,
|
|
658
|
+
brand_id: int | None = None,
|
|
659
|
+
brand_name: str | None = None,
|
|
660
|
+
product_model: str | None = None,
|
|
661
|
+
product_unit: str | None = None,
|
|
662
|
+
product_description: str | None = None,
|
|
663
|
+
product_images: dict | list[dict] | None = None,
|
|
664
|
+
product_special_attrs: int | list[int] | None = None,
|
|
665
|
+
status: int | None = None,
|
|
666
|
+
bundle_items: dict | list[dict] | None = None,
|
|
667
|
+
auto_bundle_purchase_price: int | None = None,
|
|
668
|
+
product_creator_id: int | None = None,
|
|
669
|
+
product_developer_id: int | None = None,
|
|
670
|
+
product_developer_name: str | None = None,
|
|
671
|
+
purchase_staff_id: int | None = None,
|
|
672
|
+
purchase_staff_name: str | None = None,
|
|
673
|
+
purchase_delivery_time: int | None = None,
|
|
674
|
+
purchase_price: int | float | None = None,
|
|
675
|
+
purchase_note: str | None = None,
|
|
676
|
+
product_material: str | None = None,
|
|
677
|
+
product_gross_weight: int | float | None = None,
|
|
678
|
+
product_net_weight: int | float | None = None,
|
|
679
|
+
product_length: int | float | None = None,
|
|
680
|
+
product_width: int | float | None = None,
|
|
681
|
+
product_height: int | float | None = None,
|
|
682
|
+
package_length: int | float | None = None,
|
|
683
|
+
package_width: int | float | None = None,
|
|
684
|
+
package_height: int | float | None = None,
|
|
685
|
+
box_weight: int | float | None = None,
|
|
686
|
+
box_length: int | float | None = None,
|
|
687
|
+
box_width: int | float | None = None,
|
|
688
|
+
box_height: int | float | None = None,
|
|
689
|
+
box_qty: int | None = None,
|
|
690
|
+
supplier_quotes: dict | list[dict] | None = None,
|
|
691
|
+
customs_export_name: str | None = None,
|
|
692
|
+
customs_export_hs_code: str | None = None,
|
|
693
|
+
customs_import_name: str | None = None,
|
|
694
|
+
customs_import_price: int | float | None = None,
|
|
695
|
+
customs_import_currency_code: str | None = None,
|
|
696
|
+
customs_declaration: dict | None = None,
|
|
697
|
+
customs_clearance: dict | None = None,
|
|
698
|
+
operator_ids: int | list[int] | None = None,
|
|
699
|
+
operator_update_mode: int | None = None,
|
|
700
|
+
) -> schema.EditProductResult:
|
|
701
|
+
"""添加/编辑本地产品
|
|
702
|
+
|
|
703
|
+
## Docs
|
|
704
|
+
- 产品: [添加/编辑本地产品](https://apidoc.lingxing.com/#/docs/Product/SetProduct)
|
|
705
|
+
|
|
706
|
+
## Notice
|
|
707
|
+
- 默认参数 `None` 表示留空或不修改, 只有传入的对应参数才会被更新
|
|
708
|
+
- 这点不同于 `EditSpuProduct` 方法, 其默认参数 `None` 表示重置设置,
|
|
709
|
+
所有没有传入的参数都将被重置为默认值
|
|
710
|
+
|
|
711
|
+
:param lsku `<'str'>`: 领星本地SKU, 参数来源 `Product.lsku`
|
|
712
|
+
:param product_name `<'str'>`: 领星本地产品名称, 参数来源 `Product.product_name`
|
|
713
|
+
:param sku_identifier `<'str'>`: 领星本地SKU识别码,
|
|
714
|
+
默认 `None` (留空或不修改), 不支持清除设置
|
|
715
|
+
:param category_id `<'int'>`: 领星本地产品分类ID (当ID与名称同时存在时, ID优先),
|
|
716
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
717
|
+
:param category_name `<'str'>`: 领星本地产品分类名称,
|
|
718
|
+
默认 `None` (留空或不修改)
|
|
719
|
+
:param brand_id `<'int'>`: 领星本地产品品牌ID (当ID与名称同时存在时, ID优先),
|
|
720
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
721
|
+
:param brand_name `<'str'>`: 领星本地产品品牌名称,
|
|
722
|
+
默认 `None` (留空或不修改)
|
|
723
|
+
:param product_model `<'str'>`: 产品型号,
|
|
724
|
+
默认 `None` (留空或不修改), 传入空字符串清除设置
|
|
725
|
+
:param product_unit `<'str'>`: 产品单位,
|
|
726
|
+
默认 `None` (留空或不修改), 传入空字符串清除设置
|
|
727
|
+
:param product_description `<'str'>`: 产品描述,
|
|
728
|
+
默认 `None` (留空或不修改), 传入空字符串清除设置
|
|
729
|
+
:param product_images `<'dict/list[dict]'>`: 产品图片列表,
|
|
730
|
+
默认 `None` (留空或不修改), 传入空列表清除设置
|
|
731
|
+
|
|
732
|
+
- 每个字典必须包含 `image_url` 和 `is_primary` 字段:
|
|
733
|
+
- 必填字段 `image_url` 图片链接, 必须为 str 类型
|
|
734
|
+
- 必填字段 `is_primary` 是否为主图, 必须为 int 类型 (0: 否, 1: 是)
|
|
735
|
+
|
|
736
|
+
:param product_special_attrs `<'int/list[int]'>`: 产品特殊属性
|
|
737
|
+
(1: 含电, 2: 纯电, 3: 液体, 4: 粉末, 5: 膏体, 6: 带磁),
|
|
738
|
+
默认 `None` (留空或不修改), 传入空列表清除设置
|
|
739
|
+
:param status `<'int'>`: 产品状态 (0: 停售, 1: 在售, 2: 开发中, 3: 清仓),
|
|
740
|
+
默认 `None` (默认1或不修改)
|
|
741
|
+
:param bundle_items `<'dict/list[dict]'>`: 组合产品所包含的单品列表,
|
|
742
|
+
默认 `None` (留空或不修改), 传入空列表清除设置
|
|
743
|
+
|
|
744
|
+
- 每个字典必须包含 `lsku` 和 `product_qty` 字段:
|
|
745
|
+
- 必填字段 `lsku` 领星本地SKU, 必须为 str 类型
|
|
746
|
+
- 必填字段 `product_qty` 子产品数量, 必须为 int 类型
|
|
747
|
+
|
|
748
|
+
:param auto_bundle_purchase_price `<'int'>`: 是否自动计算组合产品采购价格
|
|
749
|
+
(0: 手动, 1: 自动 | 选择自动后, 组合产品采购价格为所包含单品成本的总计),
|
|
750
|
+
默认 `None` (默认0或不修改)
|
|
751
|
+
:param product_creator_id `<'int'>`: 产品创建人ID,
|
|
752
|
+
默认 `None` (默认API账号ID或不修改)
|
|
753
|
+
:param product_developer_id `<'int'>`: 产品开发者用户ID (当ID与名称同时存在时, ID优先),
|
|
754
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
755
|
+
:param product_developer_name `<'str'>`: 产品开发者姓名,
|
|
756
|
+
默认 `None` (留空或不修改), 传入空字符串清除设置
|
|
757
|
+
:param purchase_staff_id `<'int'>`: 产品采购人用户ID (当ID与名称同时存在时, ID优先),
|
|
758
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
759
|
+
:param purchase_staff_name `<'str'>`: 产品采购人姓名,
|
|
760
|
+
默认 `None` (留空或不修改), 传入空字符串清除设置
|
|
761
|
+
:param purchase_delivery_time `<'int'>`: 采购交期 (单位: 天),
|
|
762
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
763
|
+
:param purchase_price `<'int/float'>`: 采购价格,
|
|
764
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
765
|
+
:param purchase_note `<'str'>`: 采购备注,
|
|
766
|
+
默认 `None` (留空或不修改), 传入空字符串清除设置
|
|
767
|
+
:param product_material `<'str'>`: 采购产品材质,
|
|
768
|
+
默认 `None` (留空或不修改), 传入空字符串清除设置
|
|
769
|
+
:param product_gross_weight `<'int/float'>`: 采购产品总重 (单位: G),
|
|
770
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
771
|
+
:param product_net_weight `<'int/float'>`: 采购产品净重 (单位: G),
|
|
772
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
773
|
+
:param product_length `<'int/float'>`: 采购产品长度 (单位: CM),
|
|
774
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
775
|
+
:param product_width `<'int/float'> : 采购产品宽度 (单位: CM),
|
|
776
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
777
|
+
:param product_height `<'int/float'>`: 采购产品高度 (单位: CM),
|
|
778
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
779
|
+
:param package_length `<'int/float'>`: 采购包装长度 (单位: CM),
|
|
780
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
781
|
+
:param package_width `<'int/float'>`: 采购包装宽度 (单位: CM),
|
|
782
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
783
|
+
:param package_height `<'int/float'>`: 采购包装高度 (单位: CM),
|
|
784
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
785
|
+
:param box_weight `<'int/float'>`: 采购外箱重量 (单位: KG),
|
|
786
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
787
|
+
:param box_length `<'int/float'>`: 采购外箱长度 (单位: CM),
|
|
788
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
789
|
+
:param box_width `<'int/float'>`: 采购外箱宽度 (单位: CM),
|
|
790
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
791
|
+
:param box_height `<'int/float'>`: 采购外箱高度 (单位: CM),
|
|
792
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
793
|
+
:param box_qty `<'int'>`: 采购外箱数量,
|
|
794
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
795
|
+
:param supplier_quotes `<'dict/list[dict]'>`: 供应商报价信息列表,
|
|
796
|
+
默认 `None` (留空或不修改), 传入空列表清除设置
|
|
797
|
+
|
|
798
|
+
- 每个字典必须包含 `supplier_id`, `is_primary` 和 `quotes` 字段:
|
|
799
|
+
- 必填字段 `supplier_id` 供应商ID, 必须为 int 类型, 参数来源 `Supplier.supplier_id`
|
|
800
|
+
- 必填字段 `is_primary` 是否为首选供应商, 必须为 int 类型 (0: 否, 1: 是)
|
|
801
|
+
- 必填字段 `quotes` 报价列表, 必须为 list[dict] 类型, 每个字典必须包含以下字段:
|
|
802
|
+
* 必填字段 `quotes.currency_code` 报价货币代码, 必须为 str 类型
|
|
803
|
+
* 必填字段 `quotes.is_tax_inclusive` 报价是否含税, 必须为 int 类型 (0: 否, 1: 是)
|
|
804
|
+
* 必填字段 `quotes.price_tiers` 报价梯度, 必须为 list[dict] 类型, 每个字典必须包含以下字段:
|
|
805
|
+
- 必填字段 `quotes.price_tiers.moq` 最小订购量, 必须为 int 类型
|
|
806
|
+
- 必填字段 `quotes.price_tiers.price_with_tax` 报价 (含税), 必须为 int/float 类型
|
|
807
|
+
* 选填字段 `quotes.tax_rate` 报价税率 (百分比), 如 5% 则传 5, 必须为 int/float 类型
|
|
808
|
+
- 选填字段 `quote_note` 报价备注, 必须为 str 类型
|
|
809
|
+
- 选填字段 `product_urls` 供应商产品链接, 必须为 list[str] 类型
|
|
810
|
+
|
|
811
|
+
:param customs_export_name `<'str'>`: 报关申报品名 (出口国),
|
|
812
|
+
默认 `None` (留空或不修改), 传入空字符串清除设置
|
|
813
|
+
:param customs_export_hs_code `<'str'>`: 报关申报HS编码 (出口国),
|
|
814
|
+
默认 `None` (留空或不修改), 传入空字符串清除设置
|
|
815
|
+
:param customs_import_name `<'str'>`: 报关申报品名 (进口国),
|
|
816
|
+
默认 `None` (留空或不修改), 传入空字符串清除设置
|
|
817
|
+
:param customs_import_price `<'int/float'>`: 报关申报单价 (进口国),
|
|
818
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
819
|
+
:param customs_import_currency_code `<'str'>`: 报关申报单价货币代码 (进口国),
|
|
820
|
+
默认 `None` (留空或不修改), 传入空字符串清除设置
|
|
821
|
+
:param customs_declaration `<'dict'>`: 报关信息,
|
|
822
|
+
默认 `None` (留空或不修改)
|
|
823
|
+
|
|
824
|
+
- 字典可选填字段:
|
|
825
|
+
- 选填字段 `unit` 报关申报产品单位, 必须为 str 类型, 传入空字符串清除设置
|
|
826
|
+
- 选填字段 `specification` 报关申报产品规格, 必须为 str 类型, 传入空字符串清除设置
|
|
827
|
+
- 选填字段 `country_of_origin` 报关申报产品原产地, 必须为 str 类型, 传入空字符串清除设置
|
|
828
|
+
- 选填字段 `source_from_inland` 报关申报内陆来源, 必须为 str 类型, 传入空字符串清除设置
|
|
829
|
+
- 选填字段 `exemption` 报关申报免税, 必须为 str 类型, 传入空字符串清除设置
|
|
830
|
+
|
|
831
|
+
:param customs_clearance `<'dict'>`: 清关信息,
|
|
832
|
+
默认 `None` (留空或不修改)
|
|
833
|
+
|
|
834
|
+
- 字典可选填字段:
|
|
835
|
+
- 选填字段 `internal_code` 清关内部编码, 必须为 str 类型, 传入空字符串清除设置
|
|
836
|
+
- 选填字段 `material` 清关产品材质, 必须为 str 类型, 传入空字符串清除设置
|
|
837
|
+
- 选填字段 `usage` 清关产品用途, 必须为 str 类型, 传入空字符串清除设置
|
|
838
|
+
- 选填字段 `preferential` 清关是否享受优惠, 必须为 int 类型
|
|
839
|
+
(0: 未设置, 1: 不享惠, 2: 享惠, 3: 不确定), 传入 `0` 清除设置
|
|
840
|
+
- 选填字段 `brand_type` 清关品牌类型, 必须为 int 类型,
|
|
841
|
+
(0: 未设置, 1: 无品牌, 2: 境内品牌[自主], 3: 境内品牌[收购], 4: 境外品牌[贴牌], 5: 境外品牌[其他]),
|
|
842
|
+
传入 `0` 清除设置
|
|
843
|
+
- 选填字段 `model` 清关产品型号, 必须为 str 类型, 传入空字符串清除设置
|
|
844
|
+
- 选填字段 `image_url` 清关产品图片链接, 必须为 str 类型, 传入空字符串清除设置
|
|
845
|
+
- 选填字段 `allocation_note` 配货备注, 必须为 str 类型, 传入空字符串清除设置
|
|
846
|
+
- 选填字段 `fabric_type` 织造类型, 必须为 int 类型 (0: 未设置, 1: 针织, 2: 梭织), 传入 `0` 清除设置
|
|
847
|
+
|
|
848
|
+
:param operator_ids `<'int/list[int]'>`: 负责人帐号ID列表 (Account.user_id),
|
|
849
|
+
默认 `None` (留空或不修改)
|
|
850
|
+
:param operator_update_mode `<'int'>`: 负责人ID的更新模式 (0: 覆盖, 1: 追加),
|
|
851
|
+
默认 `None` 追加模式
|
|
852
|
+
:returns `<'EditProductResult'>`: 返回编辑产品的结果
|
|
853
|
+
```python
|
|
854
|
+
{
|
|
855
|
+
# 状态码
|
|
856
|
+
"code": 0,
|
|
857
|
+
# 提示信息
|
|
858
|
+
"message": "success",
|
|
859
|
+
# 错误信息
|
|
860
|
+
"errors": [],
|
|
861
|
+
# 请求ID
|
|
862
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
863
|
+
# 响应时间
|
|
864
|
+
"response_time": "2025-08-13 19:23:04",
|
|
865
|
+
# 响应结果
|
|
866
|
+
"data": {
|
|
867
|
+
# 领星本地产品SKU [原字段 'sku']
|
|
868
|
+
"lsku": "SKU*******",
|
|
869
|
+
# 领星本地产品SKU识别码
|
|
870
|
+
"sku_identifier": "SN*******",
|
|
871
|
+
# 领星本地产品ID
|
|
872
|
+
"product_id": 1,
|
|
873
|
+
},
|
|
874
|
+
}
|
|
875
|
+
```
|
|
876
|
+
"""
|
|
877
|
+
url = route.EDIT_PRODUCT
|
|
878
|
+
# 解析并验证参数
|
|
879
|
+
args = {
|
|
880
|
+
"lsku": lsku,
|
|
881
|
+
"product_name": product_name,
|
|
882
|
+
"sku_identifier": sku_identifier,
|
|
883
|
+
"category_id": category_id,
|
|
884
|
+
"category_name": category_name,
|
|
885
|
+
"brand_id": brand_id,
|
|
886
|
+
"brand_name": brand_name,
|
|
887
|
+
"product_model": product_model,
|
|
888
|
+
"product_unit": product_unit,
|
|
889
|
+
"product_description": product_description,
|
|
890
|
+
"product_images": product_images,
|
|
891
|
+
"product_special_attrs": product_special_attrs,
|
|
892
|
+
"status": status,
|
|
893
|
+
"bundle_items": bundle_items,
|
|
894
|
+
"auto_bundle_purchase_price": auto_bundle_purchase_price,
|
|
895
|
+
"product_creator_id": product_creator_id,
|
|
896
|
+
"product_developer_id": product_developer_id,
|
|
897
|
+
"product_developer_name": product_developer_name,
|
|
898
|
+
"purchase_staff_id": purchase_staff_id,
|
|
899
|
+
"purchase_staff_name": purchase_staff_name,
|
|
900
|
+
"purchase_delivery_time": purchase_delivery_time,
|
|
901
|
+
"purchase_price": purchase_price,
|
|
902
|
+
"purchase_note": purchase_note,
|
|
903
|
+
"product_material": product_material,
|
|
904
|
+
"product_gross_weight": product_gross_weight,
|
|
905
|
+
"product_net_weight": product_net_weight,
|
|
906
|
+
"product_length": product_length,
|
|
907
|
+
"product_width": product_width,
|
|
908
|
+
"product_height": product_height,
|
|
909
|
+
"package_length": package_length,
|
|
910
|
+
"package_width": package_width,
|
|
911
|
+
"package_height": package_height,
|
|
912
|
+
"box_weight": box_weight,
|
|
913
|
+
"box_length": box_length,
|
|
914
|
+
"box_width": box_width,
|
|
915
|
+
"box_height": box_height,
|
|
916
|
+
"box_qty": box_qty,
|
|
917
|
+
"supplier_quotes": supplier_quotes,
|
|
918
|
+
"customs_export_name": customs_export_name,
|
|
919
|
+
"customs_export_hs_code": customs_export_hs_code,
|
|
920
|
+
"customs_import_name": customs_import_name,
|
|
921
|
+
"customs_import_price": customs_import_price,
|
|
922
|
+
"customs_import_currency_code": customs_import_currency_code,
|
|
923
|
+
"customs_declaration": customs_declaration,
|
|
924
|
+
"customs_clearance": customs_clearance,
|
|
925
|
+
"operator_ids": operator_ids,
|
|
926
|
+
"operator_update_mode": operator_update_mode,
|
|
927
|
+
}
|
|
928
|
+
try:
|
|
929
|
+
p = param.EditProduct.model_validate(args)
|
|
930
|
+
except Exception as err:
|
|
931
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
932
|
+
|
|
933
|
+
# 发送请求
|
|
934
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
935
|
+
return schema.EditProductResult.model_validate(data)
|
|
936
|
+
|
|
937
|
+
async def SpuProducts(
|
|
938
|
+
self,
|
|
939
|
+
*,
|
|
940
|
+
offset: int | None = None,
|
|
941
|
+
length: int | None = None,
|
|
942
|
+
) -> schema.SpuProducts:
|
|
943
|
+
"""查询SPU多属性产品
|
|
944
|
+
|
|
945
|
+
## Docs
|
|
946
|
+
- 产品: [查询多属性产品列表](https://apidoc.lingxing.com/#/docs/Product/spuList)
|
|
947
|
+
|
|
948
|
+
:param offset `<'int'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
949
|
+
:param length `<'int'>`: 分页长度, 最大值200, 默认 `None` (使用: 20)
|
|
950
|
+
:returns `<'SpuProducts'>`: 返回查询到的SPU多属性产品列表
|
|
951
|
+
```python
|
|
952
|
+
{
|
|
953
|
+
# 状态码
|
|
954
|
+
"code": 0,
|
|
955
|
+
# 提示信息
|
|
956
|
+
"message": "success",
|
|
957
|
+
# 错误信息
|
|
958
|
+
"errors": [],
|
|
959
|
+
# 请求ID
|
|
960
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
961
|
+
# 响应时间
|
|
962
|
+
"response_time": "2025-08-13 19:23:04",
|
|
963
|
+
# 响应数据量
|
|
964
|
+
"response_count": 2,
|
|
965
|
+
# 总数据量
|
|
966
|
+
"total_count": 2,
|
|
967
|
+
# 响应数据
|
|
968
|
+
"data": [
|
|
969
|
+
{
|
|
970
|
+
# 领星SPU多属性产品ID [原字段 'ps_id']
|
|
971
|
+
"spu_id": 1,
|
|
972
|
+
# 领星SPU多属性产品编码
|
|
973
|
+
"spu": "SPU*******",
|
|
974
|
+
# 领星SPU多属性产品名称
|
|
975
|
+
"spu_name": "P*********",
|
|
976
|
+
# 领星本地产品分类ID [原字段 'cid']
|
|
977
|
+
"category_id": 0,
|
|
978
|
+
# 领星本地产品品牌ID [原字段 'bid']
|
|
979
|
+
"brand_id": 0,
|
|
980
|
+
# 产品型号 [原字段 'model']
|
|
981
|
+
"product_model": "香薰机",
|
|
982
|
+
# 产品开发者用户ID (Account.user_id) [原字段 'developer_uid']
|
|
983
|
+
"product_developer_id": 10******,
|
|
984
|
+
# 产品采购人用户ID (Account.user_id) [原字段 'cg_uid']
|
|
985
|
+
"purchase_staff_id": 10******,
|
|
986
|
+
# 采购交期 (单位: 天) [原字段 'cg_delivery']
|
|
987
|
+
"purchase_delivery_time": 14,
|
|
988
|
+
# 采购成本 [原字段 'cg_price']
|
|
989
|
+
"purchase_price": 100.0,
|
|
990
|
+
# 采购备注 [原字段 'purchase_remark']
|
|
991
|
+
"purchase_note": "采购备注",
|
|
992
|
+
# 创建人用户ID (Account.user_id) [原字段 'create_uid']
|
|
993
|
+
"create_user_id": 10******,
|
|
994
|
+
# 创建时间 (北京时间)
|
|
995
|
+
"create_time": "2025-07-25 16:12:28",
|
|
996
|
+
# 产品状态 (0: 停售, 1: 在售, 2: 开发中, 3: 清仓)
|
|
997
|
+
"status": 1,
|
|
998
|
+
},
|
|
999
|
+
...
|
|
1000
|
+
],
|
|
1001
|
+
}
|
|
1002
|
+
```
|
|
1003
|
+
"""
|
|
1004
|
+
url = route.SPU_PRODUCTS
|
|
1005
|
+
# 解析并验证参数
|
|
1006
|
+
args = {"offset": offset, "length": length}
|
|
1007
|
+
try:
|
|
1008
|
+
p = base_param.PageOffestAndLength.model_validate(args)
|
|
1009
|
+
except Exception as err:
|
|
1010
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
1011
|
+
|
|
1012
|
+
# 发送请求
|
|
1013
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
1014
|
+
return schema.SpuProducts.model_validate(data)
|
|
1015
|
+
|
|
1016
|
+
async def SpuProductDetail(
|
|
1017
|
+
self,
|
|
1018
|
+
spu_id: int,
|
|
1019
|
+
spu: str,
|
|
1020
|
+
) -> schema.SpuProductDetailData:
|
|
1021
|
+
"""查询SPU多属性产品详情
|
|
1022
|
+
|
|
1023
|
+
## Docs
|
|
1024
|
+
- 产品: [查询多属性产品详情](https://apidoc.lingxing.com/#/docs/Product/spuInfo)
|
|
1025
|
+
|
|
1026
|
+
:param spu_id `<'int'>`: 领星SPU多属性产品ID, 参数来源 `SpuProduct.spu_id`
|
|
1027
|
+
:param spu `<'str'>`: 领星SPU多属性产品编码, 参数来源 `SpuProduct.spu`
|
|
1028
|
+
:returns `<'SpuProductDetailData'>`: 返回查询到的SPU多属性产品详情
|
|
1029
|
+
```python
|
|
1030
|
+
{
|
|
1031
|
+
# 状态码
|
|
1032
|
+
"code": 0,
|
|
1033
|
+
# 提示信息
|
|
1034
|
+
"message": "success",
|
|
1035
|
+
# 错误信息
|
|
1036
|
+
"errors": [],
|
|
1037
|
+
# 请求ID
|
|
1038
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
1039
|
+
# 响应时间
|
|
1040
|
+
"response_time": "2025-08-13 19:23:04",
|
|
1041
|
+
# 响应数据量
|
|
1042
|
+
"response_count": 2,
|
|
1043
|
+
# 总数据量
|
|
1044
|
+
"total_count": 2,
|
|
1045
|
+
# 响应数据
|
|
1046
|
+
"data": {
|
|
1047
|
+
# 领星SPU多属性产品ID [原字段 'ps_id']
|
|
1048
|
+
"spu_id": 1,
|
|
1049
|
+
# 领星SPU多属性产品编码
|
|
1050
|
+
"spu": "SPU*******",
|
|
1051
|
+
# 领星SPU多属性产品名称
|
|
1052
|
+
"spu_name": "P*********",
|
|
1053
|
+
# 领星本地产品分类ID [原字段 'cid']
|
|
1054
|
+
"category_id": 0,
|
|
1055
|
+
# 领星本地产品分类名称
|
|
1056
|
+
"category_name": "",
|
|
1057
|
+
# 领星本地产品品牌ID [原字段 'bid']
|
|
1058
|
+
"brand_id": 0,
|
|
1059
|
+
# 领星本地产品品牌名称
|
|
1060
|
+
"brand_name": "",
|
|
1061
|
+
# 产品图片链接 [原字段 'pic_url']
|
|
1062
|
+
"image_url": "https://image.distributetop.com/****.jpeg",
|
|
1063
|
+
# 产品状态 (0: 停售, 1: 在售, 2: 开发中, 3: 清仓) [原字段 'status']
|
|
1064
|
+
"status": 1,
|
|
1065
|
+
# 产品状态描述 [原字段 'status_text']
|
|
1066
|
+
"status_desc": "在售",
|
|
1067
|
+
# 产品型号 [原字段 'model']
|
|
1068
|
+
"product_model": "AOP-1234",
|
|
1069
|
+
# 产品单位 [原字段 'unit']
|
|
1070
|
+
"product_unit": "套",
|
|
1071
|
+
# 产品描述 [原字段 'description']
|
|
1072
|
+
"product_description": "",
|
|
1073
|
+
# 创建者用户ID (Account.user_id) [原字段 'create_uid']
|
|
1074
|
+
"product_creator_id": 10******,
|
|
1075
|
+
# 创建者姓名 (Account.display_name) [原字段 'create_user']
|
|
1076
|
+
"product_creator_name": "超级管理员",
|
|
1077
|
+
# 产品开发者用户ID (Account.user_id) [原字段 'developer_uid']
|
|
1078
|
+
"product_developer_id": 10******,
|
|
1079
|
+
# 产品开发者姓名 (Account.display_name) [原字段 'developer']
|
|
1080
|
+
"product_developer_name": "超级管理员",
|
|
1081
|
+
# 产品负责人用户ID列表 (Account.user_id) [原字段 'product_duty_uids']
|
|
1082
|
+
"operator_ids": [10******],
|
|
1083
|
+
# 产品负责人用户信息列表 [原字段 'product_duty_users']
|
|
1084
|
+
"operators": [{"user_id": 10******, "user_name": "超级管理员"}],
|
|
1085
|
+
# 产品采购信息
|
|
1086
|
+
"purchase_info": {
|
|
1087
|
+
# 产品采购人用户ID (Account.user_id) [原字段 'cg_uid']
|
|
1088
|
+
"purchase_staff_id": 10******,
|
|
1089
|
+
# 产品采购人姓名 (Account.display_name) [原字段 'cg_user']
|
|
1090
|
+
"purchase_staff_name": "超级管理员",
|
|
1091
|
+
# 采购交期 (单位: 天) [原字段 'cg_delivery']
|
|
1092
|
+
"purchase_delivery_time": 14,
|
|
1093
|
+
# 采购价格 [原字段 'cg_price']
|
|
1094
|
+
"purchase_price": 100.0,
|
|
1095
|
+
# 采购备注 [原字段 'purchase_remark']
|
|
1096
|
+
"purchase_note": "采购备注",
|
|
1097
|
+
# 采购产品材质 [原字段 'cg_product_material']
|
|
1098
|
+
"product_material": "塑料",
|
|
1099
|
+
# 采购产品公制总重 [原字段 'cg_product_gross_weight']
|
|
1100
|
+
"product_gross_weight_metric": 100.0,
|
|
1101
|
+
# 采购产品公制总重单位 [原字段 'cg_product_gross_weight_unit']
|
|
1102
|
+
"product_gross_weight_metric_unit": "g",
|
|
1103
|
+
# 采购产品英制总重 [原字段 'cg_product_gross_weight_in']
|
|
1104
|
+
"product_gross_weight_imperial": 0.22,
|
|
1105
|
+
# 采购产品总重英制单位 [原字段 'cg_product_gross_weight_in_unit']
|
|
1106
|
+
"product_gross_weight_imperial_unit": "lb",
|
|
1107
|
+
# 采购产品公制净重 [原字段 'cg_product_net_weight']
|
|
1108
|
+
"product_net_weight_metric": 100.0,
|
|
1109
|
+
# 采购产品公制净重单位 [原字段 'cg_product_net_weight_unit']
|
|
1110
|
+
"product_net_weight_metric_unit": "g",
|
|
1111
|
+
# 采购产品英制净重 [原字段 'cg_product_net_weight_in']
|
|
1112
|
+
"product_net_weight_imperial": 0.22,
|
|
1113
|
+
# 采购产品净重英制单位 [原字段 'cg_product_net_weight_in_unit']
|
|
1114
|
+
"product_net_weight_imperial_unit": "lb",
|
|
1115
|
+
# 采购产品公制长度 [原字段 'cg_product_length']
|
|
1116
|
+
"product_length_metric": 10.0,
|
|
1117
|
+
# 采购产品英制长度 [原字段 'cg_product_length_in']
|
|
1118
|
+
"product_length_imperial": 3.94,
|
|
1119
|
+
# 采购产品公制宽度 [原字段 'cg_product_width']
|
|
1120
|
+
"product_width_metric": 10.0,
|
|
1121
|
+
# 采购产品英制宽度 [原字段 'cg_product_width_in']
|
|
1122
|
+
"product_width_imperial": 3.94,
|
|
1123
|
+
# 采购产品公制高度 [原字段 'cg_product_height']
|
|
1124
|
+
"product_height_metric": 10.0,
|
|
1125
|
+
# 采购产品英制高度 [原字段 'cg_product_height_in']
|
|
1126
|
+
"product_height_imperial": 3.94,
|
|
1127
|
+
# 采购包装公制长度 [原字段 'cg_package_length']
|
|
1128
|
+
"package_length_metric": 10.0,
|
|
1129
|
+
# 采购包装英制长度 [原字段 'cg_package_length_in']
|
|
1130
|
+
"package_length_imperial": 3.94,
|
|
1131
|
+
# 采购包装公制宽度 [原字段 'cg_package_width']
|
|
1132
|
+
"package_width_metric": 10.0,
|
|
1133
|
+
# 采购包装英制宽度 [原字段 'cg_package_width_in']
|
|
1134
|
+
"package_width_imperial": 3.94,
|
|
1135
|
+
# 采购包装公制高度 [原字段 'cg_package_height']
|
|
1136
|
+
"package_height_metric": 10.0,
|
|
1137
|
+
# 采购包装英制高度 [原字段 'cg_package_height_in']
|
|
1138
|
+
"package_height_imperial": 3.94,
|
|
1139
|
+
# 采购外箱公制重量 [原字段 'cg_box_weight']
|
|
1140
|
+
"box_weight_metric": 100.0,
|
|
1141
|
+
# 采购外箱公制重量单位 [原字段 'cg_box_weight_unit']
|
|
1142
|
+
"box_weight_metric_unit": "kg",
|
|
1143
|
+
# 采购外箱英制重量 [原字段 'cg_box_weight_in']
|
|
1144
|
+
"box_weight_imperial": 220.46,
|
|
1145
|
+
# 采购外箱英制重量单位 [原字段 'cg_box_weight_in_unit']
|
|
1146
|
+
"box_weight_imperial_unit": "lb",
|
|
1147
|
+
# 采购外箱公制长度 [原字段 'cg_box_length']
|
|
1148
|
+
"box_length_metric": 10.0,
|
|
1149
|
+
# 采购外箱英制长度 [原字段 'cg_box_length_in']
|
|
1150
|
+
"box_length_imperial": 3.94,
|
|
1151
|
+
# 采购外箱公制宽度 [原字段 'cg_box_width']
|
|
1152
|
+
"box_width_metric": 10.0,
|
|
1153
|
+
# 采购外箱英制宽度 [原字段 'cg_box_width_in']
|
|
1154
|
+
"box_width_imperial": 3.94,
|
|
1155
|
+
# 采购外箱公制高度 [原字段 'cg_box_height']
|
|
1156
|
+
"box_height_metric": 10.0,
|
|
1157
|
+
# 采购外箱英制高度 [原字段 'cg_box_height_in']
|
|
1158
|
+
"box_height_imperial": 3.94,
|
|
1159
|
+
# 采购外箱数量 [原字段 'cg_box_pcs']
|
|
1160
|
+
"box_qty": 1,
|
|
1161
|
+
},
|
|
1162
|
+
# 海关申报信息 [原字段 'logistics']
|
|
1163
|
+
"customs_info": {
|
|
1164
|
+
# 基础产品信息 [原字段 'base']
|
|
1165
|
+
"base_info": {
|
|
1166
|
+
# 产品特殊属性 [原字段 'special_attr']
|
|
1167
|
+
"special_attrs": [
|
|
1168
|
+
{
|
|
1169
|
+
# 特殊属性ID [原字段 'id']
|
|
1170
|
+
"special_attr_id": 3,
|
|
1171
|
+
# 特殊属性值 [原字段 'value']
|
|
1172
|
+
"special_attr_value": "液体"
|
|
1173
|
+
},
|
|
1174
|
+
...
|
|
1175
|
+
],
|
|
1176
|
+
# 报关申报HS编码 (出口国) [原字段 'bg_export_hs_code']
|
|
1177
|
+
"customs_export_hs_code": "84********",
|
|
1178
|
+
},
|
|
1179
|
+
# 海关报关信息
|
|
1180
|
+
"declaration": {
|
|
1181
|
+
# 报关申报品名 (出口国) [原字段 'customs_export_name']
|
|
1182
|
+
"export_name": "香薰机",
|
|
1183
|
+
# 报关申报HS编码 (出口国) [原字段 'customs_declaration_hs_code']
|
|
1184
|
+
"export_hs_code": "84********",
|
|
1185
|
+
# 报关申报品名 (进口国) [原字段 'customs_import_name']
|
|
1186
|
+
"import_name": "Vaper",
|
|
1187
|
+
# 报关申报单价 (进口国) [原字段 'customs_import_price']
|
|
1188
|
+
"import_price": 1.2,
|
|
1189
|
+
# 报关申报单价货币代码 (进口国) [原字段 'customs_import_price_currency']
|
|
1190
|
+
"currency_code": "USD",
|
|
1191
|
+
# 报关申报单价货币符号 (进口国) [原字段 'customs_import_price_currency_icon']
|
|
1192
|
+
"currency_icon": "$",
|
|
1193
|
+
# 报关申报产品单位 [原字段 'customs_declaration_unit']
|
|
1194
|
+
"unit": "套",
|
|
1195
|
+
# 报关申报产品规格 [原字段 'customs_declaration_spec']
|
|
1196
|
+
"specification": "香薰机",
|
|
1197
|
+
# 报关申报产品原产地 [原字段 'customs_declaration_origin_produce']
|
|
1198
|
+
"country_of_origin": "中国",
|
|
1199
|
+
# 报关申报内陆来源 [原字段 'customs_declaration_inlands_source']
|
|
1200
|
+
"source_from_inland": "中国",
|
|
1201
|
+
# 报关申报免税 [原字段 'customs_declaration_exempt']
|
|
1202
|
+
"exemption": "",
|
|
1203
|
+
# 其他申报要素 [原字段 'other_declare_element']
|
|
1204
|
+
"other_details": "",
|
|
1205
|
+
},
|
|
1206
|
+
# 海关清关信息
|
|
1207
|
+
"clearance": {
|
|
1208
|
+
# 清关内部编码 [原字段 'customs_clearance_internal_code']
|
|
1209
|
+
"internal_code": "",
|
|
1210
|
+
# 清关产品材质 [原字段 'customs_clearance_material']
|
|
1211
|
+
"material": "",
|
|
1212
|
+
# 清关产品用途 [原字段 'customs_clearance_usage']
|
|
1213
|
+
"usage": "",
|
|
1214
|
+
# 清关是否享受优惠 [原字段 'customs_clearance_preferential']
|
|
1215
|
+
# (0: 未设置, 1: 不享惠, 2: 享惠, 3: 不确定)
|
|
1216
|
+
"preferential": 2,
|
|
1217
|
+
# 清关是否享受优惠描述 [原字段 'customs_clearance_preferential_text']
|
|
1218
|
+
"preferential_desc": "享惠",
|
|
1219
|
+
# 清关品牌类型 [原字段 'customs_clearance_brand_type']
|
|
1220
|
+
# (0: 未设置, 1: 无品牌, 2: 境内品牌[自主], 3: 境内品牌[收购], 4: 境外品牌[贴牌], 5: 境外品牌[其他])
|
|
1221
|
+
"brand_type": 2,
|
|
1222
|
+
# 清关品牌类型描述 [原字段 'customs_clearance_brand_type_text']
|
|
1223
|
+
"brand_type_desc": "境内自主品牌",
|
|
1224
|
+
# 清关产品型号 [原字段 'customs_clearance_product_pattern']
|
|
1225
|
+
"model": "香薰机",
|
|
1226
|
+
# 清关产品图片链接 [原字段 'customs_clearance_pic_url']
|
|
1227
|
+
"image_url": "https://image.umaicloud.com/****.jpg",
|
|
1228
|
+
# 配货备注 [原字段 'allocation_remark']
|
|
1229
|
+
"allocation_note": "",
|
|
1230
|
+
# 织造类型 (0: 未设置, 1: 针织, 2: 梭织) [原字段 'weaving_mode']
|
|
1231
|
+
"fabric_type": 0,
|
|
1232
|
+
# 织造类型描述 [原字段 'weaving_mode_text']
|
|
1233
|
+
"fabric_type_desc": "",
|
|
1234
|
+
# 清关申报单价货币代码 [原字段 'customs_clearance_price_currency']
|
|
1235
|
+
"clearance_currency_code": "CNY",
|
|
1236
|
+
# 清关申报单价货币符号 [原字段 'customs_clearance_price_currency_icon']
|
|
1237
|
+
"clearance_currency_icon": "¥",
|
|
1238
|
+
# 清关申报单价 [原字段 'customs_clearance_price']
|
|
1239
|
+
"clearance_price": 8.4,
|
|
1240
|
+
# 清关税率 [原字段 'customs_clearance_tax_rate']
|
|
1241
|
+
"clearance_tax_rate": 0.0,
|
|
1242
|
+
# 清关HS编码 [原字段 'customs_clearance_hs_code']
|
|
1243
|
+
"clearance_hs_code": "8*********",
|
|
1244
|
+
# 清关备注 [原字段 'customs_clearance_remark']
|
|
1245
|
+
"clearance_note": "",
|
|
1246
|
+
},
|
|
1247
|
+
},
|
|
1248
|
+
# 关联辅料列表 [原字段 'aux_relation_list']
|
|
1249
|
+
"auxiliary_materials": [
|
|
1250
|
+
{
|
|
1251
|
+
# 辅料ID
|
|
1252
|
+
"aux_id": 4*****,
|
|
1253
|
+
# 辅料SKU
|
|
1254
|
+
"aux_sku": "BOX001",
|
|
1255
|
+
# 辅料名称
|
|
1256
|
+
"aux_name": "包装箱",
|
|
1257
|
+
# 辅料备注 [原字段 'remark']
|
|
1258
|
+
"aux_note": "",
|
|
1259
|
+
# 辅料配比数量 [原字段 'aux_qty']
|
|
1260
|
+
"aux_ratio_qty": 1,
|
|
1261
|
+
# 产品配比数据 [原字段 'sku_qty']
|
|
1262
|
+
"sku_ratio_qty": 1,
|
|
1263
|
+
# 辅料采购数量 [原字段 'quantity']
|
|
1264
|
+
"purchase_qty": 100,
|
|
1265
|
+
# 辅料采购价格 [原字段 'cg_price']
|
|
1266
|
+
"purchase_price": 10.0,
|
|
1267
|
+
}
|
|
1268
|
+
],
|
|
1269
|
+
# 标准产品列表 [原字段 'sku_list']
|
|
1270
|
+
"items": [
|
|
1271
|
+
{
|
|
1272
|
+
# 领星本地SKU [原字段 'sku']
|
|
1273
|
+
"lsku": "SKU*******",
|
|
1274
|
+
# 领星本地产品ID
|
|
1275
|
+
"product_id": 47****,
|
|
1276
|
+
# 领星本地产品名称
|
|
1277
|
+
"product_name": "P*********",
|
|
1278
|
+
# 产品图片链接 [原字段 'pic_url']
|
|
1279
|
+
"image_url": "https://image.distributetop.com/****.jpeg",
|
|
1280
|
+
# 产品图片列表 [原字段 'pic_list']
|
|
1281
|
+
"images": [
|
|
1282
|
+
{
|
|
1283
|
+
# 图片ID [原字段 'pp_id']
|
|
1284
|
+
"image_id": 21****************,
|
|
1285
|
+
# 图片名称 [原字段 'pic_name']
|
|
1286
|
+
"image_name": "****.jpg",
|
|
1287
|
+
# 图片链接 [原字段 'pic_url']
|
|
1288
|
+
"image_url": "https://image.distributetop.com/***.jpeg",
|
|
1289
|
+
# 图片大小 (单位: Byte) [原字段 'pic_space']
|
|
1290
|
+
"image_size": 208636,
|
|
1291
|
+
# 图片宽度 (单位: PX) [原字段 'pic_size_w']
|
|
1292
|
+
"image_width": 1500,
|
|
1293
|
+
# 图片高度 (单位: PX) [原字段 'pic_size_h']
|
|
1294
|
+
"image_height": 1422,
|
|
1295
|
+
# 图片类型 [原字段 'pic_type']
|
|
1296
|
+
"image_type": 1,
|
|
1297
|
+
# 是否为主图 (0: 否, 1: 是)
|
|
1298
|
+
"is_primary": 1,
|
|
1299
|
+
# 领星本地产品ID
|
|
1300
|
+
"product_id": 47****,
|
|
1301
|
+
},
|
|
1302
|
+
...
|
|
1303
|
+
],
|
|
1304
|
+
# 产品属性列表 [原字段 'attribute']
|
|
1305
|
+
"attributes": [
|
|
1306
|
+
{
|
|
1307
|
+
# 属性ID [原字段 'pa_id']
|
|
1308
|
+
"attr_id": 1***,
|
|
1309
|
+
# 属性值ID [原字段 'pai_id']
|
|
1310
|
+
"attr_value_id": "4***",
|
|
1311
|
+
# 属性值名称 [原字段 'pai_name']
|
|
1312
|
+
"attr_value_name": "紫色",
|
|
1313
|
+
},
|
|
1314
|
+
...
|
|
1315
|
+
],
|
|
1316
|
+
}
|
|
1317
|
+
],
|
|
1318
|
+
# 附件信息列表 [原字段 'attachmentFiles']
|
|
1319
|
+
"attachments": [
|
|
1320
|
+
{
|
|
1321
|
+
# 文件ID
|
|
1322
|
+
"file_id": "10************",
|
|
1323
|
+
# 文件名称
|
|
1324
|
+
"file_name": "产品说明书.pdf",
|
|
1325
|
+
# 文件类型 (0: 未知, 1: 图片, 2: 压缩包)
|
|
1326
|
+
"file_type": 0,
|
|
1327
|
+
# 文件链接
|
|
1328
|
+
"file_url": "https://file.lingxing.com/****.pdf",
|
|
1329
|
+
},
|
|
1330
|
+
...
|
|
1331
|
+
],
|
|
1332
|
+
},
|
|
1333
|
+
}
|
|
1334
|
+
```
|
|
1335
|
+
"""
|
|
1336
|
+
url = route.SPU_PRODUCT_DETAIL
|
|
1337
|
+
# 解析并验证参数
|
|
1338
|
+
args = {"spu_id": spu_id, "spu": spu}
|
|
1339
|
+
try:
|
|
1340
|
+
p = param.SpuProductDetail.model_validate(args)
|
|
1341
|
+
except Exception as err:
|
|
1342
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
1343
|
+
|
|
1344
|
+
# 发送请求
|
|
1345
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
1346
|
+
return schema.SpuProductDetailData.model_validate(data)
|
|
1347
|
+
|
|
1348
|
+
async def EditSpuProduct(
|
|
1349
|
+
self,
|
|
1350
|
+
spu: str,
|
|
1351
|
+
spu_name: str,
|
|
1352
|
+
items: dict | list[dict],
|
|
1353
|
+
*,
|
|
1354
|
+
category_id: int | None = None,
|
|
1355
|
+
brand_id: int | None = None,
|
|
1356
|
+
product_model: str | None = None,
|
|
1357
|
+
product_unit: str | None = None,
|
|
1358
|
+
product_description: str | None = None,
|
|
1359
|
+
status: int | None = None,
|
|
1360
|
+
product_creator_id: int | None = None,
|
|
1361
|
+
product_developer_id: int | None = None,
|
|
1362
|
+
operator_ids: int | list[int] | None = None,
|
|
1363
|
+
apply_to_new_skus: int | None = None,
|
|
1364
|
+
purchase_info: dict | None = None,
|
|
1365
|
+
customs_info: dict | None = None,
|
|
1366
|
+
) -> schema.EditSpuProductResult:
|
|
1367
|
+
"""添加/编辑SPU多属性产品
|
|
1368
|
+
|
|
1369
|
+
## Docs
|
|
1370
|
+
- 产品: [添加/编辑多属性产品](https://apidoc.lingxing.com/#/docs/Product/spuSet)
|
|
1371
|
+
|
|
1372
|
+
## Notice
|
|
1373
|
+
- 默认参数 `None` 表示重置设置, 所有没有传入的参数都将被重置为默认值
|
|
1374
|
+
- 这点不同于 `EditProduct` 方法, 其默认参数 `None` 表示留空或不修改,
|
|
1375
|
+
只有传入的对应参数才会被更新
|
|
1376
|
+
|
|
1377
|
+
:param spu `<'str'>`: 领星SPU多属性产品编码, 参数来源 `SpuProduct.spu`
|
|
1378
|
+
:param spu_name `<'str'>`: 领星SPU多属性产品名称, 参数来源 `SpuProduct.spu_name`
|
|
1379
|
+
:param items `<'dict/list[dict]'>`: 子产品字典或列表, 必填项, 参数为覆盖模式
|
|
1380
|
+
|
|
1381
|
+
- 每个字典必须包含 `lsku` 和 `attributes` 字段, 如:
|
|
1382
|
+
`{"lsku": "SKU", "attributes": [{"attr_id": 1, "attr_value_id": "4"}]}`
|
|
1383
|
+
- 必填字段 `lsku` 领星本地产品SKU, 必须为 str 类型
|
|
1384
|
+
- 必填字段 `attributes` 产品属性列表, 必须为 list[dict] 类型, 每个字典必须包含以下字段:
|
|
1385
|
+
* 必填字段 `attributes.attr_id` 属性ID, 必须为 int 类型
|
|
1386
|
+
* 必填字段 `attributes.attr_value_id` 属性值ID, 必须为 str 类型
|
|
1387
|
+
|
|
1388
|
+
:param category_id `<'int'>`: 领星本地产品分类ID,
|
|
1389
|
+
默认 `None`, 不同于 `EditProduct`, 表示重置设置或默认0
|
|
1390
|
+
:param brand_id `<'int'>`: 领星本地产品品牌ID,
|
|
1391
|
+
默认 `None`, 不同于 `EditProduct`, 表示重置设置或默认0
|
|
1392
|
+
:param product_model `<'str'>`: 产品型号,
|
|
1393
|
+
默认 `None`, 不同于 `EditProduct`, 表示重置设置或默认空字符串
|
|
1394
|
+
:param product_unit `<'str'>`: 产品单位,
|
|
1395
|
+
默认 `None`, 不同于 `EditProduct`, 表示重置设置或默认空字符串
|
|
1396
|
+
:param product_description `<'str'>`: 产品描述,
|
|
1397
|
+
默认 `None`, 不同于 `EditProduct`, 表示重置设置或默认空字符串
|
|
1398
|
+
:param status `<'int'>`: 产品状态 (0: 停售, 1: 在售, 2: 开发中, 3: 清仓),
|
|
1399
|
+
默认 `None`, 不同于 `EditProduct`, 表示重置为1或默认1
|
|
1400
|
+
:param product_creator_id `<'int'>`: 产品创建人ID,
|
|
1401
|
+
默认 `None`, 不同于 `EditProduct`, 表示重置为初始创建人ID
|
|
1402
|
+
:param product_developer_id `<'int'>`: 产品开发者ID,
|
|
1403
|
+
默认 `None`, 不同于 `EditProduct`, 表示重置设置或默认0
|
|
1404
|
+
:param operator_ids `<'int/list[int]'>`: 产品负责人帐号ID列表 (Account.user_id),
|
|
1405
|
+
默认 `None`, 不同于 `EditProduct`, 表示重置设置或默认空列表
|
|
1406
|
+
:param apply_to_new_skus `<'int'>`: 是否应用SPU多属性产品基础信息至新生成的SKU (0: 否, 1: 是),
|
|
1407
|
+
默认 `None` 不应用 (0: 否)
|
|
1408
|
+
:param purchase_info `<'dict'>`: 产品采购信息,
|
|
1409
|
+
默认 `None`, 不同于 `EditProduct`, 表示重置设置或默认设置
|
|
1410
|
+
|
|
1411
|
+
- 字典可选填字段 (覆盖模式, 缺失字段设置将被重置):
|
|
1412
|
+
- 可选字段 `purchase_staff_id` 产品采购人用户ID, 必须为 int 类型, 不传重置为0
|
|
1413
|
+
- 可选字段 `purchase_delivery_time` 采购交期 (单位: 天), 必须为 int 类型, 不传重置为0
|
|
1414
|
+
- 可选字段 `purchase_note` 采购备注, 必须为 str 类型, 不传重置为空字符串
|
|
1415
|
+
- 可选字段 `product_material` 采购产品材质, 必须为 str 类型, 不传重置为空字符串
|
|
1416
|
+
- 可选字段 `product_gross_weight` 采购产品总重 (单位: G), 必须为 int/float 类型, 不传重置为0
|
|
1417
|
+
- 可选字段 `product_net_weight` 采购产品净重 (单位: G), 必须为 int/float 类型, 不传重置为0
|
|
1418
|
+
- 可选字段 `product_length` 采购产品长度 (单位: CM), 必须为 int/float 类型, 不传重置为0
|
|
1419
|
+
- 可选字段 `product_width` 采购产品宽度 (单位: CM), 必须为 int/float 类型, 不传重置为0
|
|
1420
|
+
- 可选字段 `product_height` 采购产品高度 (单位: CM), 必须为 int/float 类型, 不传重置为0
|
|
1421
|
+
- 可选字段 `package_length` 采购包装长度 (单位: CM), 必须为 int/float 类型, 不传重置为0
|
|
1422
|
+
- 可选字段 `package_width` 采购包装宽度 (单位: CM), 必须为 int/float 类型, 不传重置为0
|
|
1423
|
+
- 可选字段 `package_height` 采购包装高度 (单位: CM), 必须为 int/float 类型, 不传重置为0
|
|
1424
|
+
- 可选字段 `box_weight` 采购外箱重量 (单位: KG), 必须为 int/float 类型, 不传重置为0
|
|
1425
|
+
- 可选字段 `box_length` 采购外箱长度 (单位: CM), 必须为 int/float 类型, 不传重置为0
|
|
1426
|
+
- 可选字段 `box_width` 采购外箱宽度 (单位: CM), 必须为 int/float 类型, 不传重置为0
|
|
1427
|
+
- 可选字段 `box_height` 采购外箱高度 (单位: CM), 必须为 int/float 类型, 不传重置为0
|
|
1428
|
+
- 可选字段 `box_qty` 采购外箱数量, 必须为 int 类型, 不传重置为0
|
|
1429
|
+
|
|
1430
|
+
:param customs_info `<'dict'>`: 海关申报信息,
|
|
1431
|
+
默认 `None`, 不同于 `EditProduct`, 表示重置设置或默认设置
|
|
1432
|
+
|
|
1433
|
+
- 字典可选填字段 (覆盖模式, 缺失字段设置将被重置):
|
|
1434
|
+
- 可选字段 `base_info` 基础产品信息, 必须为 dict 类型, 不传重置为默认设置
|
|
1435
|
+
* 可选字段 `base_info.customs_export_hs_code` 报关申报HS编码 (出口国),
|
|
1436
|
+
必须为 str 类型, 不传重置为空字符串
|
|
1437
|
+
* 可选字段 `base_info.special_attrs` 产品特殊属性列表, 必须为 int/list[int] 类型
|
|
1438
|
+
(1: 含电, 2: 纯电, 3: 液体, 4: 粉末, 5: 膏体, 6: 带磁), 不传清除设置
|
|
1439
|
+
- 可选字段 `declaration` 海关报关信息, 必须为 dict 类型, 不传重置为默认设置
|
|
1440
|
+
* 可选字段 `declaration.export_name` 报关申报品名 (出口国), 必须为 str 类型, 不传重置为空字符串
|
|
1441
|
+
* 可选字段 `declaration.import_name` 报关申报品名 (进口国), 必须为 str 类型, 不传重置为空字符串
|
|
1442
|
+
* 可选字段 `declaration.import_price` 报关申报单价 (进口国), 必须为 int/float 类型, 不传重置为0
|
|
1443
|
+
* 可选字段 `declaration.currency_code` 报关申报单价货币代码 (进口国), 必须为 str 类型, 不传重置为`"USD"`
|
|
1444
|
+
* 可选字段 `declaration.unit` 报关申报产品单位, 必须为 str 类型, 不传重置为空字符串
|
|
1445
|
+
* 可选字段 `declaration.specification` 报关申报产品规格, 必须为 str 类型, 不传重置为空字符串
|
|
1446
|
+
* 可选字段 `declaration.country_of_origin` 报关申报产品原产地, 必须为 str 类型, 不传重置为空字符串
|
|
1447
|
+
* 可选字段 `declaration.source_from_inland` 报关申报内陆来源, 必须为 str 类型, 不传重置为空字符串
|
|
1448
|
+
* 可选字段 `declaration.exemption` 报关申报免税, 必须为 str 类型, 不传重置为空字符串
|
|
1449
|
+
- 可选字段 `clearance` 海关清关信息, 必须为 dict 类型, 不传重置为默认设置
|
|
1450
|
+
* 可选字段 `clearance.internal_code` 清关内部编码, 必须为 str 类型, 不传重置为空字符串
|
|
1451
|
+
* 可选字段 `clearance.material` 清关产品材质, 必须为 str 类型, 不传重置为空字符串
|
|
1452
|
+
* 可选字段 `clearance.usage` 清关产品用途, 必须为 str 类型, 不传重置为空字符串
|
|
1453
|
+
* 可选字段 `clearance.preferential` 清关是否享受优惠, 必须为 int 类型
|
|
1454
|
+
(0: 未设置, 1: 不享惠, 2: 享惠, 3: 不确定), 不传重置为0
|
|
1455
|
+
* 可选字段 `clearance.brand_type` 清关品牌类型, 必须为 int 类型
|
|
1456
|
+
(0: 未设置, 1: 无品牌, 2: 境内品牌[自主], 3: 境内品牌[收购],
|
|
1457
|
+
4: 境外品牌[贴牌], 5: 境外品牌[其他]), 不传重置为0
|
|
1458
|
+
* 可选字段 `clearance.model` 清关产品型号, 必须为 str 类型, 不传重置为空字符串
|
|
1459
|
+
* 可选字段 `clearance.image_url` 清关产品图片链接, 必须为 str 类型, 不传重置为空字符串
|
|
1460
|
+
* 可选字段 `clearance.allocation_note` 配货备注, 必须为 str 类型, 不传重置为空字符串
|
|
1461
|
+
* 可选字段 `clearance.fabric_type` 织造类型, 必须为 int 类型
|
|
1462
|
+
(0: 未设置, 1: 针织, 2: 梭织), 不传重置为0
|
|
1463
|
+
|
|
1464
|
+
:returns `<'EditSpuProductResult'>`: 返回添加/编辑SPU多属性产品的结果
|
|
1465
|
+
```python
|
|
1466
|
+
{
|
|
1467
|
+
# 状态码
|
|
1468
|
+
"code": 0,
|
|
1469
|
+
# 提示信息
|
|
1470
|
+
"message": "success",
|
|
1471
|
+
# 错误信息
|
|
1472
|
+
"errors": [],
|
|
1473
|
+
# 请求ID
|
|
1474
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
1475
|
+
# 响应时间
|
|
1476
|
+
"response_time": "2025-08-13 19:23:04",
|
|
1477
|
+
# 响应结果
|
|
1478
|
+
"data": {
|
|
1479
|
+
# 领星SPU多属性产品ID [原字段 'ps_id']
|
|
1480
|
+
"spu_id": 1,
|
|
1481
|
+
# 领星SPU多属性产品列表 [原字段 'sku_list']
|
|
1482
|
+
"items": [
|
|
1483
|
+
{
|
|
1484
|
+
# 领星本地SKU [原字段 'sku']
|
|
1485
|
+
"lsku": "SKU*******",
|
|
1486
|
+
# 领星本地产品ID
|
|
1487
|
+
"product_id": 47****,
|
|
1488
|
+
},
|
|
1489
|
+
...
|
|
1490
|
+
],
|
|
1491
|
+
},
|
|
1492
|
+
}
|
|
1493
|
+
```
|
|
1494
|
+
"""
|
|
1495
|
+
url = route.EDIT_SPU_PRODUCT
|
|
1496
|
+
# 解析并验证参数
|
|
1497
|
+
args = {
|
|
1498
|
+
"spu": spu,
|
|
1499
|
+
"spu_name": spu_name,
|
|
1500
|
+
"items": items,
|
|
1501
|
+
"category_id": category_id,
|
|
1502
|
+
"brand_id": brand_id,
|
|
1503
|
+
"product_model": product_model,
|
|
1504
|
+
"product_unit": product_unit,
|
|
1505
|
+
"product_description": product_description,
|
|
1506
|
+
"status": status,
|
|
1507
|
+
"product_creator_id": product_creator_id,
|
|
1508
|
+
"product_developer_id": product_developer_id,
|
|
1509
|
+
"operator_ids": operator_ids,
|
|
1510
|
+
"apply_to_new_skus": apply_to_new_skus,
|
|
1511
|
+
"purchase_info": purchase_info,
|
|
1512
|
+
"customs_info": customs_info,
|
|
1513
|
+
}
|
|
1514
|
+
try:
|
|
1515
|
+
p = param.EditSpuProduct.model_validate(args)
|
|
1516
|
+
except Exception as err:
|
|
1517
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
1518
|
+
|
|
1519
|
+
# 发送请求
|
|
1520
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
1521
|
+
return schema.EditSpuProductResult.model_validate(data)
|
|
1522
|
+
|
|
1523
|
+
async def BundleProducts(
|
|
1524
|
+
self,
|
|
1525
|
+
*,
|
|
1526
|
+
offset: int | None = None,
|
|
1527
|
+
length: int | None = None,
|
|
1528
|
+
) -> schema.BundleProducts:
|
|
1529
|
+
"""查询领星本地捆绑产品
|
|
1530
|
+
|
|
1531
|
+
## Docs
|
|
1532
|
+
- 产品: [查询捆绑产品关系列表](https://apidoc.lingxing.com/#/docs/Product/bundledProductList)
|
|
1533
|
+
|
|
1534
|
+
:param offset `<'int'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
1535
|
+
:param length `<'int'>`: 分页长度, 最大1000, 默认 `None` (使用: 1000)
|
|
1536
|
+
:returns `<'BundleProducts'>`: 返回查询到的捆绑产品列表
|
|
1537
|
+
```python
|
|
1538
|
+
{
|
|
1539
|
+
# 状态码
|
|
1540
|
+
"code": 0,
|
|
1541
|
+
# 提示信息
|
|
1542
|
+
"message": "success",
|
|
1543
|
+
# 错误信息
|
|
1544
|
+
"errors": [],
|
|
1545
|
+
# 请求ID
|
|
1546
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
1547
|
+
# 响应时间
|
|
1548
|
+
"response_time": "2025-08-13 19:23:04",
|
|
1549
|
+
# 响应数据量
|
|
1550
|
+
"response_count": 2,
|
|
1551
|
+
# 总数据量
|
|
1552
|
+
"total_count": 2,
|
|
1553
|
+
# 响应数据
|
|
1554
|
+
"data": [
|
|
1555
|
+
{
|
|
1556
|
+
# 捆绑产品ID [原字段 'id']
|
|
1557
|
+
"bundle_id": 4*****,
|
|
1558
|
+
# 捆绑产品SKU [原字段 'sku']
|
|
1559
|
+
"bundle_sku": "BUNDLE-SKU",
|
|
1560
|
+
# 捆绑产品名称 [原字段 'product_name']
|
|
1561
|
+
"bundle_name": "P*********",
|
|
1562
|
+
# 捆绑产品采购价 [原字段 'cg_price']
|
|
1563
|
+
"purchase_price": 100.0,
|
|
1564
|
+
# 捆绑产品状态描述 [原字段 'status_text']
|
|
1565
|
+
"status_desc": "在售",
|
|
1566
|
+
# 捆绑产品列表 [原字段 'bundled_products']
|
|
1567
|
+
"items": [
|
|
1568
|
+
{
|
|
1569
|
+
# 子产品SKU [原字段 'sku']
|
|
1570
|
+
"lsku": "SKU*******",
|
|
1571
|
+
# 领星本地子产品ID [原字段 'productId']
|
|
1572
|
+
"product_id": 4*****,
|
|
1573
|
+
# 子产品捆绑数量 [原字段 'bundledQty']
|
|
1574
|
+
"bundle_qty": 1,
|
|
1575
|
+
# 子产品费用比例
|
|
1576
|
+
"cost_ratio": 0.0,
|
|
1577
|
+
},
|
|
1578
|
+
...
|
|
1579
|
+
],
|
|
1580
|
+
},
|
|
1581
|
+
...
|
|
1582
|
+
],
|
|
1583
|
+
}
|
|
1584
|
+
```
|
|
1585
|
+
"""
|
|
1586
|
+
url = route.BUNDLE_PRODUCTS
|
|
1587
|
+
# 解析并验证参数
|
|
1588
|
+
args = {"offset": offset, "length": length}
|
|
1589
|
+
try:
|
|
1590
|
+
p = base_param.PageOffestAndLength.model_validate(args)
|
|
1591
|
+
except Exception as err:
|
|
1592
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
1593
|
+
|
|
1594
|
+
# 发送请求
|
|
1595
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
1596
|
+
return schema.BundleProducts.model_validate(data)
|
|
1597
|
+
|
|
1598
|
+
async def EditBundleProduct(
|
|
1599
|
+
self,
|
|
1600
|
+
bundle_sku: str,
|
|
1601
|
+
bundle_name: str,
|
|
1602
|
+
*,
|
|
1603
|
+
items: dict | list[dict] | None = None,
|
|
1604
|
+
category_id: int | None = None,
|
|
1605
|
+
category_name: str | None = None,
|
|
1606
|
+
brand_id: int | None = None,
|
|
1607
|
+
brand_name: str | None = None,
|
|
1608
|
+
product_model: str | None = None,
|
|
1609
|
+
product_unit: str | None = None,
|
|
1610
|
+
product_description: str | None = None,
|
|
1611
|
+
product_images: dict | list[dict] | None = None,
|
|
1612
|
+
product_creator_id: int | None = None,
|
|
1613
|
+
product_developer_id: int | None = None,
|
|
1614
|
+
product_developer_name: str | None = None,
|
|
1615
|
+
operator_ids: int | list[int] | None = None,
|
|
1616
|
+
operator_update_mode: int | None = None,
|
|
1617
|
+
) -> schema.EditBundleProductResult:
|
|
1618
|
+
"""添加/编辑捆绑产品
|
|
1619
|
+
|
|
1620
|
+
## Docs
|
|
1621
|
+
- 产品: [添加/编辑捆绑产品](https://apidoc.lingxing.com/#/docs/Product/SetBundled)
|
|
1622
|
+
|
|
1623
|
+
## Notice
|
|
1624
|
+
- 默认参数 `None` 表示留空或不修改, 只有传入的对应参数才会被更新
|
|
1625
|
+
- 这点不同于 `EditSpuProduct` 方法, 其默认参数 `None` 表示重置设置,
|
|
1626
|
+
所有没有传入的参数都将被重置为默认值
|
|
1627
|
+
|
|
1628
|
+
:param bundle_sku `<'str'>`: 捆绑产品SKU (BundleProduct.bundle_sku)
|
|
1629
|
+
:param bundle_name `<'str'>`: 捆绑产品名称 (BundleProduct.bundle_name)
|
|
1630
|
+
:param items `<'dict/list[dict]'>`: 捆绑产品子产品字典或列表,
|
|
1631
|
+
新建捆绑产品时为必填项, 修改捆绑产品时选填 (覆盖模式)
|
|
1632
|
+
|
|
1633
|
+
- 每个字典必须包含 `lsku` 和 `bundle_qty` 字段, 如:
|
|
1634
|
+
`{"lsku": "SKU", "bundle_qty": 1}`
|
|
1635
|
+
- 必填字段 `lsku` 关联的子产品SKU, 必须为 str 类型
|
|
1636
|
+
- 必填字段 `bundle_qty` 关联的子产品捆绑数量, 必须为 int 类型
|
|
1637
|
+
- 可选字段 `cost_ratio` 关联的子产品费用占比, 必须为 float 类型,
|
|
1638
|
+
用于指定子产品在捆绑产品中的费用占比, 若填写则每项必填, 且总和为`1`
|
|
1639
|
+
|
|
1640
|
+
:param category_id `<'int'>`: 领星本地产品分类ID (当ID与名称同时存在时, ID优先),
|
|
1641
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
1642
|
+
:param category_name `<'str'>`: 领星本地产品分类名称,
|
|
1643
|
+
默认 `None` (留空或不修改)
|
|
1644
|
+
:param brand_id `<'int'>`: 领星本地产品品牌ID (当ID与名称同时存在时, ID优先),
|
|
1645
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
1646
|
+
:param brand_name `<'str'>`: 领星本地产品品牌名称,
|
|
1647
|
+
默认 `None` (留空或不修改)
|
|
1648
|
+
:param product_model `<'str'>`: 产品型号,
|
|
1649
|
+
默认 `None` (留空或不修改), 传入空字符串清除设置
|
|
1650
|
+
:param product_unit `<'str'>`: 产品单位,
|
|
1651
|
+
默认 `None` (留空或不修改), 传入空字符串清除设置
|
|
1652
|
+
:param product_description `<'str'>`: 产品描述,
|
|
1653
|
+
默认 `None` (留空或不修改), 传入空字符串清除设置
|
|
1654
|
+
:param product_images `<'dict/list[dict]'>`: 产品图片列表,
|
|
1655
|
+
默认 `None` (留空或不修改), 传入空列表清除设置
|
|
1656
|
+
|
|
1657
|
+
- 每个字典必须包含 `image_url` 和 `is_primary` 字段:
|
|
1658
|
+
- 必填字段 `image_url` 图片链接, 必须为 str 类型
|
|
1659
|
+
- 必填字段 `is_primary` 是否为主图, 必须为 int 类型 (0: 否, 1: 是)
|
|
1660
|
+
|
|
1661
|
+
:param product_creator_id `<'int'>`: 产品创建人ID,
|
|
1662
|
+
默认 `None` (默认API账号ID或不修改)
|
|
1663
|
+
:param product_developer_id `<'int'>`: 产品开发者用户ID (当ID与名称同时存在时, ID优先),
|
|
1664
|
+
默认 `None` (默认0或不修改), 传入 `0` 清除设置
|
|
1665
|
+
:param product_developer_name `<'str'>`: 产品开发者姓名,
|
|
1666
|
+
默认 `None` (留空或不修改), 传入空字符串清除设置
|
|
1667
|
+
:param operator_ids `<'int/list[int]'>`: 负责人帐号ID列表 (Account.user_id),
|
|
1668
|
+
默认 `None` (留空或不修改), 传入空列表清除设置
|
|
1669
|
+
:param operator_update_mode `<'int'>`: 负责人ID的更新模式 (0: 覆盖, 1: 追加),
|
|
1670
|
+
默认 `None` 追加模式
|
|
1671
|
+
:returns `<'EditBundleProductResult'>`: 返回添加/编辑捆绑产品的结果
|
|
1672
|
+
```python
|
|
1673
|
+
|
|
1674
|
+
# 状态码
|
|
1675
|
+
"code": 0,
|
|
1676
|
+
# 提示信息
|
|
1677
|
+
"message": "success",
|
|
1678
|
+
# 错误信息
|
|
1679
|
+
"errors": [],
|
|
1680
|
+
# 请求ID
|
|
1681
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
1682
|
+
# 响应时间
|
|
1683
|
+
"response_time": "2025-08-13 19:23:04",
|
|
1684
|
+
# 响应结果
|
|
1685
|
+
"data": {
|
|
1686
|
+
# 捆绑产品ID [原字段 'product_id']
|
|
1687
|
+
"bundle_id": 4*****,
|
|
1688
|
+
# 捆绑产品SKU [原字段 'sku']
|
|
1689
|
+
"bundle_sku": "BUNDLE-SKU",
|
|
1690
|
+
# 捆绑产品SKU识别码
|
|
1691
|
+
"sku_identifier": "",
|
|
1692
|
+
},
|
|
1693
|
+
}
|
|
1694
|
+
"""
|
|
1695
|
+
url = route.EDIT_BUNDLE_PRODUCT
|
|
1696
|
+
# 解析并验证参数
|
|
1697
|
+
args = {
|
|
1698
|
+
"bundle_sku": bundle_sku,
|
|
1699
|
+
"bundle_name": bundle_name,
|
|
1700
|
+
"items": items,
|
|
1701
|
+
"category_id": category_id,
|
|
1702
|
+
"category_name": category_name,
|
|
1703
|
+
"brand_id": brand_id,
|
|
1704
|
+
"brand_name": brand_name,
|
|
1705
|
+
"product_model": product_model,
|
|
1706
|
+
"product_unit": product_unit,
|
|
1707
|
+
"product_description": product_description,
|
|
1708
|
+
"product_images": product_images,
|
|
1709
|
+
"product_creator_id": product_creator_id,
|
|
1710
|
+
"product_developer_id": product_developer_id,
|
|
1711
|
+
"product_developer_name": product_developer_name,
|
|
1712
|
+
"operator_ids": operator_ids,
|
|
1713
|
+
"operator_update_mode": operator_update_mode,
|
|
1714
|
+
}
|
|
1715
|
+
try:
|
|
1716
|
+
p = param.EditBundleProduct.model_validate(args)
|
|
1717
|
+
except Exception as err:
|
|
1718
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
1719
|
+
|
|
1720
|
+
# 发送请求
|
|
1721
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
1722
|
+
return schema.EditBundleProductResult.model_validate(data)
|
|
1723
|
+
|
|
1724
|
+
async def AuxiliaryMaterials(
|
|
1725
|
+
self,
|
|
1726
|
+
*,
|
|
1727
|
+
offset: int | None = None,
|
|
1728
|
+
length: int | None = None,
|
|
1729
|
+
) -> schema.AuxiliaryMaterials:
|
|
1730
|
+
"""查询产品辅料
|
|
1731
|
+
|
|
1732
|
+
## Docs
|
|
1733
|
+
- 产品: [查询产品辅料列表](https://apidoc.lingxing.com/#/docs/Product/productAuxList)
|
|
1734
|
+
|
|
1735
|
+
:param offset `<'int'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
1736
|
+
:param length `<'int'>`: 分页长度, 最大支持 1000, 默认 `None` (使用: 1000)
|
|
1737
|
+
:returns `<'AuxiliaryMaterials'>`: 返回查询到的产品辅料列表
|
|
1738
|
+
```python
|
|
1739
|
+
{
|
|
1740
|
+
# 状态码
|
|
1741
|
+
"code": 0,
|
|
1742
|
+
# 提示信息
|
|
1743
|
+
"message": "success",
|
|
1744
|
+
# 错误信息
|
|
1745
|
+
"errors": [],
|
|
1746
|
+
# 请求ID
|
|
1747
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
1748
|
+
# 响应时间
|
|
1749
|
+
"response_time": "2025-08-13 19:23:04",
|
|
1750
|
+
# 响应数据量
|
|
1751
|
+
"response_count": 2,
|
|
1752
|
+
# 总数据量
|
|
1753
|
+
"total_count": 2,
|
|
1754
|
+
# 响应数据
|
|
1755
|
+
"data": [
|
|
1756
|
+
{
|
|
1757
|
+
# 辅料分类ID [原字段 'cid']
|
|
1758
|
+
"category_id": 0,
|
|
1759
|
+
# 辅料ID [原字段 'id']
|
|
1760
|
+
"aux_id": 4*****,
|
|
1761
|
+
# 辅料SKU [原字段 'sku']
|
|
1762
|
+
"aux_sku": "MAT*******",
|
|
1763
|
+
# 辅料名称 [原字段 'product_name']
|
|
1764
|
+
"aux_name": "包装箱",
|
|
1765
|
+
# 辅料净重 [原字段 'cg_product_net_weight']
|
|
1766
|
+
"aux_net_weight": 10.0,
|
|
1767
|
+
# 辅料长度 [原字段 'cg_product_length']
|
|
1768
|
+
"aux_length": 100.0,
|
|
1769
|
+
# 辅料宽度 [原字段 'cg_product_width']
|
|
1770
|
+
"aux_width": 100.0,
|
|
1771
|
+
# 辅料高度 [原字段 'cg_product_height']
|
|
1772
|
+
"aux_height": 100.0,
|
|
1773
|
+
# 辅料备注 [原字段 'remark']
|
|
1774
|
+
"aux_note": "",
|
|
1775
|
+
# 辅料采购价格 [原字段 'cg_price']
|
|
1776
|
+
"purchase_price": 10.0,
|
|
1777
|
+
# 辅料关联的产品列表 [原字段 'aux_relation_product']
|
|
1778
|
+
"associates": [
|
|
1779
|
+
{
|
|
1780
|
+
# 领星本地产品SKU [原字段 'sku']
|
|
1781
|
+
"lsku": "SKU*******",
|
|
1782
|
+
# 领星本地产品ID [原字段 'pid']
|
|
1783
|
+
"product_id": 4*****,
|
|
1784
|
+
# 领星本地产品名称
|
|
1785
|
+
"product_name": "P*********",
|
|
1786
|
+
# 产品关联辅料的数量 [原字段 'quantity']
|
|
1787
|
+
"aux_qty": 0,
|
|
1788
|
+
# 辅料配比数量 [原字段 'aux_qty']
|
|
1789
|
+
"aux_ratio_qty": 1,
|
|
1790
|
+
# 产品配比数据 [原字段 'sku_qty']
|
|
1791
|
+
"sku_ratio_qty": 1,
|
|
1792
|
+
}
|
|
1793
|
+
],
|
|
1794
|
+
# 供应商报价信息列表 [原字段 'supplier_quote']
|
|
1795
|
+
"supplier_quotes": [
|
|
1796
|
+
{
|
|
1797
|
+
# 领星本地产品ID
|
|
1798
|
+
"product_id": 4*****,
|
|
1799
|
+
# 供应商ID
|
|
1800
|
+
"supplier_id": 6***,
|
|
1801
|
+
# 供应商名称
|
|
1802
|
+
"supplier_name": "遵*****",
|
|
1803
|
+
# 供应商编码
|
|
1804
|
+
"supplier_code": "SU*****",
|
|
1805
|
+
# 供应商等级 [原字段 'level_text']
|
|
1806
|
+
"supplier_level": "",
|
|
1807
|
+
# 供应商员工数 [原字段 'employees_text']
|
|
1808
|
+
"supplier_employees": "",
|
|
1809
|
+
# 供应商产品链接 [原字段 'supplier_product_url']
|
|
1810
|
+
"supplier_product_urls": [],
|
|
1811
|
+
# 供应商备注 [原字段 'remark']
|
|
1812
|
+
"supplier_note": "",
|
|
1813
|
+
# 是否是首选供应商 (0: 否, 1: 是) [原字段 'is_primary']
|
|
1814
|
+
"is_primary_supplier": 1,
|
|
1815
|
+
# 报价ID [原字段 'psq_id']
|
|
1816
|
+
"quote_id": 21****************,
|
|
1817
|
+
# 报价货币符号 [原字段 'cg_currency_icon']
|
|
1818
|
+
"quote_currency_icon": "¥",
|
|
1819
|
+
# 报价单价 [原字段 'cg_price']
|
|
1820
|
+
"quote_price": 10.0,
|
|
1821
|
+
# 报价交期 (单位: 天) [原字段 'quote_cg_delivery']
|
|
1822
|
+
"quote_delivery_time": 14,
|
|
1823
|
+
# 报价备注 [原字段 'quote_remark']
|
|
1824
|
+
"quote_note": "",
|
|
1825
|
+
# 报价列表 [原字段 'quotes']
|
|
1826
|
+
"quotes": [
|
|
1827
|
+
{
|
|
1828
|
+
# 报价货币代码 [原字段 'currency']
|
|
1829
|
+
"currency_code": "CNY",
|
|
1830
|
+
# 报价货币符号
|
|
1831
|
+
"currency_icon": "¥",
|
|
1832
|
+
# 报价是否含税 (0: 否, 1: 是) [原字段 'is_tax']
|
|
1833
|
+
"is_tax_inclusive": 1,
|
|
1834
|
+
# 报价税率 (百分比)
|
|
1835
|
+
"tax_rate": 5.0,
|
|
1836
|
+
# 报价梯度 [原字段 'step_prices']
|
|
1837
|
+
"price_tiers": [
|
|
1838
|
+
{
|
|
1839
|
+
# 最小订购量
|
|
1840
|
+
"moq": 10,
|
|
1841
|
+
# 报价 (不含税) [原字段 'price']
|
|
1842
|
+
"price_excl_tax": 10.0,
|
|
1843
|
+
# 报价 (含税)
|
|
1844
|
+
"price_with_tax": 10.5,
|
|
1845
|
+
},
|
|
1846
|
+
...
|
|
1847
|
+
],
|
|
1848
|
+
},
|
|
1849
|
+
...
|
|
1850
|
+
],
|
|
1851
|
+
},
|
|
1852
|
+
...
|
|
1853
|
+
],
|
|
1854
|
+
}
|
|
1855
|
+
...
|
|
1856
|
+
],
|
|
1857
|
+
}
|
|
1858
|
+
"""
|
|
1859
|
+
url = route.AUXILIARY_MATERIALS
|
|
1860
|
+
# 解析并验证参数
|
|
1861
|
+
args = {"offset": offset, "length": length}
|
|
1862
|
+
try:
|
|
1863
|
+
p = base_param.PageOffestAndLength.model_validate(args)
|
|
1864
|
+
except Exception as err:
|
|
1865
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
1866
|
+
|
|
1867
|
+
# 发送请求
|
|
1868
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
1869
|
+
return schema.AuxiliaryMaterials.model_validate(data)
|
|
1870
|
+
|
|
1871
|
+
async def EditAuxiliaryMaterial(
|
|
1872
|
+
self,
|
|
1873
|
+
aux_sku: str,
|
|
1874
|
+
aux_name: str,
|
|
1875
|
+
*,
|
|
1876
|
+
aux_net_weight: int | float | None = None,
|
|
1877
|
+
aux_length: int | float | None = None,
|
|
1878
|
+
aux_width: int | float | None = None,
|
|
1879
|
+
aux_height: int | float | None = None,
|
|
1880
|
+
aux_note: str | None = None,
|
|
1881
|
+
purchase_price: int | float | None = None,
|
|
1882
|
+
supplier_quotes: dict | list[dict] | None = None,
|
|
1883
|
+
) -> schema.EditAuxiliaryMaterialResult:
|
|
1884
|
+
"""添加/编辑辅料
|
|
1885
|
+
|
|
1886
|
+
## Docs
|
|
1887
|
+
- 产品: [添加/编辑辅料](https://apidoc.lingxing.com/#/docs/Product/setAux)
|
|
1888
|
+
|
|
1889
|
+
## Notice
|
|
1890
|
+
- 默认参数 `None` 表示重置设置, 所有没有传入的参数都将被重置为默认值
|
|
1891
|
+
- 这点不同于 `EditProduct` 方法, 其默认参数 `None` 表示留空或不修改,
|
|
1892
|
+
只有传入的对应参数才会被更新
|
|
1893
|
+
|
|
1894
|
+
:param aux_sku `<'str'>`: 辅料SKU (AuxiliaryMaterial.aux_sku)
|
|
1895
|
+
:param aux_name `<'str'>`: 辅料名称 (AuxiliaryMaterial.aux_name)
|
|
1896
|
+
:param aux_net_weight `<'int/float'>`: 辅料净重 (单位: G),
|
|
1897
|
+
默认 `None`, 不同于 `EditProduct`, 表示重置设置或默认0
|
|
1898
|
+
:param aux_length `<'int/float'>`: 辅料长度 (单位: CM),
|
|
1899
|
+
默认 `None`, 不同于 `EditProduct`, 表示重置设置或默认0
|
|
1900
|
+
:param aux_width `<'int/float'>`: 辅料宽度 (单位: CM),
|
|
1901
|
+
默认 `None`, 不同于 `EditProduct`, 表示重置设置或默认0
|
|
1902
|
+
:param aux_height `<'int/float'>`: 辅料高度 (单位: CM),
|
|
1903
|
+
默认 `None`, 不同于 `EditProduct`, 表示重置设置或默认0
|
|
1904
|
+
:param aux_note `<'str'>`: 辅料备注,
|
|
1905
|
+
默认 `None`, 不同于 `EditProduct`, 表示重置设置或默认空字符串
|
|
1906
|
+
:param purchase_price `<'int/float'>`: 辅料采购价格,
|
|
1907
|
+
默认 `None`, 不同于 `EditProduct`, 表示重置设置或默认0
|
|
1908
|
+
:param supplier_quotes `<'dict/list[dict]'>`: 供应商报价信息列表,
|
|
1909
|
+
默认 `None`, 不同于 `EditProduct`, 表示重置设置或默认空
|
|
1910
|
+
|
|
1911
|
+
- 每个字典必须包含 `supplier_id`, `is_primary`, `quotes` 字段:
|
|
1912
|
+
- 必填字段 `supplier_id` 供应商ID, 必须为 int 类型 (`Supplier.supplier_id`)
|
|
1913
|
+
- 必填字段 `is_primary` 是否是首选供应商, 必须为 int 类型 (0: 否, 1: 是)
|
|
1914
|
+
- 必填字段 `quotes` 供应商报价列表, 必须为 dict/list[dict] 类型, 每个字典必须包含以下字段:
|
|
1915
|
+
* 必填字段 `quotes.currency_code` 报价货币代码, 必须为 str
|
|
1916
|
+
* 必填字段 `quotes.is_tax_inclusive` 报价是否含税, 必须为 int 类型 (0: 否, 1: 是)
|
|
1917
|
+
* 必填字段 `quotes.tax_rate` 报价税率, 必须为 float 类型 (百分比, 如 5% 则传 5)
|
|
1918
|
+
* 必填字段 `quotes.price_tiers` 报价梯度, 必须为 dict/list[dict] 类型, 每个字典必须包含以下字段:
|
|
1919
|
+
+ 必填字段 `quotes.price_tiers.moq` 最小订购量, 必须为 int 类型
|
|
1920
|
+
+ 必填字段 `quotes.price_tiers.price_with_tax` 报价 (含税), 必须为 int/float 类型
|
|
1921
|
+
- 可选字段 `product_urls` 供应商产品链接列表, 必须为 str/list[str] 类型, 不传重置为空列表
|
|
1922
|
+
- 可选字段 `supplier_note` 供应商备注, 必须为 str 类型, 不传重置为空字符串
|
|
1923
|
+
|
|
1924
|
+
:returns `<'EditAuxiliaryMaterialResult'>`: 返回添加/编辑辅料的结果
|
|
1925
|
+
```python
|
|
1926
|
+
{
|
|
1927
|
+
# 状态码
|
|
1928
|
+
"code": 0,
|
|
1929
|
+
# 提示信息
|
|
1930
|
+
"message": "success",
|
|
1931
|
+
# 错误信息
|
|
1932
|
+
"errors": [],
|
|
1933
|
+
# 请求ID
|
|
1934
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
1935
|
+
# 响应时间
|
|
1936
|
+
"response_time": "2025-08-13 19:23:04",
|
|
1937
|
+
# 响应结果
|
|
1938
|
+
"data": {
|
|
1939
|
+
# 辅料ID [原字段 'product_id']
|
|
1940
|
+
"aux_id": 4*****,
|
|
1941
|
+
# 辅料SKU [原字段 'sku']
|
|
1942
|
+
"aux_sku": "MAT*******",
|
|
1943
|
+
# 辅料SKU识别码
|
|
1944
|
+
"sku_identifier": "",
|
|
1945
|
+
},
|
|
1946
|
+
}
|
|
1947
|
+
```
|
|
1948
|
+
"""
|
|
1949
|
+
url = route.EDIT_AUXILIARY_MATERIAL
|
|
1950
|
+
# 解析并验证参数
|
|
1951
|
+
args = {
|
|
1952
|
+
"aux_sku": aux_sku,
|
|
1953
|
+
"aux_name": aux_name,
|
|
1954
|
+
"aux_net_weight": aux_net_weight,
|
|
1955
|
+
"aux_length": aux_length,
|
|
1956
|
+
"aux_width": aux_width,
|
|
1957
|
+
"aux_height": aux_height,
|
|
1958
|
+
"aux_note": aux_note,
|
|
1959
|
+
"purchase_price": purchase_price,
|
|
1960
|
+
"supplier_quotes": supplier_quotes,
|
|
1961
|
+
}
|
|
1962
|
+
try:
|
|
1963
|
+
p = param.EditAuxiliaryMaterial.model_validate(args)
|
|
1964
|
+
except Exception as err:
|
|
1965
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
1966
|
+
|
|
1967
|
+
# 发送请求
|
|
1968
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
1969
|
+
return schema.EditAuxiliaryMaterialResult.model_validate(data)
|
|
1970
|
+
|
|
1971
|
+
async def ProductCodes(
|
|
1972
|
+
self,
|
|
1973
|
+
*,
|
|
1974
|
+
offset: int | None = None,
|
|
1975
|
+
length: int | None = None,
|
|
1976
|
+
) -> schema.ProductCodes:
|
|
1977
|
+
"""查询产品编码 (UPC/EAN/ISBN)
|
|
1978
|
+
|
|
1979
|
+
## Docs
|
|
1980
|
+
- 产品: [获取UPC编码列表](https://apidoc.lingxing.com/#/docs/Product/UpcList)
|
|
1981
|
+
|
|
1982
|
+
:param offset `<'int'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
1983
|
+
:param length `<'int'>`: 分页长度, 最大值200, 默认 `None` (使用: 20)
|
|
1984
|
+
:returns `<'ProductCodes'>`: 返回查询到的产品编码列表
|
|
1985
|
+
```python
|
|
1986
|
+
{
|
|
1987
|
+
# 状态码
|
|
1988
|
+
"code": 0,
|
|
1989
|
+
# 提示信息
|
|
1990
|
+
"message": "success",
|
|
1991
|
+
# 错误信息
|
|
1992
|
+
"errors": [],
|
|
1993
|
+
# 请求ID
|
|
1994
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
1995
|
+
# 响应时间
|
|
1996
|
+
"response_time": "2025-08-13 19:23:04",
|
|
1997
|
+
# 响应数据量
|
|
1998
|
+
"response_count": 2,
|
|
1999
|
+
# 总数据量
|
|
2000
|
+
"total_count": 2,
|
|
2001
|
+
# 响应数据
|
|
2002
|
+
"data": [
|
|
2003
|
+
{
|
|
2004
|
+
# 产品编码 ID [原字段 'id']
|
|
2005
|
+
"code_id": 1,
|
|
2006
|
+
# 产品编码 [原字段 'commodity_code']
|
|
2007
|
+
"code": "1234567890123",
|
|
2008
|
+
# 编码类型
|
|
2009
|
+
"code_type": "UPC",
|
|
2010
|
+
# 编码备注 [原字段 'remark']
|
|
2011
|
+
"code_note": "",
|
|
2012
|
+
# 编码状态 (0: 未使用, 1: 已使用) [原字段 'is_used']
|
|
2013
|
+
"status": 0,
|
|
2014
|
+
# 编码状态描述 [原字段 'is_used_desc']
|
|
2015
|
+
"status_desc": "未使用",
|
|
2016
|
+
# 创建人的用户ID (Account_user_id) [原字段 'created_user_id']
|
|
2017
|
+
"create_user_id": 1*******,
|
|
2018
|
+
# 创建时间 (北京时间) [原字段 'gmt_create']
|
|
2019
|
+
"create_time": "2025-07-23 17:46:58",
|
|
2020
|
+
# 使用人的用户ID (Account_user_id)
|
|
2021
|
+
"use_user_id": 1*******,
|
|
2022
|
+
# 使用时间 (北京时间)
|
|
2023
|
+
"use_time": "2025-07-23 18:46:58",
|
|
2024
|
+
},
|
|
2025
|
+
...
|
|
2026
|
+
],
|
|
2027
|
+
}
|
|
2028
|
+
```
|
|
2029
|
+
"""
|
|
2030
|
+
url = route.PRODUCT_CODES
|
|
2031
|
+
# 解析并验证参数
|
|
2032
|
+
args = {"offset": offset, "length": length}
|
|
2033
|
+
try:
|
|
2034
|
+
p = base_param.PageOffestAndLength.model_validate(args)
|
|
2035
|
+
except Exception as err:
|
|
2036
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
2037
|
+
|
|
2038
|
+
# 发送请求
|
|
2039
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
2040
|
+
return schema.ProductCodes.model_validate(data)
|
|
2041
|
+
|
|
2042
|
+
async def CreateProductCode(
|
|
2043
|
+
self,
|
|
2044
|
+
code_type: PRODUCT_CODE_TYPE,
|
|
2045
|
+
*codes: str,
|
|
2046
|
+
) -> base_schema.ResponseResult:
|
|
2047
|
+
"""批量添加产品编码 (UPC/EAN/ISBN)
|
|
2048
|
+
|
|
2049
|
+
## Docs
|
|
2050
|
+
- 产品: [创建UPC编码](https://apidoc.lingxing.com/#/docs/Product/AddCommodityCode)
|
|
2051
|
+
|
|
2052
|
+
:param code_type `<'str'>`: 编码类型, 可选值: `"UPC"`, `"EAN"`, `"ISBN"`
|
|
2053
|
+
:param codes `<'str'>`: 一个或多个产品编码
|
|
2054
|
+
:returns `<'ResponseResult'>`: 返返回添加产品编码结果
|
|
2055
|
+
```python
|
|
2056
|
+
{
|
|
2057
|
+
# 状态码
|
|
2058
|
+
"code": 0,
|
|
2059
|
+
# 提示信息
|
|
2060
|
+
"message": "success",
|
|
2061
|
+
# 错误信息
|
|
2062
|
+
"errors": [],
|
|
2063
|
+
# 请求ID
|
|
2064
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
2065
|
+
# 响应时间
|
|
2066
|
+
"response_time": "2025-08-13 19:23:04",
|
|
2067
|
+
# 响应结果
|
|
2068
|
+
"data": ["1234567890123", ...]
|
|
2069
|
+
}
|
|
2070
|
+
```
|
|
2071
|
+
"""
|
|
2072
|
+
url = route.CREATE_PRODUCT_CODE
|
|
2073
|
+
# 解析并验证参数
|
|
2074
|
+
args = {"code_type": code_type, "codes": codes}
|
|
2075
|
+
try:
|
|
2076
|
+
p = param.CreateProductCode.model_validate(args)
|
|
2077
|
+
except Exception as err:
|
|
2078
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
2079
|
+
|
|
2080
|
+
# 发送请求
|
|
2081
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
2082
|
+
return base_schema.ResponseResult.model_validate(data)
|
|
2083
|
+
|
|
2084
|
+
async def ProductGlobalTags(self) -> schema.ProductGlobalTags:
|
|
2085
|
+
"""查询产品可设置的全局标签
|
|
2086
|
+
|
|
2087
|
+
## Docs
|
|
2088
|
+
- 产品: [查询产品标签](https://apidoc.lingxing.com/#/docs/Product/GetProductTag)
|
|
2089
|
+
|
|
2090
|
+
:returns `<'ProductGlobalTags'>`: 返回查询到的产品全局标签
|
|
2091
|
+
```python
|
|
2092
|
+
{
|
|
2093
|
+
# 状态码
|
|
2094
|
+
"code": 0,
|
|
2095
|
+
# 提示信息
|
|
2096
|
+
"message": "success",
|
|
2097
|
+
# 错误信息
|
|
2098
|
+
"errors": [],
|
|
2099
|
+
# 请求ID
|
|
2100
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
2101
|
+
# 响应时间
|
|
2102
|
+
"response_time": "2025-08-13 19:23:04",
|
|
2103
|
+
# 响应数据量
|
|
2104
|
+
"response_count": 2,
|
|
2105
|
+
# 总数据量
|
|
2106
|
+
"total_count": 2,
|
|
2107
|
+
# 响应数据
|
|
2108
|
+
"data": [
|
|
2109
|
+
{
|
|
2110
|
+
# 全局标签ID [原字段 'label_id']
|
|
2111
|
+
"tag_id": 1,
|
|
2112
|
+
# 全局标签名称 [原字段 'label_name']
|
|
2113
|
+
"tag_name": "新品",
|
|
2114
|
+
# 全局标签创建时间 (北京时间, 时间戳) [原字段 'gmt_created']
|
|
2115
|
+
"create_time_ts": 1753330280000
|
|
2116
|
+
},
|
|
2117
|
+
...
|
|
2118
|
+
],
|
|
2119
|
+
}
|
|
2120
|
+
"""
|
|
2121
|
+
url = route.PRODUCT_GLOBAL_TAGS
|
|
2122
|
+
# 发送请求
|
|
2123
|
+
data = await self._request_with_sign("GET", url)
|
|
2124
|
+
return schema.ProductGlobalTags.model_validate(data)
|
|
2125
|
+
|
|
2126
|
+
async def CreateProductGlobalTag(
|
|
2127
|
+
self,
|
|
2128
|
+
tag_name: str,
|
|
2129
|
+
) -> schema.CreateProductGlobalTagResult:
|
|
2130
|
+
"""创建产品可设置的全局标签
|
|
2131
|
+
|
|
2132
|
+
## Docs
|
|
2133
|
+
- 产品: [创建产品标签](https://apidoc.lingxing.com/#/docs/Product/CreateProductTag)
|
|
2134
|
+
|
|
2135
|
+
:param tag_name `<'str'>`: 新全局标签名称
|
|
2136
|
+
:returns `<'CreateProductGlobalTagResult'>`: 返回创建全局标签的结果
|
|
2137
|
+
```python
|
|
2138
|
+
{
|
|
2139
|
+
# 状态码
|
|
2140
|
+
"code": 0,
|
|
2141
|
+
# 提示信息
|
|
2142
|
+
"message": "success",
|
|
2143
|
+
# 错误信息
|
|
2144
|
+
"errors": [],
|
|
2145
|
+
# 请求ID
|
|
2146
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
2147
|
+
# 响应时间
|
|
2148
|
+
"response_time": "2025-08-13 19:23:04",
|
|
2149
|
+
# 响应结果
|
|
2150
|
+
"data": {
|
|
2151
|
+
# 全局标签ID [原字段 'label_id']
|
|
2152
|
+
"tag_id": 1,
|
|
2153
|
+
# 全局标签名称 [原字段 'label_name']
|
|
2154
|
+
"tag_name": "新品",
|
|
2155
|
+
},
|
|
2156
|
+
}
|
|
2157
|
+
"""
|
|
2158
|
+
url = route.CREATE_PRODUCT_GLOBAL_TAG
|
|
2159
|
+
# 解析并验证参数
|
|
2160
|
+
args = {"tag_name": tag_name}
|
|
2161
|
+
try:
|
|
2162
|
+
p = param.CreateProductGlobalTag.model_validate(args)
|
|
2163
|
+
except Exception as err:
|
|
2164
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
2165
|
+
|
|
2166
|
+
# 发送请求
|
|
2167
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
2168
|
+
return schema.CreateProductGlobalTagResult.model_validate(data)
|
|
2169
|
+
|
|
2170
|
+
async def SetProductTag(
|
|
2171
|
+
self,
|
|
2172
|
+
mode: int,
|
|
2173
|
+
*product_tags: dict,
|
|
2174
|
+
) -> base_schema.ResponseResult:
|
|
2175
|
+
"""批量给指定产品设置标签
|
|
2176
|
+
|
|
2177
|
+
## Docs
|
|
2178
|
+
- 产品: [标记产品标签](https://apidoc.lingxing.com/#/docs/Product/SetProductTag)
|
|
2179
|
+
|
|
2180
|
+
:param mode `<'int'>`: 设置模式
|
|
2181
|
+
|
|
2182
|
+
- `1`: 追加新的标签
|
|
2183
|
+
- `2`: 覆盖现有标签
|
|
2184
|
+
|
|
2185
|
+
:param *product_tags `<'dict'>`: 需要设置对应标签的产品信息
|
|
2186
|
+
|
|
2187
|
+
- 每个字典必须包含 `lsku` 和 `tags` 字段, 如:
|
|
2188
|
+
`{"lsku": "SKU12345", "tags": ["新品", "热销"]}`
|
|
2189
|
+
- 必填字段 `lsku` 领星本地产品的SKU, 参数来源 `Product.lsku`
|
|
2190
|
+
- 必填字段 `tags` 产品标签名称或名称列表, 参数来源 `ProductGlobalTag.tag_name`
|
|
2191
|
+
|
|
2192
|
+
:returns `<'ResponseResult'>`: 返回设置标签的结果
|
|
2193
|
+
```python
|
|
2194
|
+
{
|
|
2195
|
+
# 状态码
|
|
2196
|
+
"code": 0,
|
|
2197
|
+
# 提示信息
|
|
2198
|
+
"message": "success",
|
|
2199
|
+
# 错误信息
|
|
2200
|
+
"errors": [],
|
|
2201
|
+
# 请求ID
|
|
2202
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
2203
|
+
# 响应时间
|
|
2204
|
+
"response_time": "2025-08-13 19:23:04",
|
|
2205
|
+
# 响应结果
|
|
2206
|
+
"data": None
|
|
2207
|
+
}
|
|
2208
|
+
```
|
|
2209
|
+
"""
|
|
2210
|
+
url = route.SET_PRODUCT_TAG
|
|
2211
|
+
# 解析并验证参数
|
|
2212
|
+
args = {"mode": mode, "product_tags": product_tags}
|
|
2213
|
+
try:
|
|
2214
|
+
p = param.SetProductTag.model_validate(args)
|
|
2215
|
+
except Exception as err:
|
|
2216
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
2217
|
+
|
|
2218
|
+
# 发送请求
|
|
2219
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
2220
|
+
return base_schema.ResponseResult.model_validate(data)
|
|
2221
|
+
|
|
2222
|
+
async def UnsetProductTag(
|
|
2223
|
+
self,
|
|
2224
|
+
mode: int,
|
|
2225
|
+
*product_tags: dict,
|
|
2226
|
+
) -> base_schema.ResponseResult:
|
|
2227
|
+
"""批量给指定产品删除标签
|
|
2228
|
+
|
|
2229
|
+
## Docs
|
|
2230
|
+
- 产品: [删除产品标签](https://apidoc.lingxing.com/#/docs/Product/DelProductTag)
|
|
2231
|
+
|
|
2232
|
+
:param mode `<'int'>`: 删除模式
|
|
2233
|
+
|
|
2234
|
+
- `1`: 删除SKU指定的标签
|
|
2235
|
+
- `2`: 删除SKU全部的标签, [此模式下, 对应 lsku 的 tags 为 `None` 即可]
|
|
2236
|
+
|
|
2237
|
+
:param *product_tags `<'dict'>`: 需要删除对应标签的产品信息
|
|
2238
|
+
|
|
2239
|
+
- 每个字典必须包含 `lsku` 和 `tags` 字段, 如:
|
|
2240
|
+
`{"lsku": "SKU12345", "tags": ["新品", "热销"]}`
|
|
2241
|
+
- 必填字段 `lsku` 领星本地产品的SKU, 参数来源 `Product.lsku`
|
|
2242
|
+
- 必填字段 `tags` 产品标签名称或名称列表, 参数来源 `ProductGlobalTag.tag_name`
|
|
2243
|
+
|
|
2244
|
+
:returns `<'ResponseResult'>`: 返回删除标签的结果
|
|
2245
|
+
```python
|
|
2246
|
+
{
|
|
2247
|
+
# 状态码
|
|
2248
|
+
"code": 0,
|
|
2249
|
+
# 提示信息
|
|
2250
|
+
"message": "success",
|
|
2251
|
+
# 错误信息
|
|
2252
|
+
"errors": [],
|
|
2253
|
+
# 请求ID
|
|
2254
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
2255
|
+
# 响应时间
|
|
2256
|
+
"response_time": "2025-08-13 19:23:04",
|
|
2257
|
+
# 响应结果
|
|
2258
|
+
"data": None
|
|
2259
|
+
}
|
|
2260
|
+
```
|
|
2261
|
+
"""
|
|
2262
|
+
url = route.UNSET_PRODUCT_TAG
|
|
2263
|
+
# 解析并验证参数
|
|
2264
|
+
args = {"mode": mode, "product_tags": product_tags}
|
|
2265
|
+
try:
|
|
2266
|
+
p = param.UnsetProductTag.model_validate(args)
|
|
2267
|
+
except Exception as err:
|
|
2268
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
2269
|
+
|
|
2270
|
+
# 发送请求
|
|
2271
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
2272
|
+
return base_schema.ResponseResult.model_validate(data)
|
|
2273
|
+
|
|
2274
|
+
async def ProductGlobalAttributes(
|
|
2275
|
+
self,
|
|
2276
|
+
*,
|
|
2277
|
+
offset: int | None = None,
|
|
2278
|
+
length: int | None = None,
|
|
2279
|
+
) -> schema.ProductGlobalAttributes:
|
|
2280
|
+
"""查询产品可设置的全局属性
|
|
2281
|
+
|
|
2282
|
+
## Docs
|
|
2283
|
+
- 产品: [查询产品属性列表](https://apidoc.lingxing.com/#/docs/Product/attributeList)
|
|
2284
|
+
|
|
2285
|
+
:param offset `<'int'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
2286
|
+
:param length `<'int'>`: 分页长度, 最大支持 200, 默认 `None` (使用: 20)
|
|
2287
|
+
:returns `<'ProductGlobalAttributes'>`: 返回查询到的产品属性列表
|
|
2288
|
+
```python
|
|
2289
|
+
{
|
|
2290
|
+
# 状态码
|
|
2291
|
+
"code": 0,
|
|
2292
|
+
# 提示信息
|
|
2293
|
+
"message": "success",
|
|
2294
|
+
# 错误信息
|
|
2295
|
+
"errors": [],
|
|
2296
|
+
# 请求ID
|
|
2297
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
2298
|
+
# 响应时间
|
|
2299
|
+
"response_time": "2025-08-13 19:23:04",
|
|
2300
|
+
# 响应数据量
|
|
2301
|
+
"response_count": 2,
|
|
2302
|
+
# 总数据量
|
|
2303
|
+
"total_count": 2,
|
|
2304
|
+
# 响应数据
|
|
2305
|
+
"data": [
|
|
2306
|
+
{
|
|
2307
|
+
# 产品属性ID [原字段 'pa_id']
|
|
2308
|
+
"attr_id": 1,
|
|
2309
|
+
# 产品属性名称
|
|
2310
|
+
"attr_name": "香薰机",
|
|
2311
|
+
# 产品属性编码
|
|
2312
|
+
"attr_code": "XXJ",
|
|
2313
|
+
# 产品子属性列表 [原字段 'item_list']
|
|
2314
|
+
"attr_values": [
|
|
2315
|
+
{
|
|
2316
|
+
# 产品属性ID 【原字段 'pa_id'】
|
|
2317
|
+
"attr_id": 1,
|
|
2318
|
+
# 产品属性值ID [原字段 'pai_id']
|
|
2319
|
+
"attr_value_id": 100,
|
|
2320
|
+
# 产品属性值编码 [原字段 'attr_val_code']
|
|
2321
|
+
"attr_value_code": "BLUE",
|
|
2322
|
+
# 产品属性值 [原字段 'attr_value']
|
|
2323
|
+
"attr_value": "蓝色",
|
|
2324
|
+
# 产品属性值创建时间 (北京时间)
|
|
2325
|
+
"create_time": "2024-08-13 14:04:13",
|
|
2326
|
+
},
|
|
2327
|
+
...
|
|
2328
|
+
],
|
|
2329
|
+
# 产品属性创建时间 (北京时间)
|
|
2330
|
+
"create_time": "2024-08-13 14:04:13",
|
|
2331
|
+
},
|
|
2332
|
+
...
|
|
2333
|
+
],
|
|
2334
|
+
}
|
|
2335
|
+
```
|
|
2336
|
+
"""
|
|
2337
|
+
url = route.PRODUCT_GLOBAL_ATTRIBUTES
|
|
2338
|
+
# 解析并验证参数
|
|
2339
|
+
args = {"offset": offset, "length": length}
|
|
2340
|
+
try:
|
|
2341
|
+
p = base_param.PageOffestAndLength.model_validate(args)
|
|
2342
|
+
except Exception as err:
|
|
2343
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
2344
|
+
|
|
2345
|
+
# 发送请求
|
|
2346
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
2347
|
+
return schema.ProductGlobalAttributes.model_validate(data)
|
|
2348
|
+
|
|
2349
|
+
async def EditProductGlobalAttribute(
|
|
2350
|
+
self,
|
|
2351
|
+
attr_name: str,
|
|
2352
|
+
attr_values: str | dict | list[str | dict],
|
|
2353
|
+
*,
|
|
2354
|
+
attr_id: int | None = None,
|
|
2355
|
+
) -> base_schema.ResponseResult:
|
|
2356
|
+
"""添加/编辑产品可设置的全局属性
|
|
2357
|
+
|
|
2358
|
+
## Docs
|
|
2359
|
+
- 产品: [添加/编辑产品属性](https://apidoc.lingxing.com/#/docs/Product/attributeSet)
|
|
2360
|
+
|
|
2361
|
+
## Notice
|
|
2362
|
+
- 1. 接口对属性数据为覆盖式操作,入参属性值会全量覆盖系统里已存在属性内容
|
|
2363
|
+
- 2. 属性值有关联SPU的情况下, 不允许对该属性值有编辑、删除操作
|
|
2364
|
+
- 3. 如需对已存在属性新增属性值, 入参为: 该属性下已存在属性值 + 新增属性值
|
|
2365
|
+
- 4. 如 `attr_id` 与 `attr_value_id` 都不传,视为新增属性
|
|
2366
|
+
|
|
2367
|
+
:param attr_name `<'str'>`: 产品属性名称
|
|
2368
|
+
:param attr_values `<'str/dict/list'>`: 产品属性值, 可以是字符串、字典或字符串列表
|
|
2369
|
+
|
|
2370
|
+
- `<'str'>`: 单个属性值
|
|
2371
|
+
- `<'dict'>`: 包含 `attr_value` 和 `attr_value_id` 的键值对
|
|
2372
|
+
- `<'list'>`: 多个属性值的列表, 子元素可以是字符串或字典
|
|
2373
|
+
|
|
2374
|
+
:param attr_id `<'int'>`: 产品属性ID, 默认 `None` (新增属性)
|
|
2375
|
+
:returns `<'ResponseResult'>`: 返回添加/编辑属性结果
|
|
2376
|
+
```python
|
|
2377
|
+
{
|
|
2378
|
+
# 状态码
|
|
2379
|
+
"code": 0,
|
|
2380
|
+
# 提示信息
|
|
2381
|
+
"message": "success",
|
|
2382
|
+
# 错误信息
|
|
2383
|
+
"errors": [],
|
|
2384
|
+
# 请求ID
|
|
2385
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
2386
|
+
# 响应时间
|
|
2387
|
+
"response_time": "2025-08-13 19:23:04",
|
|
2388
|
+
# 响应结果
|
|
2389
|
+
"data": None
|
|
2390
|
+
}
|
|
2391
|
+
```
|
|
2392
|
+
"""
|
|
2393
|
+
url = route.EDIT_PRODUCT_GLOBAL_ATTRIBUTE
|
|
2394
|
+
# 解析并验证参数
|
|
2395
|
+
args = {"attr_name": attr_name, "attr_values": attr_values, "attr_id": attr_id}
|
|
2396
|
+
try:
|
|
2397
|
+
p = param.EditProductGlobalAttribute.model_validate(args)
|
|
2398
|
+
except Exception as err:
|
|
2399
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
2400
|
+
|
|
2401
|
+
# 发送请求
|
|
2402
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
2403
|
+
return base_schema.ResponseResult.model_validate(data)
|
|
2404
|
+
|
|
2405
|
+
async def ProductBrands(
|
|
2406
|
+
self,
|
|
2407
|
+
*,
|
|
2408
|
+
offset: int | None = None,
|
|
2409
|
+
length: int | None = None,
|
|
2410
|
+
) -> schema.ProductBrands:
|
|
2411
|
+
"""查询产品品牌
|
|
2412
|
+
|
|
2413
|
+
## Docs
|
|
2414
|
+
- 产品: [查询产品品牌列表](https://apidoc.lingxing.com/#/docs/Product/productBrandList)
|
|
2415
|
+
|
|
2416
|
+
:param offset `<'int'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
2417
|
+
:param length `<'int'>`: 分页长度, 最大支持 1000, 默认 `None` (使用: 1000)
|
|
2418
|
+
:returns `<'ProductBrands'>`: 返回查询到的产品品牌列表
|
|
2419
|
+
```python
|
|
2420
|
+
{
|
|
2421
|
+
# 状态码
|
|
2422
|
+
"code": 0,
|
|
2423
|
+
# 提示信息
|
|
2424
|
+
"message": "success",
|
|
2425
|
+
# 错误信息
|
|
2426
|
+
"errors": [],
|
|
2427
|
+
# 请求ID
|
|
2428
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
2429
|
+
# 响应时间
|
|
2430
|
+
"response_time": "2025-08-13 19:23:04",
|
|
2431
|
+
# 响应数据量
|
|
2432
|
+
"response_count": 2,
|
|
2433
|
+
# 总数据量
|
|
2434
|
+
"total_count": 2,
|
|
2435
|
+
# 响应数据
|
|
2436
|
+
"data": [
|
|
2437
|
+
{
|
|
2438
|
+
# 领星本地品牌ID [原字段 'bid']
|
|
2439
|
+
"brand_id": 1,
|
|
2440
|
+
# 品牌名称 [原字段 'title']
|
|
2441
|
+
"brand_name": "FastTech",
|
|
2442
|
+
# 品牌编码
|
|
2443
|
+
"brand_code": "",
|
|
2444
|
+
},
|
|
2445
|
+
...
|
|
2446
|
+
],
|
|
2447
|
+
}
|
|
2448
|
+
```
|
|
2449
|
+
"""
|
|
2450
|
+
url = route.PRODUCT_BRANDS
|
|
2451
|
+
# 解析并验证参数
|
|
2452
|
+
args = {"offset": offset, "length": length}
|
|
2453
|
+
try:
|
|
2454
|
+
p = base_param.PageOffestAndLength.model_validate(args)
|
|
2455
|
+
except Exception as err:
|
|
2456
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
2457
|
+
|
|
2458
|
+
# 发送请求
|
|
2459
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
2460
|
+
return schema.ProductBrands.model_validate(data)
|
|
2461
|
+
|
|
2462
|
+
async def EditProductBrands(
|
|
2463
|
+
self,
|
|
2464
|
+
*brand: str | dict,
|
|
2465
|
+
) -> schema.EditProductBrandsResult:
|
|
2466
|
+
"""添加/编辑产品品牌
|
|
2467
|
+
|
|
2468
|
+
## Docs
|
|
2469
|
+
- 产品: [添加/编辑产品品牌](https://apidoc.lingxing.com/#/docs/Product/SetBrand)
|
|
2470
|
+
|
|
2471
|
+
:param *brand `<'str/dict'>`: 产品品牌信息, 可以是字符串或字典
|
|
2472
|
+
|
|
2473
|
+
- `<'str'>`: 品牌名称 (新增品牌)
|
|
2474
|
+
- `<'dict'>`: 每个字典必须包含 `brand_name` 字段, 如:
|
|
2475
|
+
`{'brand_name': '品牌名'}`
|
|
2476
|
+
* 必填字段 `brand_name` 品牌名称, 必须是 str 类型,
|
|
2477
|
+
参数来源 `ProductBrand.brand_name`
|
|
2478
|
+
* 可选字段 `brand_id` 品牌ID, 必须 int 类型, 如果提供则编辑现有品牌,
|
|
2479
|
+
否则新增品牌, 参数来源 `ProductBrand.brand_id`
|
|
2480
|
+
* 可选字段 `brand_code` 品牌编码, 必须是 str 类型,
|
|
2481
|
+
参数来源 `ProductBrand.brand_code`
|
|
2482
|
+
|
|
2483
|
+
:returns `<'EditProductBrandsResult'>`: 返回创建或编辑的产品品牌结果列表
|
|
2484
|
+
```python
|
|
2485
|
+
{
|
|
2486
|
+
# 状态码
|
|
2487
|
+
"code": 0,
|
|
2488
|
+
# 提示信息
|
|
2489
|
+
"message": "success",
|
|
2490
|
+
# 错误信息
|
|
2491
|
+
"errors": [],
|
|
2492
|
+
# 请求ID
|
|
2493
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
2494
|
+
# 响应时间
|
|
2495
|
+
"response_time": "2025-08-13 19:23:04",
|
|
2496
|
+
# 响应结果
|
|
2497
|
+
"data": [
|
|
2498
|
+
{
|
|
2499
|
+
# 创建/编辑的产品品牌ID [原字段 'id']
|
|
2500
|
+
"brand_id": 1,
|
|
2501
|
+
# 创建/编辑的产品品牌名称 [原字段 'title']
|
|
2502
|
+
"brand_name": "FastTech",
|
|
2503
|
+
# 创建/编辑的产品品牌编码
|
|
2504
|
+
"brand_code": "FT-001",
|
|
2505
|
+
},
|
|
2506
|
+
...
|
|
2507
|
+
],
|
|
2508
|
+
}
|
|
2509
|
+
"""
|
|
2510
|
+
url = route.EDIT_PRODUCT_BRANDS
|
|
2511
|
+
# 解析并验证参数
|
|
2512
|
+
args = {"brands": brand}
|
|
2513
|
+
try:
|
|
2514
|
+
p = param.EditProductBrands.model_validate(args)
|
|
2515
|
+
except Exception as err:
|
|
2516
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
2517
|
+
|
|
2518
|
+
# 发送请求
|
|
2519
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
2520
|
+
return schema.EditProductBrandsResult.model_validate(data)
|
|
2521
|
+
|
|
2522
|
+
async def ProductCategories(
|
|
2523
|
+
self,
|
|
2524
|
+
*category_id: int,
|
|
2525
|
+
offset: int | None = None,
|
|
2526
|
+
length: int | None = None,
|
|
2527
|
+
) -> schema.ProductCategories:
|
|
2528
|
+
"""查询产品分类
|
|
2529
|
+
|
|
2530
|
+
## Docs
|
|
2531
|
+
- 产品: [查询产品分类列表](https://apidoc.lingxing.com/#/docs/Product/Category)
|
|
2532
|
+
|
|
2533
|
+
:param *category_id `<'int'>`: 产品分类ID列表, 可以传入多个分类ID, 或不传入 (查询所有分类)
|
|
2534
|
+
:param offset `<'int'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
2535
|
+
:param length `<'int'>`: 分页长度, 最大值 1000, 默认 `None` (使用: 1000)
|
|
2536
|
+
:returns `<'ProductCategories'>`: 返回查询到的产品分类列表
|
|
2537
|
+
```python
|
|
2538
|
+
{
|
|
2539
|
+
# 状态码
|
|
2540
|
+
"code": 0,
|
|
2541
|
+
# 提示信息
|
|
2542
|
+
"message": "success",
|
|
2543
|
+
# 错误信息
|
|
2544
|
+
"errors": [],
|
|
2545
|
+
# 请求ID
|
|
2546
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
2547
|
+
# 响应时间
|
|
2548
|
+
"response_time": "2025-08-13 19:23:04",
|
|
2549
|
+
# 响应数据量
|
|
2550
|
+
"response_count": 2,
|
|
2551
|
+
# 总数据量
|
|
2552
|
+
"total_count": 2,
|
|
2553
|
+
# 响应数据
|
|
2554
|
+
"data": [
|
|
2555
|
+
{
|
|
2556
|
+
# 领星本地产品分类ID [原字段 'id']
|
|
2557
|
+
"category_id": 1,
|
|
2558
|
+
# 分类名称 [原字段 'title']
|
|
2559
|
+
"category_name": "电子产品",
|
|
2560
|
+
# 分类编码
|
|
2561
|
+
"category_code": "ELEC-001",
|
|
2562
|
+
# 父分类ID [原字段 'parent_cid']
|
|
2563
|
+
"parent_category_id": 0,
|
|
2564
|
+
},
|
|
2565
|
+
...
|
|
2566
|
+
],
|
|
2567
|
+
}
|
|
2568
|
+
"""
|
|
2569
|
+
url = route.PRODUCT_CATEGORIES
|
|
2570
|
+
# 解析并验证参数
|
|
2571
|
+
args = {"category_id": category_id, "offset": offset, "length": length}
|
|
2572
|
+
try:
|
|
2573
|
+
p = param.ProductCategories.model_validate(args)
|
|
2574
|
+
except Exception as err:
|
|
2575
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
2576
|
+
|
|
2577
|
+
# 发送请求
|
|
2578
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
2579
|
+
return schema.ProductCategories.model_validate(data)
|
|
2580
|
+
|
|
2581
|
+
async def EditProductCategories(
|
|
2582
|
+
self,
|
|
2583
|
+
*category: str | dict,
|
|
2584
|
+
) -> schema.EditProductCategoriesResult:
|
|
2585
|
+
"""添加/编辑产品分类
|
|
2586
|
+
|
|
2587
|
+
## Docs
|
|
2588
|
+
- 产品: [添加/编辑产品分类](https://apidoc.lingxing.com/#/docs/Product/SetCategory)
|
|
2589
|
+
|
|
2590
|
+
:param *category `<'str/dict'>`: 产品品牌信息, 可以是字符串或字典
|
|
2591
|
+
|
|
2592
|
+
- `<'str'>`: 分类名称 (新增分类)
|
|
2593
|
+
- `<'dict'>`: 每个字典必须包含 `category_name` 字段, 如:
|
|
2594
|
+
`{'category_name': '新分类'}`
|
|
2595
|
+
* 必填字段 `category_name` 分类名称, 必须是 str 类型,
|
|
2596
|
+
参数来源 `ProductCategory.category_name`
|
|
2597
|
+
* 可选字段 `category_id` 分类ID, 必须 int 类型, 如果提供则编辑现有分类,
|
|
2598
|
+
否则新增分类, 参数来源 `ProductCategory.category_id`
|
|
2599
|
+
* 可选字段 `category_code` 分类编码, 必须是 str 类型,
|
|
2600
|
+
参数来源 `ProductCategory.category_code`
|
|
2601
|
+
* 可选字段 `parent_category_id` 父分类ID, 必须 int 类型,
|
|
2602
|
+
参数来源 `ProductCategory.parent_category_id`
|
|
2603
|
+
|
|
2604
|
+
:returns `<'EditProductCategoriesResult'>`: 返回创建或编辑的产品分类结果列表
|
|
2605
|
+
```python
|
|
2606
|
+
{
|
|
2607
|
+
# 状态码
|
|
2608
|
+
"code": 0,
|
|
2609
|
+
# 提示信息
|
|
2610
|
+
"message": "success",
|
|
2611
|
+
# 错误信息
|
|
2612
|
+
"errors": [],
|
|
2613
|
+
# 请求ID
|
|
2614
|
+
"request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
|
|
2615
|
+
# 响应时间
|
|
2616
|
+
"response_time": "2025-08-13 19:23:04",
|
|
2617
|
+
# 响应结果
|
|
2618
|
+
"data": [
|
|
2619
|
+
{
|
|
2620
|
+
# 创建/编辑的产品分类ID [原字段 'id']
|
|
2621
|
+
"category_id": 1,
|
|
2622
|
+
# 创建/编辑的产品分类名称 [原字段 'title']
|
|
2623
|
+
"category_name": "电子产品",
|
|
2624
|
+
# 创建/编辑的产品分类编码
|
|
2625
|
+
"category_code": "ELEC-001",
|
|
2626
|
+
# 创建/编辑的产品分类父ID [原字段 'parent_cid']
|
|
2627
|
+
"parent_category_id": 0,
|
|
2628
|
+
},
|
|
2629
|
+
...
|
|
2630
|
+
],
|
|
2631
|
+
}
|
|
2632
|
+
"""
|
|
2633
|
+
url = route.EDIT_PRODUCT_CATEGORIES
|
|
2634
|
+
# 解析并验证参数
|
|
2635
|
+
args = {"categories": category}
|
|
2636
|
+
try:
|
|
2637
|
+
p = param.EditProductCategories.model_validate(args)
|
|
2638
|
+
except Exception as err:
|
|
2639
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
2640
|
+
|
|
2641
|
+
# 发送请求
|
|
2642
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
2643
|
+
return schema.EditProductCategoriesResult.model_validate(data)
|