1
0
forked from erp-dev/erp

feat: added mdy_product_sync new task for merchant_id isolated

This commit is contained in:
2026-02-04 18:47:07 +08:00
parent 21f1d1ba27
commit 0e56412f5d
5 changed files with 322 additions and 8 deletions

View File

@@ -135,6 +135,7 @@ def sync_mdy_plate_orders_to_staging(
use_checkpoint: bool = True,
update_checkpoint: bool = True,
sort_direction: Literal["asc", "desc"] = "asc",
merchant_id: int | None = None,
) -> dict:
"""同步明道云开版数据表到暂存表(含可选跨表关联数据)。
@@ -161,7 +162,8 @@ def sync_mdy_plate_orders_to_staging(
if use_checkpoint:
last_sync = (
api_models.DataSync.objects.filter(
table_name=api_models.DataSync.TableName.PLATE_ORDER
table_name=api_models.DataSync.TableName.PLATE_ORDER,
merchant_id=merchant_id,
)
.order_by("-created_at")
.first()
@@ -292,6 +294,7 @@ def sync_mdy_plate_orders_to_staging(
if update_checkpoint:
api_models.DataSync.objects.create(
table_name=api_models.DataSync.TableName.PLATE_ORDER,
merchant_id=merchant_id,
page_index=page_index,
page_size=page_size,
synced_rows=synced_rows,
@@ -315,5 +318,5 @@ def sync_mdy_plate_orders_to_staging(
"use_checkpoint": use_checkpoint,
"update_checkpoint": update_checkpoint,
}
logger.info("明道云开版暂存同步完成: %s", payload)
logger.info("明道云开版暂存同步完成(merchant=%s): %s", merchant_id, payload)
return payload