fix: SDS factory(dict取值)+ confirmedAt(gmtConfirmTime) 映射修复
This commit is contained in:
@@ -132,6 +132,7 @@ class Order(_SdsModel):
|
||||
online_order_status_code: str | None = None
|
||||
gmt_created: str | None = None
|
||||
gmt_pay: str | None = None
|
||||
gmt_confirm_time: str | None = Field(default=None, alias="gmtConfirmTime")
|
||||
pay_status: int | None = None
|
||||
latest_ship_time: Any | None = None
|
||||
refund_status: int | None = None
|
||||
|
||||
@@ -5,6 +5,7 @@ services:
|
||||
command: prefect server start --host 0.0.0.0
|
||||
environment:
|
||||
PREFECT_UI_API_URL: http://192.168.124.92:4200/api
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- "4200:4200"
|
||||
volumes:
|
||||
@@ -16,6 +17,7 @@ services:
|
||||
container_name: prefect-worker
|
||||
environment:
|
||||
PREFECT_API_URL: http://prefect-server:4200/api
|
||||
TZ: Asia/Shanghai
|
||||
depends_on:
|
||||
- prefect-server
|
||||
restart: unless-stopped
|
||||
|
||||
@@ -243,13 +243,13 @@ def map_sds_order(raw: Any, channel_type_map: dict[int, str | None], pre_courier
|
||||
|
||||
factory_name: str | None = None
|
||||
for item in raw.items or []:
|
||||
fname = getattr(getattr(item, "factory", None), "name", None)
|
||||
if not fname and isinstance(item, dict):
|
||||
fname = (item.get("factory") or {}).get("name")
|
||||
fac = getattr(item, "factory", None)
|
||||
fname = fac.get("name") if isinstance(fac, dict) else getattr(fac, "name", None)
|
||||
if fname:
|
||||
factory_name = fname
|
||||
break
|
||||
|
||||
confirmed_at = _parse(getattr(raw, "gmt_confirm_time", None), f"SDS order {raw.no} gmtConfirmTime")
|
||||
area_name = raw.issuing_bay_area.name if raw.issuing_bay_area else None
|
||||
return OrderUpsertInput(
|
||||
orderNo=raw.no,
|
||||
@@ -266,7 +266,7 @@ def map_sds_order(raw: Any, channel_type_map: dict[int, str | None], pre_courier
|
||||
platformStatus=raw.online_order_status_name,
|
||||
createdAt=safe_date(raw.gmt_created, f"SDS order {raw.no}"),
|
||||
orderedAt=ordered_at,
|
||||
confirmedAt=None,
|
||||
confirmedAt=confirmed_at,
|
||||
completedAt=completed_at,
|
||||
shipDeadline=ship_deadline,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user