ey-commerce-lib 1.0.13__py3-none-any.whl → 1.0.15__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 ey-commerce-lib might be problematic. Click here for more details.
- ey_commerce_lib/dxm/main.py +69 -1
- ey_commerce_lib/dxm/parser/ebay_product.py +16 -0
- ey_commerce_lib/dxm/parser/order.py +10 -1
- ey_commerce_lib/dxm/schemas/dxm_commodity_product.py +416 -0
- ey_commerce_lib/dxm/schemas/ebay_product.py +56 -0
- ey_commerce_lib/dxm/utils/dxm_commodity_product.py +122 -0
- ey_commerce_lib/utils/float.py +30 -0
- {ey_commerce_lib-1.0.13.dist-info → ey_commerce_lib-1.0.15.dist-info}/METADATA +1 -1
- {ey_commerce_lib-1.0.13.dist-info → ey_commerce_lib-1.0.15.dist-info}/RECORD +10 -5
- {ey_commerce_lib-1.0.13.dist-info → ey_commerce_lib-1.0.15.dist-info}/WHEEL +0 -0
ey_commerce_lib/dxm/main.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
+
import time
|
|
2
3
|
|
|
3
4
|
from httpx import AsyncClient, Timeout
|
|
5
|
+
from playwright.async_api import async_playwright
|
|
4
6
|
|
|
5
7
|
from ey_commerce_lib.dxm.constant.order import DxmOrderRuleType
|
|
6
8
|
from ey_commerce_lib.dxm.parser.common import get_page_info, get_purchase_pagination_info
|
|
@@ -11,6 +13,8 @@ from ey_commerce_lib.dxm.parser.purchase import list_purchasing_all, list_1688_p
|
|
|
11
13
|
list_wait_pay_page_purchase_order_number
|
|
12
14
|
from ey_commerce_lib.dxm.parser.warehouse import list_warehouse_product
|
|
13
15
|
from ey_commerce_lib.dxm.schemas.common import Page
|
|
16
|
+
from ey_commerce_lib.dxm.schemas.dxm_commodity_product import ViewDxmCommodityProductResponse
|
|
17
|
+
from ey_commerce_lib.dxm.schemas.ebay_product import DxmEbayProductModel
|
|
14
18
|
from ey_commerce_lib.dxm.schemas.order import DxmOrderSearchForm, DxmJsonResponse, DxmCheckProcessResponse, DxmOrderRule
|
|
15
19
|
from ey_commerce_lib.dxm.schemas.warehouse import WarehouseProduct, WarehouseProductQuery, PurchasingAllQuery
|
|
16
20
|
|
|
@@ -22,7 +26,8 @@ class DxmClient:
|
|
|
22
26
|
self.__headers = headers
|
|
23
27
|
self.__sem = asyncio.Semaphore(sem)
|
|
24
28
|
timeout = Timeout(connect=5.0, read=20.0, write=10.0, pool=10.0)
|
|
25
|
-
self.
|
|
29
|
+
self.__base_url = 'https://www.dianxiaomi.com'
|
|
30
|
+
self.__async_client = AsyncClient(base_url=self.__base_url, cookies=cookies, headers=headers,
|
|
26
31
|
timeout=timeout)
|
|
27
32
|
|
|
28
33
|
async def page_order_base_async(self, query: DxmOrderSearchForm):
|
|
@@ -665,6 +670,69 @@ class DxmClient:
|
|
|
665
670
|
|
|
666
671
|
return await self.__stat_index()
|
|
667
672
|
|
|
673
|
+
async def ebay_product_page_list(self, query_params: DxmEbayProductModel):
|
|
674
|
+
"""
|
|
675
|
+
ebay在线产品列表
|
|
676
|
+
:param query_params: 查询参数
|
|
677
|
+
:return:
|
|
678
|
+
"""
|
|
679
|
+
query_data = query_params.model_dump(by_alias=True)
|
|
680
|
+
async with self.__sem:
|
|
681
|
+
ebay_product_page_res = await self.__async_client.post('/ebayProduct/pageList.htm', data=query_data)
|
|
682
|
+
ebay_product_page_text = ebay_product_page_res.text
|
|
683
|
+
# TODO 完成后续的逻辑
|
|
684
|
+
|
|
685
|
+
async def view_dxm_commodity_product(self, proid: str):
|
|
686
|
+
"""
|
|
687
|
+
仓库管理-商品管理-查看店小秘商品
|
|
688
|
+
:param proid:
|
|
689
|
+
:return:
|
|
690
|
+
"""
|
|
691
|
+
data = {
|
|
692
|
+
'id': proid,
|
|
693
|
+
}
|
|
694
|
+
async with self.__sem:
|
|
695
|
+
view_dxm_commodity_product_res = await self.__async_client.post(
|
|
696
|
+
'/dxmCommodityProduct/viewDxmCommodityProduct.json',
|
|
697
|
+
data=data)
|
|
698
|
+
return ViewDxmCommodityProductResponse.model_validate(view_dxm_commodity_product_res.json())
|
|
699
|
+
|
|
700
|
+
async def update_dxm_commodity_front_sku(self, proid: str, front_sku: str):
|
|
701
|
+
"""
|
|
702
|
+
更新店小秘 仓库-商品详情中的平台sku
|
|
703
|
+
:param proid:
|
|
704
|
+
:param front_sku:
|
|
705
|
+
:return:
|
|
706
|
+
"""
|
|
707
|
+
# 打开浏览器
|
|
708
|
+
try:
|
|
709
|
+
async with async_playwright() as p:
|
|
710
|
+
browser = await p.chromium.launch(headless=True)
|
|
711
|
+
context = await browser.new_context()
|
|
712
|
+
# 设置cookie和headers
|
|
713
|
+
await context.add_cookies([
|
|
714
|
+
{
|
|
715
|
+
"name": name, # cookie 名称
|
|
716
|
+
"value": value, # cookie 值
|
|
717
|
+
"domain": ".dianxiaomi.com", # 替换为你的目标域名
|
|
718
|
+
"path": "/", # cookie 路径
|
|
719
|
+
}
|
|
720
|
+
for name, value in self.__cookies.items()
|
|
721
|
+
])
|
|
722
|
+
page = await context.new_page()
|
|
723
|
+
# 访问
|
|
724
|
+
await page.goto(f'{self.__base_url}/dxmCommodityProduct/openEditModal.htm?id={proid}&editOrCopy=0')
|
|
725
|
+
# 输入sku
|
|
726
|
+
await page.locator('input.variationValue.ui-autocomplete-input').fill(front_sku)
|
|
727
|
+
# 失去焦点
|
|
728
|
+
await page.locator('input.variationValue.ui-autocomplete-input').press('Tab')
|
|
729
|
+
# 休眠两秒
|
|
730
|
+
await asyncio.sleep(2)
|
|
731
|
+
# 点击保存
|
|
732
|
+
await page.locator('.button.btn-orange.m-left10').first.click()
|
|
733
|
+
except Exception as e:
|
|
734
|
+
raise Exception(f'更新店小秘 仓库-商品详情中的平台sku失败-失败原因:{e}')
|
|
735
|
+
|
|
668
736
|
async def __aenter__(self):
|
|
669
737
|
return self
|
|
670
738
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from lxml import html
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def parse_ebay_product_page(page_html: str):
|
|
5
|
+
tree = html.fromstring(page_html)
|
|
6
|
+
# 获取eBay产【
|
|
7
|
+
ebay_product_items = tree.xpath('//tbody[@id="ebaySysMsg"]/tr')
|
|
8
|
+
for ebay_product_item in ebay_product_items:
|
|
9
|
+
ebay_id = ebay_product_item.xpath('@data-id')
|
|
10
|
+
sku = ebay_product_item.xpath('./td[4]/text()')
|
|
11
|
+
# 获取子表
|
|
12
|
+
sub_table = ebay_product_item.xpath('.//table[@class="in-table-in"]//tr')
|
|
13
|
+
# 获取proId
|
|
14
|
+
pro_id = sub_table[0].xpath('./td[1]/text()')
|
|
15
|
+
# TODO 获取后续逻辑
|
|
16
|
+
|
|
@@ -36,6 +36,10 @@ def get_single_order_item_list(order_element: html.HtmlElement):
|
|
|
36
36
|
xpath('.//ul[@id="dropSourceUrl"]/li[@role="presentation"]/a/text()'))
|
|
37
37
|
source_presentation_element_list = [source_presentation_element.strip().split(':')[1]
|
|
38
38
|
for source_presentation_element in source_presentation_element_list]
|
|
39
|
+
try:
|
|
40
|
+
float(price.replace(',', ''))
|
|
41
|
+
except:
|
|
42
|
+
raise Exception(f'价格格式错误, sku是{sku}--价格是{price}')
|
|
39
43
|
sku_list.append({
|
|
40
44
|
'sku': sku,
|
|
41
45
|
'quantity': int(quantity),
|
|
@@ -314,6 +318,7 @@ def get_order_detail_by_html(html_str: str):
|
|
|
314
318
|
for pair_info_element in pair_info_element_list:
|
|
315
319
|
pair_info_sku = pair_info_element.xpath('.//span[@class="pairProInfoSku"]/text()')[0].split(' x')[0].strip()
|
|
316
320
|
pair_info_sku_quantity = int(pair_info_element.xpath('.//span[@class="pairProInfoSku"]/span/text()')[0].strip())
|
|
321
|
+
proid = get_str_list_first_not_blank_or_none(pair_info_element.xpath('.//input[@proid]/@proid'))
|
|
317
322
|
# warehouse_sku, warehouse_sku_quantity = pair_info_element.xpath(
|
|
318
323
|
# './/div[contains(@class, "normalDiv")]/p[1]/text()')[0].split(' x ')
|
|
319
324
|
warehouse_sku_info_list = pair_info_element.xpath('.//div[contains(@class, "normalDiv")]/p[1]/text()')
|
|
@@ -324,11 +329,15 @@ def get_order_detail_by_html(html_str: str):
|
|
|
324
329
|
|
|
325
330
|
warehouse_available_quantity_element_list = pair_info_element.xpath(
|
|
326
331
|
'.//div[contains(@class, "normalDiv")]/p[2]/span[2]/text()')
|
|
327
|
-
|
|
332
|
+
warehouse_available_quantity_str = warehouse_available_quantity_element_list[0].strip()
|
|
333
|
+
if warehouse_available_quantity_str.endswith('+'):
|
|
334
|
+
warehouse_available_quantity_str = warehouse_available_quantity_str[:-1]
|
|
335
|
+
warehouse_available_quantity = int(warehouse_available_quantity_str) if len(
|
|
328
336
|
warehouse_available_quantity_element_list) > 0 else None
|
|
329
337
|
pair_info_list.append({
|
|
330
338
|
'pair_info_sku': pair_info_sku,
|
|
331
339
|
'pair_info_sku_quantity': pair_info_sku_quantity,
|
|
340
|
+
'proid': proid,
|
|
332
341
|
'warehouse_sku': warehouse_sku,
|
|
333
342
|
'warehouse_sku_quantity': warehouse_sku_quantity,
|
|
334
343
|
'warehouse_available_quantity': warehouse_available_quantity
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from typing import List, Optional, Dict, Any
|
|
3
|
+
from pydantic import BaseModel, Field, ConfigDict
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class DxmProductAlbum(BaseModel):
|
|
7
|
+
"""商品相册信息"""
|
|
8
|
+
id: int = Field(..., alias="id", description="相册ID")
|
|
9
|
+
puid: int = Field(..., alias="puid", description="用户ID")
|
|
10
|
+
product_id: int = Field(..., alias="productId", description="商品ID")
|
|
11
|
+
name: Optional[str] = Field(None, alias="name", description="图片名称")
|
|
12
|
+
img_url: Optional[str] = Field(None, alias="imgUrl", description="图片URL")
|
|
13
|
+
img_original_size: int = Field(0, alias="imgOriginalSize", description="图片原始大小")
|
|
14
|
+
img_compress_size: int = Field(0, alias="imgCompressSize", description="图片压缩后大小")
|
|
15
|
+
img_height: int = Field(0, alias="imgHeight", description="图片高度")
|
|
16
|
+
img_width: int = Field(0, alias="imgWidth", description="图片宽度")
|
|
17
|
+
is_qc: int = Field(0, alias="isQc", description="是否质检图片")
|
|
18
|
+
is_from_net: int = Field(1, alias="isFromNet", description="是否来自网络")
|
|
19
|
+
is_del: int = Field(0, alias="isDel", description="是否删除")
|
|
20
|
+
upload_state: int = Field(0, alias="uploadState", description="上传状态")
|
|
21
|
+
survey_index: int = Field(0, alias="surveyIndex", description="调查索引")
|
|
22
|
+
create_time: datetime = Field(..., alias="createTime", description="创建时间")
|
|
23
|
+
update_time: datetime = Field(..., alias="updateTime", description="更新时间")
|
|
24
|
+
is_main: Optional[int] = Field(None, alias="isMain", description="是否主图")
|
|
25
|
+
id_str: Optional[str] = Field(None, alias="idStr", description="ID字符串形式")
|
|
26
|
+
|
|
27
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ProductVariation(BaseModel):
|
|
31
|
+
"""商品变体信息"""
|
|
32
|
+
id: int = Field(..., alias="id", description="变体ID")
|
|
33
|
+
puid: int = Field(..., alias="puid", description="用户ID")
|
|
34
|
+
product_id: int = Field(..., alias="productId", description="商品ID")
|
|
35
|
+
sku: str = Field(..., alias="sku", description="SKU编码")
|
|
36
|
+
create_time: datetime = Field(..., alias="createTime", description="创建时间")
|
|
37
|
+
|
|
38
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class SupplierProductRelation(BaseModel):
|
|
42
|
+
"""供应商商品关系"""
|
|
43
|
+
supplier_name: str = Field(..., alias="supplierName", description="供应商名称")
|
|
44
|
+
is_albaba: int = Field(..., alias="isAlbaba", description="是否阿里巴巴供应商")
|
|
45
|
+
supplier_id: str = Field(..., alias="supplierId", description="供应商ID")
|
|
46
|
+
is_main: int = Field(..., alias="isMain", description="是否主供应商")
|
|
47
|
+
|
|
48
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class DxmWarehouseProduct(BaseModel):
|
|
52
|
+
"""仓库商品信息"""
|
|
53
|
+
id: int = Field(..., alias="id", description="仓库商品ID")
|
|
54
|
+
puid: int = Field(..., alias="puid", description="用户ID")
|
|
55
|
+
warehose_id: int = Field(..., alias="warehoseId", description="仓库ID")
|
|
56
|
+
goods_shelf_id: int = Field(..., alias="goodsShelfId", description="货架ID")
|
|
57
|
+
shelf_name: str = Field(..., alias="shelfName", description="货架名称")
|
|
58
|
+
agent_id: int = Field(0, alias="agentId", description="代理商ID")
|
|
59
|
+
development_id: int = Field(..., alias="developmentId", description="开发人员ID")
|
|
60
|
+
product_id: int = Field(..., alias="productId", description="商品ID")
|
|
61
|
+
product_sku: str = Field(..., alias="productSku", description="商品SKU")
|
|
62
|
+
full_cid: str = Field(..., alias="fullCid", description="完整分类ID")
|
|
63
|
+
supplier_id: int = Field(..., alias="supplierId", description="供应商ID")
|
|
64
|
+
price: float = Field(..., alias="price", description="价格")
|
|
65
|
+
stock_num: int = Field(0, alias="stockNum", description="库存数量")
|
|
66
|
+
safe_stock_num: int = Field(0, alias="safeStockNum", description="安全库存数量")
|
|
67
|
+
presell_num: int = Field(0, alias="presellNum", description="预售数量")
|
|
68
|
+
lock_stock_num: int = Field(0, alias="lockStockNum", description="锁定库存数量")
|
|
69
|
+
amount: float = Field(0.0, alias="amount", description="金额")
|
|
70
|
+
on_passage_num: int = Field(0, alias="onPassageNum", description="在途数量")
|
|
71
|
+
on_passage_num_move: int = Field(0, alias="onPassageNumMove", description="移动中的在途数量")
|
|
72
|
+
comment: str = Field("", alias="comment", description="备注")
|
|
73
|
+
propasal_comment: Optional[str] = Field(None, alias="propasalComment", description="提案备注")
|
|
74
|
+
comment_color: Optional[str] = Field(None, alias="commentColor", description="备注颜色")
|
|
75
|
+
is_used: int = Field(1, alias="isUsed", description="是否使用")
|
|
76
|
+
product_status: int = Field(0, alias="productStatus", description="商品状态")
|
|
77
|
+
is_material: bool = Field(False, alias="isMaterial", description="是否原材料")
|
|
78
|
+
create_time: datetime = Field(..., alias="createTime", description="创建时间")
|
|
79
|
+
update_time: datetime = Field(..., alias="updateTime", description="更新时间")
|
|
80
|
+
group_state: int = Field(0, alias="groupState", description="分组状态")
|
|
81
|
+
allot_lock_stock_num: int = Field(0, alias="allotLockStockNum", description="分配锁定库存数量")
|
|
82
|
+
warehouse_lock_stock_num: int = Field(0, alias="warehouseLockStockNum", description="仓库锁定库存数量")
|
|
83
|
+
order_num: int = Field(0, alias="orderNum", description="订单数量")
|
|
84
|
+
option_mode: int = Field(1, alias="optionMode", description="操作模式")
|
|
85
|
+
pur_num: int = Field(0, alias="purNum", description="采购数量")
|
|
86
|
+
purchasing_audit_num: int = Field(0, alias="purchasingAuditNum", description="采购审核数量")
|
|
87
|
+
mark_no_purch: int = Field(1, alias="markNoPurch", description="标记不采购")
|
|
88
|
+
v: int = Field(0, alias="v", description="版本号")
|
|
89
|
+
pur_wait_in_num: int = Field(0, alias="purWaitInNum", description="待入库采购数量")
|
|
90
|
+
available_stock_num: Optional[int] = Field(None, alias="availableStockNum", description="可用库存数量")
|
|
91
|
+
oversea_lock_stock_num: int = Field(0, alias="overseaLockStockNum", description="海外锁定库存数量")
|
|
92
|
+
oversea_move_pair_mark: int = Field(1, alias="overseaMovePairMark", description="海外移动配对标记")
|
|
93
|
+
oversea_warehose_id: str = Field("", alias="overseaWarehoseId", description="海外仓库ID")
|
|
94
|
+
full_name: Optional[str] = Field(None, alias="fullName", description="完整名称")
|
|
95
|
+
sku: Optional[str] = Field(None, alias="sku", description="SKU编码")
|
|
96
|
+
sku_code: Optional[str] = Field(None, alias="skuCode", description="SKU代码")
|
|
97
|
+
name: Optional[str] = Field(None, alias="name", description="名称")
|
|
98
|
+
img_url: Optional[str] = Field(None, alias="imgUrl", description="图片URL")
|
|
99
|
+
tiny_img_url: Optional[str] = Field(None, alias="tinyImgUrl", description="缩略图URL")
|
|
100
|
+
source_url: Optional[str] = Field(None, alias="sourceUrl", description="来源URL")
|
|
101
|
+
sbm_id: Optional[str] = Field(None, alias="sbmId", description="SBM ID")
|
|
102
|
+
sku_pro: Optional[str] = Field(None, alias="skuPro", description="SKU属性")
|
|
103
|
+
name_pro: Optional[str] = Field(None, alias="namePro", description="名称属性")
|
|
104
|
+
weight_pro: Optional[float] = Field(None, alias="weightPro", description="重量属性")
|
|
105
|
+
price_pro: Optional[float] = Field(None, alias="pricePro", description="价格属性")
|
|
106
|
+
source_url_pro: Optional[str] = Field(None, alias="sourceUrlPro", description="来源URL属性")
|
|
107
|
+
comment_pro: Optional[str] = Field(None, alias="commentPro", description="备注属性")
|
|
108
|
+
img_url_pro: Optional[str] = Field(None, alias="imgUrlPro", description="图片URL属性")
|
|
109
|
+
is_used_pro: Optional[int] = Field(None, alias="isUsedPro", description="是否使用属性")
|
|
110
|
+
full_cid_pro: Optional[str] = Field(None, alias="fullCidPro", description="完整分类ID属性")
|
|
111
|
+
name_cn_bg: Optional[str] = Field(None, alias="nameCnBg", description="中文名称背景")
|
|
112
|
+
name_en_bg: Optional[str] = Field(None, alias="nameEnBg", description="英文名称背景")
|
|
113
|
+
weight_bg: Optional[float] = Field(None, alias="weightBg", description="重量背景")
|
|
114
|
+
price_bg: Optional[float] = Field(None, alias="priceBg", description="价格背景")
|
|
115
|
+
agent_name: Optional[str] = Field(None, alias="agentName", description="代理商名称")
|
|
116
|
+
development_name: Optional[str] = Field(None, alias="developmentName", description="开发人员名称")
|
|
117
|
+
proposal_num: Optional[int] = Field(None, alias="proposalNum", description="提案数量")
|
|
118
|
+
recent_in_time: Optional[datetime] = Field(None, alias="recentInTime", description="最近入库时间")
|
|
119
|
+
recent_out_time: Optional[datetime] = Field(None, alias="recentOutTime", description="最近出库时间")
|
|
120
|
+
ids: Optional[List[int]] = Field(None, alias="ids", description="ID列表")
|
|
121
|
+
prices: Optional[List[float]] = Field(None, alias="prices", description="价格列表")
|
|
122
|
+
kc_nums: Optional[List[int]] = Field(None, alias="kcNums", description="库存数量列表")
|
|
123
|
+
aqkc_nums: Optional[List[int]] = Field(None, alias="aqkcNums", description="安全库存数量列表")
|
|
124
|
+
good_shelf_ids: Optional[List[int]] = Field(None, alias="goodShelfIds", description="货架ID列表")
|
|
125
|
+
comments: Optional[List[str]] = Field(None, alias="comments", description="备注列表")
|
|
126
|
+
full_cids: Optional[List[str]] = Field(None, alias="fullCids", description="完整分类ID列表")
|
|
127
|
+
stock_num_zh: Optional[int] = Field(None, alias="stockNumZh", description="库存数量中文")
|
|
128
|
+
group_num: Optional[int] = Field(None, alias="groupNum", description="分组数量")
|
|
129
|
+
group_sku_table: Optional[str] = Field(None, alias="groupSkuTable", description="分组SKU表")
|
|
130
|
+
old_price: Optional[float] = Field(None, alias="oldPrice", description="旧价格")
|
|
131
|
+
old_stock_num: Optional[int] = Field(None, alias="oldStockNum", description="旧库存数量")
|
|
132
|
+
last_pur_price: Optional[float] = Field(None, alias="lastPurPrice", description="最后采购价格")
|
|
133
|
+
sale_cofficient: Optional[float] = Field(None, alias="saleCofficient", description="销售系数")
|
|
134
|
+
dxm_warehose_product_g: Optional[str] = Field(None, alias="dxmWarehoseProductG", description="DXM仓库商品G")
|
|
135
|
+
proposal_set: Optional[str] = Field(None, alias="proposalSet", description="提案集")
|
|
136
|
+
proposal_set_json: Optional[str] = Field(None, alias="proposalSetJson", description="提案集JSON")
|
|
137
|
+
this_arrival_num: Optional[int] = Field(None, alias="thisArrivalNum", description="本次到货数量")
|
|
138
|
+
daily_sale: Optional[float] = Field(None, alias="dailySale", description="日销量")
|
|
139
|
+
daily_sale_num: Optional[int] = Field(None, alias="dailySaleNum", description="日销售数量")
|
|
140
|
+
warning_day: Optional[int] = Field(None, alias="warningDay", description="预警天数")
|
|
141
|
+
purchase_plan_number: int = Field(0, alias="purchasePlanNumber", description="采购计划数量")
|
|
142
|
+
warehouse_name: str = Field(..., alias="warehouseName", description="仓库名称")
|
|
143
|
+
goods_shelf_lock: int = Field(0, alias="goodsShelfLock", description="货架锁定")
|
|
144
|
+
state: Optional[int] = Field(None, alias="state", description="状态")
|
|
145
|
+
goods_shelf_type: int = Field(0, alias="goodsShelfType", description="货架类型")
|
|
146
|
+
picking_safe_stock_num: int = Field(0, alias="pickingSafeStockNum", description="拣货安全库存数量")
|
|
147
|
+
oversea_product_sku: Optional[str] = Field(None, alias="overseaProductSku", description="海外商品SKU")
|
|
148
|
+
authorization_id: Optional[str] = Field(None, alias="authorizationId", description="授权ID")
|
|
149
|
+
sfxz: Optional[str] = Field(None, alias="sfxz", description="SFXZ")
|
|
150
|
+
oversea_platfrom: Optional[str] = Field(None, alias="overseaPlatfrom", description="海外平台")
|
|
151
|
+
unbilled_order_num: int = Field(0, alias="unbilledOrderNum", description="未开票订单数量")
|
|
152
|
+
id_str: str = Field(..., alias="idStr", description="ID字符串形式")
|
|
153
|
+
supplier_id_str: str = Field(..., alias="supplierIdStr", description="供应商ID字符串形式")
|
|
154
|
+
product_id_str: str = Field(..., alias="productIdStr", description="商品ID字符串形式")
|
|
155
|
+
goods_shelf_id_str: str = Field(..., alias="goodsShelfIdStr", description="货架ID字符串形式")
|
|
156
|
+
|
|
157
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class DxmCommodityProduct(BaseModel):
|
|
161
|
+
"""DXM商品信息"""
|
|
162
|
+
id: int = Field(..., alias="id", description="商品ID")
|
|
163
|
+
puid: int = Field(..., alias="puid", description="用户ID")
|
|
164
|
+
full_cid: str = Field(..., alias="fullCid", description="完整分类ID")
|
|
165
|
+
name: str = Field(..., alias="name", description="商品名称")
|
|
166
|
+
name_en: str = Field("", alias="nameEn", description="商品英文名称")
|
|
167
|
+
spu: str = Field(..., alias="spu", description="SPU编码")
|
|
168
|
+
sku: str = Field(..., alias="sku", description="SKU编码")
|
|
169
|
+
sku_code: str = Field(..., alias="skuCode", description="SKU代码")
|
|
170
|
+
parent_id: int = Field(..., alias="parentId", description="父商品ID")
|
|
171
|
+
survey_id: int = Field(0, alias="surveyId", description="调查ID")
|
|
172
|
+
data_source: Optional[str] = Field(None, alias="dataSource", description="数据来源")
|
|
173
|
+
attr: Optional[str] = Field(None, alias="attr", description="属性")
|
|
174
|
+
type: Optional[str] = Field(None, alias="type", description="类型")
|
|
175
|
+
price: float = Field(..., alias="price", description="价格")
|
|
176
|
+
process_fee: float = Field(0.0, alias="processFee", description="加工费")
|
|
177
|
+
weight: float = Field(..., alias="weight", description="重量")
|
|
178
|
+
allow_weight_error: float = Field(0.0, alias="allowWeightError", description="允许重量误差")
|
|
179
|
+
comment: str = Field("", alias="comment", description="备注")
|
|
180
|
+
propasal_comment: Optional[str] = Field(None, alias="propasalComment", description="提案备注")
|
|
181
|
+
comment_color: Optional[str] = Field(None, alias="commentColor", description="备注颜色")
|
|
182
|
+
img_url: str = Field(..., alias="imgUrl", description="图片URL")
|
|
183
|
+
img_url_exception: int = Field(2, alias="imgUrlException", description="图片URL异常")
|
|
184
|
+
source_url: str = Field(..., alias="sourceUrl", description="来源URL")
|
|
185
|
+
is_used: int = Field(1, alias="isUsed", description="是否使用")
|
|
186
|
+
product_status: int = Field(0, alias="productStatus", description="商品状态")
|
|
187
|
+
is_del: int = Field(0, alias="isDel", description="是否删除")
|
|
188
|
+
variant_or_not: int = Field(0, alias="variantOrNot", description="是否有变体")
|
|
189
|
+
state: int = Field(1, alias="state", description="状态")
|
|
190
|
+
is_stock: int = Field(0, alias="isStock", description="是否有库存")
|
|
191
|
+
group_state: int = Field(0, alias="groupState", description="分组状态")
|
|
192
|
+
sbm_id: Optional[str] = Field(None, alias="sbmId", description="SBM ID")
|
|
193
|
+
agent_id: int = Field(0, alias="agentId", description="代理商ID")
|
|
194
|
+
development_id: int = Field(..., alias="developmentId", description="开发人员ID")
|
|
195
|
+
sales_id: int = Field(0, alias="salesId", description="销售人员ID")
|
|
196
|
+
uninue_flag: int = Field(0, alias="uninueFlag", description="唯一标志")
|
|
197
|
+
product_type: str = Field(..., alias="productType", description="商品类型")
|
|
198
|
+
qc_type: int = Field(0, alias="qcType", description="质检类型")
|
|
199
|
+
is_qc_collect: int = Field(0, alias="isQcCollect", description="是否质检收集")
|
|
200
|
+
qc_template_id: int = Field(0, alias="qcTemplateId", description="质检模板ID")
|
|
201
|
+
is_bind_compliance: bool = Field(False, alias="isBindCompliance", description="是否绑定合规")
|
|
202
|
+
template_id: Optional[str] = Field(None, alias="templateId", description="模板ID")
|
|
203
|
+
template_name: Optional[str] = Field(None, alias="templateName", description="模板名称")
|
|
204
|
+
tiny_img_url: Optional[str] = Field(None, alias="tinyImgUrl", description="缩略图URL")
|
|
205
|
+
length: float = Field(0.0, alias="length", description="长度")
|
|
206
|
+
width: float = Field(0.0, alias="width", description="宽度")
|
|
207
|
+
height: float = Field(0.0, alias="height", description="高度")
|
|
208
|
+
package_length: float = Field(0.0, alias="packageLength", description="包装长度")
|
|
209
|
+
package_width: float = Field(0.0, alias="packageWidth", description="包装宽度")
|
|
210
|
+
package_height: float = Field(0.0, alias="packageHeight", description="包装高度")
|
|
211
|
+
package_weight: float = Field(0.0, alias="packageWeight", description="包装重量")
|
|
212
|
+
create_time: datetime = Field(..., alias="createTime", description="创建时间")
|
|
213
|
+
update_time: datetime = Field(..., alias="updateTime", description="更新时间")
|
|
214
|
+
name_cn_bg: Optional[str] = Field(None, alias="nameCnBg", description="中文名称背景")
|
|
215
|
+
name_en_bg: Optional[str] = Field(None, alias="nameEnBg", description="英文名称背景")
|
|
216
|
+
weight_bg: Optional[float] = Field(None, alias="weightBg", description="重量背景")
|
|
217
|
+
price_bg: Optional[float] = Field(None, alias="priceBg", description="价格背景")
|
|
218
|
+
material_bg: Optional[str] = Field(None, alias="materialBg", description="材料背景")
|
|
219
|
+
purpose_bg: Optional[str] = Field(None, alias="purposeBg", description="用途背景")
|
|
220
|
+
hgbm_bg: Optional[str] = Field(None, alias="hgbmBg", description="海关编码背景")
|
|
221
|
+
danger_des_bg: Optional[str] = Field(None, alias="dangerDesBg", description="危险描述背景")
|
|
222
|
+
is_customs: Optional[bool] = Field(None, alias="isCustoms", description="是否海关")
|
|
223
|
+
vids_ys: Optional[str] = Field(None, alias="vidsYs", description="视频YS")
|
|
224
|
+
sku_ys: Optional[str] = Field(None, alias="skuYs", description="SKU YS")
|
|
225
|
+
pt_ys: Optional[str] = Field(None, alias="ptYs", description="PT YS")
|
|
226
|
+
shop_id_ys: Optional[str] = Field(None, alias="shopIdYs", description="店铺ID YS")
|
|
227
|
+
pid_ys: Optional[str] = Field(None, alias="pidYs", description="PID YS")
|
|
228
|
+
smt_vids: Optional[str] = Field(None, alias="smtVids", description="SMT视频")
|
|
229
|
+
smt_pts: Optional[str] = Field(None, alias="smtPts", description="SMT PT")
|
|
230
|
+
smt_pids: Optional[str] = Field(None, alias="smtPids", description="SMT PID")
|
|
231
|
+
smt_shop_ids: Optional[str] = Field(None, alias="smtShopIds", description="SMT店铺ID")
|
|
232
|
+
our_vids: Optional[str] = Field(None, alias="ourVids", description="我们的视频")
|
|
233
|
+
our_pts: Optional[str] = Field(None, alias="ourPts", description="我们的PT")
|
|
234
|
+
our_pids: Optional[str] = Field(None, alias="ourPids", description="我们的PID")
|
|
235
|
+
our_shop_ids: Optional[str] = Field(None, alias="ourShopIds", description="我们的店铺ID")
|
|
236
|
+
sf_order: Optional[str] = Field(None, alias="sfOrder", description="顺丰订单")
|
|
237
|
+
full_name: str = Field(..., alias="fullName", description="完整名称")
|
|
238
|
+
warehose_id: Optional[str] = Field(None, alias="warehoseId", description="仓库ID")
|
|
239
|
+
warehose_name: Optional[str] = Field(None, alias="warehoseName", description="仓库名称")
|
|
240
|
+
invoice_save: bool = Field(False, alias="invoiceSave", description="发票保存")
|
|
241
|
+
ncm: Optional[str] = Field(None, alias="ncm", description="NCM编码")
|
|
242
|
+
cest: Optional[str] = Field(None, alias="cest", description="CEST编码")
|
|
243
|
+
unit: Optional[str] = Field(None, alias="unit", description="单位")
|
|
244
|
+
origin: Optional[str] = Field(None, alias="origin", description="产地")
|
|
245
|
+
group_num: Optional[int] = Field(None, alias="groupNum", description="分组数量")
|
|
246
|
+
contain_weight: float = Field(0.0, alias="containWeight", description="包含重量")
|
|
247
|
+
child_ids: Optional[str] = Field(None, alias="childIds", description="子商品ID")
|
|
248
|
+
child_nums: Optional[str] = Field(None, alias="childNums", description="子商品数量")
|
|
249
|
+
group_sku_table: Optional[str] = Field(None, alias="groupSkuTable", description="分组SKU表")
|
|
250
|
+
goods_shelf_id: Optional[str] = Field(None, alias="goodsShelfId", description="货架ID")
|
|
251
|
+
good_shelf_name: Optional[str] = Field(None, alias="goodShelfName", description="货架名称")
|
|
252
|
+
product_type_list: Optional[str] = Field(None, alias="productTypeList", description="商品类型列表")
|
|
253
|
+
relation_flag: Optional[str] = Field(None, alias="relationFlag", description="关系标志")
|
|
254
|
+
relation_str: Optional[str] = Field(None, alias="relationStr", description="关系字符串")
|
|
255
|
+
ghs_count: Optional[int] = Field(None, alias="ghsCount", description="GHS计数")
|
|
256
|
+
sfxz: Optional[str] = Field(None, alias="sfxz", description="SFXZ")
|
|
257
|
+
arrival_num: Optional[int] = Field(None, alias="arrivalNum", description="到货数量")
|
|
258
|
+
dxm_label: Optional[str] = Field(None, alias="dxmLabel", description="DXM标签")
|
|
259
|
+
stock_num: Optional[int] = Field(None, alias="stockNum", description="库存数量")
|
|
260
|
+
goods_shelf_name: Optional[str] = Field(None, alias="goodsShelfName", description="货架名称")
|
|
261
|
+
dxm_product_customs: Optional[str] = Field(None, alias="dxmProductCustoms", description="DXM商品海关")
|
|
262
|
+
dxm_commodity_product_g: Optional[str] = Field(None, alias="dxmCommodityProductG", description="DXM商品G")
|
|
263
|
+
dxm_product_album_list: List[DxmProductAlbum] = Field(..., alias="dxmProductAlbumList",
|
|
264
|
+
description="DXM商品相册列表")
|
|
265
|
+
product_variation_list: List[ProductVariation] = Field(..., alias="productVariationList",
|
|
266
|
+
description="商品变体列表")
|
|
267
|
+
product_variation_str: Optional[str] = Field(None, alias="productVariationStr", description="商品变体字符串")
|
|
268
|
+
alibaba_pair_product_list: Optional[str] = Field(None, alias="alibabaPairProductList",
|
|
269
|
+
description="阿里巴巴配对商品列表")
|
|
270
|
+
alias_sku: Optional[str] = Field(None, alias="aliasSku", description="别名SKU")
|
|
271
|
+
color: Optional[str] = Field(None, alias="color", description="颜色")
|
|
272
|
+
size: Optional[str] = Field(None, alias="size", description="尺寸")
|
|
273
|
+
check_detail_list: Optional[str] = Field(None, alias="checkDetailList", description="检查详情列表")
|
|
274
|
+
supplier_id: Optional[str] = Field(None, alias="supplierId", description="供应商ID")
|
|
275
|
+
supplier_ids: Optional[str] = Field(None, alias="supplierIds", description="供应商ID列表")
|
|
276
|
+
qc_content: Optional[str] = Field(None, alias="qcContent", description="质检内容")
|
|
277
|
+
qc_img_url: Optional[str] = Field(None, alias="qcImgUrl", description="质检图片URL")
|
|
278
|
+
qc_img_num: int = Field(0, alias="qcImgNum", description="质检图片数量")
|
|
279
|
+
product_packs: Optional[str] = Field(None, alias="productPacks", description="商品包装")
|
|
280
|
+
main_supplier_name: Optional[str] = Field(None, alias="mainSupplierName", description="主供应商名称")
|
|
281
|
+
main_supplier_id: Optional[str] = Field(None, alias="mainSupplierId", description="主供应商ID")
|
|
282
|
+
dxm_supplier_list_str: Optional[str] = Field(None, alias="dxmSupplierListStr", description="DXM供应商列表字符串")
|
|
283
|
+
supplier_size: int = Field(0, alias="supplierSize", description="供应商大小")
|
|
284
|
+
variant_sku_count: int = Field(0, alias="variantSkuCount", description="变体SKU计数")
|
|
285
|
+
current_sku_count: int = Field(0, alias="currentSkuCount", description="当前SKU计数")
|
|
286
|
+
reference_by_group: int = Field(0, alias="referenceByGroup", description="按组引用")
|
|
287
|
+
agent_name: Optional[str] = Field(None, alias="agentName", description="代理商名称")
|
|
288
|
+
development_name: Optional[str] = Field(..., alias="developmentName", description="开发人员名称")
|
|
289
|
+
sales_name: Optional[str] = Field(None, alias="salesName", description="销售人员名称")
|
|
290
|
+
productuu_id: Optional[str] = Field(None, alias="productuuId", description="商品UUID")
|
|
291
|
+
auth_id: Optional[str] = Field(None, alias="authId", description="授权ID")
|
|
292
|
+
ov_warehose_id: Optional[str] = Field(None, alias="ovWarehoseId", description="OV仓库ID")
|
|
293
|
+
product_amount_price: Optional[str] = Field(None, alias="productAmountPrice", description="商品金额价格")
|
|
294
|
+
is_pair_oversea: int = Field(0, alias="isPairOversea", description="是否配对海外")
|
|
295
|
+
id_str: str = Field(..., alias="idStr", description="ID字符串形式")
|
|
296
|
+
product_variation_str_list: List[str] = Field(..., alias="productVariationStrList",
|
|
297
|
+
description="商品变体字符串列表")
|
|
298
|
+
qc_template_id_str: str = Field(..., alias="qcTemplateIdStr", description="质检模板ID字符串")
|
|
299
|
+
goods_shelf_id_str: Optional[str] = Field(None, alias="goodsShelfIdStr", description="货架ID字符串形式")
|
|
300
|
+
|
|
301
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
class DxmProductCustoms(BaseModel):
|
|
305
|
+
"""DXM商品海关信息"""
|
|
306
|
+
id: int = Field(..., alias="id", description="海关信息ID")
|
|
307
|
+
product_id: int = Field(..., alias="productId", description="商品ID")
|
|
308
|
+
name_cn: str = Field(..., alias="nameCn", description="中文名称")
|
|
309
|
+
name_en: str = Field(..., alias="nameEn", description="英文名称")
|
|
310
|
+
price: float = Field(..., alias="price", description="价格")
|
|
311
|
+
weight: float = Field(..., alias="weight", description="重量")
|
|
312
|
+
material: str = Field("", alias="material", description="材料")
|
|
313
|
+
purpose: str = Field("", alias="purpose", description="用途")
|
|
314
|
+
hgbm: str = Field(..., alias="hgbm", description="海关编码")
|
|
315
|
+
danger_des: int = Field(0, alias="dangerDes", description="危险描述")
|
|
316
|
+
puid: int = Field(..., alias="puid", description="用户ID")
|
|
317
|
+
create_time: datetime = Field(..., alias="createTime", description="创建时间")
|
|
318
|
+
update_time: datetime = Field(..., alias="updateTime", description="更新时间")
|
|
319
|
+
sku: Optional[str] = Field(None, alias="sku", description="SKU编码")
|
|
320
|
+
id_str: str = Field(..., alias="idStr", description="ID字符串形式")
|
|
321
|
+
|
|
322
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
class ProductDTO(BaseModel):
|
|
326
|
+
"""商品数据传输对象"""
|
|
327
|
+
dxm_commodity_product: DxmCommodityProduct = Field(..., alias="dxmCommodityProduct", description="DXM商品信息")
|
|
328
|
+
dxm_product_customs: DxmProductCustoms = Field(..., alias="dxmProductCustoms", description="DXM商品海关信息")
|
|
329
|
+
dxm_warehose_list: Optional[List[Any]] = Field(None, alias="dxmWarehoseList", description="DXM仓库列表")
|
|
330
|
+
warehouse_id_list: Optional[List[Any]] = Field(None, alias="warehouseIdList", description="仓库ID列表")
|
|
331
|
+
dxm_quality_check_template: Optional[Any] = Field(None, alias="dxmQualityCheckTemplate", description="DXM质检模板")
|
|
332
|
+
dxm_supplier_product_relation_list: Optional[List[Any]] = Field(None, alias="dxmSupplierProductRelationList",
|
|
333
|
+
description="DXM供应商商品关系列表")
|
|
334
|
+
dxm_commodity_product_list: Optional[List[Any]] = Field(None, alias="dxmCommodityProductList",
|
|
335
|
+
description="DXM商品列表")
|
|
336
|
+
spu: Optional[str] = Field(None, alias="spu", description="SPU编码")
|
|
337
|
+
dxm_product_packs: List[Any] = Field(..., alias="dxmProductPacks", description="DXM商品包装列表")
|
|
338
|
+
supplier_product_relation_map_list: Optional[List[SupplierProductRelation]] = Field(...,
|
|
339
|
+
alias="supplierProductRelationMapList",
|
|
340
|
+
description="供应商商品关系映射列表")
|
|
341
|
+
dxm_warehouse_product_list: Optional[List[DxmWarehouseProduct]] = Field(..., alias="dxmWarehouseProductList",
|
|
342
|
+
description="DXM仓库商品列表")
|
|
343
|
+
count: Optional[int] = Field(0, alias="count", description="计数")
|
|
344
|
+
|
|
345
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
class ViewDxmCommodityProductResponse(BaseModel):
|
|
349
|
+
"""查看DXM商品信息响应"""
|
|
350
|
+
product_dto: ProductDTO = Field(..., alias="productDTO", description="商品数据传输对象")
|
|
351
|
+
|
|
352
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
# =============================编辑部分=========================================
|
|
356
|
+
|
|
357
|
+
class EditDxmCommodityProduct(BaseModel):
|
|
358
|
+
product_id: str = Field("", alias="productId")
|
|
359
|
+
name: str
|
|
360
|
+
name_en: str = Field("", alias="nameEn")
|
|
361
|
+
sku_code: str = Field("", alias="skuCode")
|
|
362
|
+
sku: str
|
|
363
|
+
product_variation_str: str = Field("", alias="productVariationStr")
|
|
364
|
+
sbm_id: str = Field("", alias="sbmId")
|
|
365
|
+
agent_id: str = Field("", alias="agentId")
|
|
366
|
+
development_id: str = Field("", alias="developmentId")
|
|
367
|
+
sales_id: str = Field("", alias="salesId")
|
|
368
|
+
weight: str
|
|
369
|
+
allow_weight_error: str = Field("", alias="allowWeightError")
|
|
370
|
+
price: str
|
|
371
|
+
source_url: str = Field("", alias="sourceUrl")
|
|
372
|
+
img_url: str = Field("", alias="imgUrl")
|
|
373
|
+
is_used: int = Field(..., alias="isUsed")
|
|
374
|
+
full_cid: str = Field(..., alias="fullCid")
|
|
375
|
+
product_type: str = Field(..., alias="productType")
|
|
376
|
+
length: int
|
|
377
|
+
width: int
|
|
378
|
+
height: int
|
|
379
|
+
qc_type: int = Field(..., alias="qcType")
|
|
380
|
+
product_status: int = Field(..., alias="productStatus")
|
|
381
|
+
child_ids: str = Field("", alias="childIds")
|
|
382
|
+
child_nums: str = Field("", alias="childNums")
|
|
383
|
+
process_fee: int = Field(..., alias="processFee")
|
|
384
|
+
qc_content: str = Field("", alias="qcContent")
|
|
385
|
+
qc_img_str: str = Field("", alias="qcImgStr")
|
|
386
|
+
qc_img_num: int = Field("", alias="qcImgNum")
|
|
387
|
+
group_state: str = Field("", alias="groupState")
|
|
388
|
+
ncm: str = Field("", alias="ncm")
|
|
389
|
+
cest: str = Field("", alias="cest")
|
|
390
|
+
unit: str = Field("", alias="unit")
|
|
391
|
+
origin: str = Field("", alias="origin")
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
class EditDxmProductCustoms(BaseModel):
|
|
395
|
+
name_cn_bg: str = Field(..., alias="nameCnBg")
|
|
396
|
+
name_en_bg: str = Field(..., alias="nameEnBg")
|
|
397
|
+
weight_bg: str = Field(..., alias="weightBg")
|
|
398
|
+
price_bg: str = Field(..., alias="priceBg")
|
|
399
|
+
material_bg: str = Field("", alias="materialBg")
|
|
400
|
+
purpose_bg: str = Field("", alias="purposeBg")
|
|
401
|
+
hgbm_bg: str = Field("", alias="hgbmBg")
|
|
402
|
+
danger_des_bg: str = Field(..., alias="dangerDesBg")
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
class EditSupplierProductRelationMap(BaseModel):
|
|
406
|
+
supplier_id: str = Field(..., alias="supplierId")
|
|
407
|
+
is_main: int = Field(..., alias="isMain")
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
class EditObj(BaseModel):
|
|
411
|
+
dxm_commodity_product: EditDxmCommodityProduct = Field(..., alias="dxmCommodityProduct")
|
|
412
|
+
dxm_product_customs: EditDxmProductCustoms = Field(..., alias="dxmProductCustoms")
|
|
413
|
+
warehouse_id_list: str = Field("", alias="warehouseIdList")
|
|
414
|
+
supplier_product_relation_map_list: List[EditSupplierProductRelationMap] = Field(..., alias="supplierProductRelationMapList")
|
|
415
|
+
dxm_product_packs: List = Field(..., alias="dxmProductPacks")
|
|
416
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from pydantic import BaseModel, Field, ConfigDict
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class DxmEbayProductModel(BaseModel):
|
|
5
|
+
page_no: str = Field(default='', alias='pageNo', description="页码")
|
|
6
|
+
page_size: str = Field(default='', alias='pageSize', description="每页数量")
|
|
7
|
+
shop_id: str = Field(default=-1, alias='shopId', description="店铺ID 全部:-1")
|
|
8
|
+
shop_group_id: str = Field(default='', alias='shopGroupId')
|
|
9
|
+
full_cid: str = Field(default='', alias='fullCid')
|
|
10
|
+
dxm_state: str = Field(default='online', alias='dxmState', description="店小秘在线状态 online/offline")
|
|
11
|
+
dxm_offline_state: str = Field(default='', alias='dxmOfflineState', description="店小秘离线状态")
|
|
12
|
+
search_type: str = Field(default='1', alias='searchType', description="搜索类型(1:标题-3:sku-4:SubSku)")
|
|
13
|
+
search_value: str = Field(default='', alias='searchValue', description="搜索内容")
|
|
14
|
+
sort_name: str = Field(default='', alias='sortName', description="排序字段")
|
|
15
|
+
sort_value: str = Field(default='0', alias='sortValue', description="排序内容")
|
|
16
|
+
sell_ype: str = Field(default='0', alias='sellType', description="售卖形式 全部:0,拍卖:'1'具体参照页面")
|
|
17
|
+
listing_status: str = Field(default='', alias='listingStatus')
|
|
18
|
+
advanced_search: str = Field(default='yes', alias='advancedSearch')
|
|
19
|
+
price_lift: str = Field(default='', alias='priceLift')
|
|
20
|
+
price_right: str = Field(default='', alias='priceRight')
|
|
21
|
+
inventory_lift: str = Field(default='', alias='inventoryLift')
|
|
22
|
+
inventory_right: str = Field(default='', alias='inventoryRight')
|
|
23
|
+
save_lift: str = Field(default='', alias='saveLift')
|
|
24
|
+
save_right: str = Field(default='', alias='saveRight')
|
|
25
|
+
sold_lift: str = Field(default='', alias='soldLift')
|
|
26
|
+
sold_right: str = Field(default='', alias='soldRight')
|
|
27
|
+
time_lift: str = Field(default='', alias='timeLift')
|
|
28
|
+
time_right: str = Field(default='', alias='timeRight')
|
|
29
|
+
hit_count_lift: str = Field(default='', alias='hitCountLift')
|
|
30
|
+
hit_count_right: str = Field(default='', alias='hitCountRight')
|
|
31
|
+
listing_duration: str = Field(default='', alias='listingDuration')
|
|
32
|
+
dispatch_time_max: str = Field(default='', alias='dispatchTimeMax')
|
|
33
|
+
paypal: str = Field(default='', alias='paypal')
|
|
34
|
+
gpsr_manufacturer: str = Field(default='-1', alias='gpsrManufacturer')
|
|
35
|
+
gpsr_responsible_persons: str = Field(default='-1', alias='gpsrResponsiblePersons')
|
|
36
|
+
gpsr_safety: str = Field(default='-1', alias='gpsrSafety')
|
|
37
|
+
gpsr_documents: str = Field(default='-1', alias='gpsrDocuments')
|
|
38
|
+
gpsr_document_status: str = Field(default='-1', alias='gpsrDocumentStatus')
|
|
39
|
+
country: str = Field(default='', alias='country')
|
|
40
|
+
advanced_time: str = Field(default='1', alias='advancedTime')
|
|
41
|
+
source_url: str = Field(default='', alias='sourceUrl')
|
|
42
|
+
product_search_type: str = Field(default='1', alias='productSearchType')
|
|
43
|
+
site: str = Field(default='', alias='site', description="站点(国家代码 例如US )")
|
|
44
|
+
product_category_id: str = Field(default='', alias='productCategoryId')
|
|
45
|
+
store_category_id: str = Field(default='0', alias='storeCategoryId')
|
|
46
|
+
location_name: str = Field(default='', alias='locationName')
|
|
47
|
+
video_sel: str = Field(default='-1', alias='videoSel')
|
|
48
|
+
comment_type: str = Field(default='0', alias='commentType')
|
|
49
|
+
comment_content: str = Field(default='', alias='commentContent')
|
|
50
|
+
vat_percent_type: str = Field(default='', alias='vatPercentType')
|
|
51
|
+
motor_state: str = Field(default='0', alias='motorState')
|
|
52
|
+
|
|
53
|
+
model_config = ConfigDict(
|
|
54
|
+
populate_by_name=True,
|
|
55
|
+
title="店小秘ebay在线产品查询模型"
|
|
56
|
+
)
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
from ey_commerce_lib.dxm.schemas.dxm_commodity_product import ViewDxmCommodityProductResponse, EditObj
|
|
4
|
+
from ey_commerce_lib.utils.float import truncate_decimal_str
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def get_edit_commodity_product_by_view_dxm_response(data: ViewDxmCommodityProductResponse):
|
|
8
|
+
"""
|
|
9
|
+
根据查看店小秘接口的响应
|
|
10
|
+
:return:
|
|
11
|
+
"""
|
|
12
|
+
dxm_commodity_product = data.product_dto.dxm_commodity_product
|
|
13
|
+
dxm_product_customs = data.product_dto.dxm_product_customs
|
|
14
|
+
|
|
15
|
+
product_id = dxm_commodity_product.id
|
|
16
|
+
name = dxm_commodity_product.name
|
|
17
|
+
name_en = dxm_commodity_product.name_en
|
|
18
|
+
sku_code = dxm_commodity_product.sku_code
|
|
19
|
+
sku = dxm_commodity_product.sku
|
|
20
|
+
product_variation_str = ','.join(dxm_commodity_product.product_variation_str_list)
|
|
21
|
+
sbm_id = dxm_commodity_product.sbm_id
|
|
22
|
+
agent_id = dxm_commodity_product.agent_id
|
|
23
|
+
development_id = dxm_commodity_product.development_id
|
|
24
|
+
sales_id = dxm_commodity_product.sales_id
|
|
25
|
+
weight = dxm_commodity_product.weight
|
|
26
|
+
allow_weight_error = dxm_commodity_product.allow_weight_error
|
|
27
|
+
price = dxm_commodity_product.price
|
|
28
|
+
source_url = dxm_commodity_product.source_url
|
|
29
|
+
img_url = dxm_commodity_product.img_url
|
|
30
|
+
is_used = dxm_commodity_product.is_used
|
|
31
|
+
full_cid = dxm_commodity_product.full_cid
|
|
32
|
+
product_type = dxm_commodity_product.product_type
|
|
33
|
+
length = dxm_commodity_product.length
|
|
34
|
+
width = dxm_commodity_product.width
|
|
35
|
+
height = dxm_commodity_product.height
|
|
36
|
+
qc_type = dxm_commodity_product.qc_type
|
|
37
|
+
product_status = dxm_commodity_product.product_status
|
|
38
|
+
child_ids = dxm_commodity_product.child_ids
|
|
39
|
+
child_nums = dxm_commodity_product.child_nums
|
|
40
|
+
process_fee = dxm_commodity_product.process_fee
|
|
41
|
+
qc_content = dxm_commodity_product.qc_content
|
|
42
|
+
qc_img_num = dxm_commodity_product.qc_img_num
|
|
43
|
+
group_state = dxm_commodity_product.group_state
|
|
44
|
+
ncm = dxm_commodity_product.ncm
|
|
45
|
+
cest = dxm_commodity_product.cest
|
|
46
|
+
unit = dxm_commodity_product.unit
|
|
47
|
+
origin = dxm_commodity_product.origin
|
|
48
|
+
|
|
49
|
+
name_cn_bg = dxm_product_customs.name_cn
|
|
50
|
+
name_en_bg = dxm_product_customs.name_en
|
|
51
|
+
weight_bg = dxm_product_customs.weight
|
|
52
|
+
price_bg = dxm_product_customs.price
|
|
53
|
+
material_bg = dxm_commodity_product.material_bg
|
|
54
|
+
purpose_bg = dxm_commodity_product.purpose_bg
|
|
55
|
+
hgbm_bg = dxm_commodity_product.hgbm_bg
|
|
56
|
+
danger_des_bg = dxm_commodity_product.danger_des_bg
|
|
57
|
+
|
|
58
|
+
warehouse_id_list = data.product_dto.warehouse_id_list
|
|
59
|
+
|
|
60
|
+
supplier_product_relation_map_list = data.product_dto.supplier_product_relation_map_list or []
|
|
61
|
+
new_supplier_product_relation_map_list = []
|
|
62
|
+
for supplier_product_relation_map in supplier_product_relation_map_list:
|
|
63
|
+
supplier_id = supplier_product_relation_map.supplier_id
|
|
64
|
+
is_main = supplier_product_relation_map.is_main
|
|
65
|
+
new_supplier_product_relation_map_list.append({
|
|
66
|
+
'supplierId': supplier_id,
|
|
67
|
+
'isMain': is_main
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
dxm_product_packs = data.product_dto.dxm_product_packs
|
|
71
|
+
# sbmId 必须为字符串
|
|
72
|
+
return EditObj.model_validate({
|
|
73
|
+
'dxmCommodityProduct': {
|
|
74
|
+
'productId': str(product_id),
|
|
75
|
+
'name': name,
|
|
76
|
+
'nameEn': name_en,
|
|
77
|
+
'skuCode': sku_code,
|
|
78
|
+
'sku': sku,
|
|
79
|
+
'productVariationStr': product_variation_str,
|
|
80
|
+
'sbmId': sbm_id if sbm_id is not None else '',
|
|
81
|
+
'agentId': str(agent_id),
|
|
82
|
+
'developmentId': str(development_id),
|
|
83
|
+
'salesId': str(sales_id),
|
|
84
|
+
'weight': truncate_decimal_str(weight),
|
|
85
|
+
'allowWeightError': '',
|
|
86
|
+
'price': truncate_decimal_str(price),
|
|
87
|
+
'sourceUrl': source_url,
|
|
88
|
+
'imgUrl': img_url,
|
|
89
|
+
'isUsed': is_used,
|
|
90
|
+
'fullCid': full_cid,
|
|
91
|
+
'productType': product_type,
|
|
92
|
+
'length': length,
|
|
93
|
+
'width': width,
|
|
94
|
+
'height': height,
|
|
95
|
+
'qcType': qc_type,
|
|
96
|
+
'productStatus': 1,
|
|
97
|
+
'childIds': child_ids if child_ids is not None else '',
|
|
98
|
+
'childNums': child_nums if child_nums is not None else '',
|
|
99
|
+
'processFee': process_fee,
|
|
100
|
+
'qcContent': qc_content if qc_content is not None else '',
|
|
101
|
+
'qcImgNum': qc_img_num,
|
|
102
|
+
'groupState': str(group_state),
|
|
103
|
+
'ncm': ncm if ncm is not None else '',
|
|
104
|
+
'cest': cest if cest is not None else '',
|
|
105
|
+
'unit': unit if unit is not None else '',
|
|
106
|
+
'origin': origin if origin is not None else '0'
|
|
107
|
+
},
|
|
108
|
+
'dxmProductCustoms': {
|
|
109
|
+
'nameCnBg': name_cn_bg,
|
|
110
|
+
'nameEnBg': name_en_bg,
|
|
111
|
+
'weightBg': truncate_decimal_str(weight_bg),
|
|
112
|
+
'priceBg': truncate_decimal_str(price_bg, 4),
|
|
113
|
+
'materialBg': material_bg if material_bg is not None else '',
|
|
114
|
+
'purposeBg': purpose_bg if purpose_bg is not None else '',
|
|
115
|
+
'hgbmBg': hgbm_bg if hgbm_bg is not None else '',
|
|
116
|
+
'dangerDesBg': danger_des_bg if danger_des_bg is not None else '0'
|
|
117
|
+
},
|
|
118
|
+
'warehouseIdList': warehouse_id_list if warehouse_id_list is not None else '',
|
|
119
|
+
'supplierProductRelationMapList': new_supplier_product_relation_map_list,
|
|
120
|
+
'dxmProductPacks': dxm_product_packs
|
|
121
|
+
}).model_dump_json(by_alias=True)
|
|
122
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from decimal import Decimal, ROUND_DOWN
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def truncate_decimal(number, digits=2):
|
|
5
|
+
"""
|
|
6
|
+
截断保留指定位数的小数(不四舍五入),并保留末尾的 0
|
|
7
|
+
:param number: 输入的数字(int/float)
|
|
8
|
+
:param digits: 保留的小数位数(默认2位)
|
|
9
|
+
:return: 返回字符串形式,确保末尾 0 不省略
|
|
10
|
+
"""
|
|
11
|
+
if isinstance(number, int):
|
|
12
|
+
return f"{number}.{'0' * digits}"
|
|
13
|
+
|
|
14
|
+
decimal_num = Decimal(str(number))
|
|
15
|
+
truncated = decimal_num.quantize(
|
|
16
|
+
Decimal('0.' + '0' * digits),
|
|
17
|
+
rounding=ROUND_DOWN
|
|
18
|
+
)
|
|
19
|
+
return format(truncated, f".{digits}f") # 强制保留末尾 0
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def truncate_decimal_str(number, digits=2):
|
|
23
|
+
"""
|
|
24
|
+
使用decimal模块实现(最精确的方式)
|
|
25
|
+
"""
|
|
26
|
+
return str(truncate_decimal(number, digits))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
if __name__ == '__main__':
|
|
30
|
+
print(truncate_decimal(200.000, 4))
|
|
@@ -2,7 +2,7 @@ ey_commerce_lib/__init__.py,sha256=QTYqXqSTHFRkM9TEgpDFcHvwLbvqHDqvqfQ9EiXkcAM,2
|
|
|
2
2
|
ey_commerce_lib/model.py,sha256=0ZCE68502blzRDsQ38AIswc8kPk7H34Am5x8IiDi2DU,232
|
|
3
3
|
ey_commerce_lib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
ey_commerce_lib/dxm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
ey_commerce_lib/dxm/main.py,sha256=
|
|
5
|
+
ey_commerce_lib/dxm/main.py,sha256=mwbwshZcY-pzIilRDDw_330KHXKHStCASv37T7S-LR4,28787
|
|
6
6
|
ey_commerce_lib/dxm/order.py,sha256=hMdNm9X5h9tbvMWFnyE5hcSF4butzn7m-akGqLQUD0k,35
|
|
7
7
|
ey_commerce_lib/dxm/constant/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
ey_commerce_lib/dxm/constant/order.py,sha256=U-2NYnkIcqukzMtOFpfqvzIktu_t7jYEms_n9LgKMlY,2213
|
|
@@ -11,14 +11,18 @@ ey_commerce_lib/dxm/exception/common.py,sha256=DM5vItHdZCGK2Piqp2S5TFxPm3pioMzzl
|
|
|
11
11
|
ey_commerce_lib/dxm/parser/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
ey_commerce_lib/dxm/parser/common.py,sha256=-xfnaYhMStuvR-XEJTWAgTN2H88xflGtWXIrxDqbq0Q,3037
|
|
13
13
|
ey_commerce_lib/dxm/parser/count.py,sha256=WOrGeA6DP6_IBtiF1TEZhW528f8kHxlT2cpmg_7FKPM,1561
|
|
14
|
-
ey_commerce_lib/dxm/parser/
|
|
14
|
+
ey_commerce_lib/dxm/parser/ebay_product.py,sha256=Ub6of2YhFnXQwZiFBvZa6wnTIsGbsedAKHW92dbBHIY,589
|
|
15
|
+
ey_commerce_lib/dxm/parser/order.py,sha256=vnu5jqea8IoTGk_kFlDcUnrZF5NKuBIQUGAYaxQVSg4,17972
|
|
15
16
|
ey_commerce_lib/dxm/parser/purchase.py,sha256=lmcC41HtdUqCgGamFASPnzHatUziLFaenTJmazsiMm0,5750
|
|
16
17
|
ey_commerce_lib/dxm/parser/warehouse.py,sha256=oQVojPX8VKHUphdV1KY5ZK1PCFtOY2zwkyLNUeJ3JT0,3310
|
|
17
18
|
ey_commerce_lib/dxm/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
19
|
ey_commerce_lib/dxm/schemas/common.py,sha256=ihCeYrh4K_-m9_4rVzHm-o8rFNqzcD5XkO0JQd2023g,234
|
|
20
|
+
ey_commerce_lib/dxm/schemas/dxm_commodity_product.py,sha256=e48ojtOqNfnCaOyPLsBlv4AwfmfkBg62w7J2sA9l1E4,30875
|
|
21
|
+
ey_commerce_lib/dxm/schemas/ebay_product.py,sha256=k8LqBCz657vYRcLRjjyPJjQYjQOSwSGBivvp2LPWuYc,3696
|
|
19
22
|
ey_commerce_lib/dxm/schemas/order.py,sha256=6ps9aXFcEiRASLv1CH5uW7wnplaWzD_vTfyzvi5eLE0,7881
|
|
20
23
|
ey_commerce_lib/dxm/schemas/warehouse.py,sha256=BT9r92DgkGKRI-HPqHPt5FKPdPJr2h-rxjfh25STR2E,5094
|
|
21
24
|
ey_commerce_lib/dxm/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
|
+
ey_commerce_lib/dxm/utils/dxm_commodity_product.py,sha256=k7ANpQ0M2Tf94QO0xcQUpdBrjZN-pXVL--_s_wrwX5E,5413
|
|
22
26
|
ey_commerce_lib/dxm/utils/mark.py,sha256=rAmofi3JmdI8gdl3s-U0ZEKcA-cn6vtS3lsXDrVXRLc,4716
|
|
23
27
|
ey_commerce_lib/four_seller/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
28
|
ey_commerce_lib/four_seller/main.py,sha256=cqO29DRRVzJHwo_005RFOO3vyGboQcuJUli783nyQjA,13131
|
|
@@ -46,8 +50,9 @@ ey_commerce_lib/takesend/main.py,sha256=Omz7Wmo0bBzQvMA-_zVQG1sH-W-RsX5AeetFE2a1
|
|
|
46
50
|
ey_commerce_lib/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
47
51
|
ey_commerce_lib/utils/close.py,sha256=-De_H1I-gryytKYhLMsC3HfW67W852XkP1ckK2gLsFs,141
|
|
48
52
|
ey_commerce_lib/utils/dxm.py,sha256=jVNltK_Pm_yMzXReD0Aw5VW6kzIZ5Bn23RucS0DKBI0,1196
|
|
53
|
+
ey_commerce_lib/utils/float.py,sha256=PiOMf9pRApc1DskKkhKx0LAWHAYTpAPT_G4QRZRd8ZU,905
|
|
49
54
|
ey_commerce_lib/utils/list_util.py,sha256=R1w7B1m3sEXr38zSHWp-15C3xAs5ykYCCpvwmnRW4xs,545
|
|
50
55
|
ey_commerce_lib/utils/str.py,sha256=939xE0y8U7KEWjwbEezMlaWJNBsfb2BSb-dBpYbOD8Q,138
|
|
51
|
-
ey_commerce_lib-1.0.
|
|
52
|
-
ey_commerce_lib-1.0.
|
|
53
|
-
ey_commerce_lib-1.0.
|
|
56
|
+
ey_commerce_lib-1.0.15.dist-info/METADATA,sha256=wVymcuISab9JO0cH3UkFtnrdP7iEWrDwHLvcFi6qCeA,391
|
|
57
|
+
ey_commerce_lib-1.0.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
58
|
+
ey_commerce_lib-1.0.15.dist-info/RECORD,,
|
|
File without changes
|