feat: 详细日志(分页/映射/批次进度)+ Artifacts 摘要(sync-summary/verify-report)
This commit is contained in:
@@ -14,17 +14,21 @@ def sync_riin_records(raw_orders: list[Any], client: RiinDisClient, db: SyncDB)
|
||||
order_inputs: list[Any] = []
|
||||
order_meta: dict[str, tuple[str, Any]] = {} # raw.id -> (orderNo, createdAt)
|
||||
goods_failed = 0
|
||||
order_map_failed = 0
|
||||
|
||||
for raw in raw_orders:
|
||||
try:
|
||||
o = map_riin_order(raw)
|
||||
except Exception as err: # noqa: BLE001
|
||||
order_map_failed += 1
|
||||
print(f"[RIIN] 映射订单失败 {getattr(raw, 'platform_oid', '?')}: {err}")
|
||||
continue
|
||||
order_inputs.append(o)
|
||||
if raw.id:
|
||||
order_meta[raw.id] = (o.orderNo, o.createdAt)
|
||||
|
||||
print(f"[RIIN] 订单映射完成: 成功 {len(order_inputs)} / 失败 {order_map_failed} (共 {len(raw_orders)})")
|
||||
|
||||
goods_inputs: list[Any] = []
|
||||
if order_meta:
|
||||
goods_map = fetch_goods_concurrent(client, list(order_meta.keys()))
|
||||
@@ -38,6 +42,8 @@ def sync_riin_records(raw_orders: list[Any], client: RiinDisClient, db: SyncDB)
|
||||
except Exception as err: # noqa: BLE001
|
||||
print(f"[RIIN] 映射商品失败 order={order_no}: {err}")
|
||||
|
||||
print(f"[RIIN] 商品映射完成: {len(goods_inputs)} 条, 商品拉取失败订单 {goods_failed} 个")
|
||||
|
||||
stats = db.sync_orders_and_goods(order_inputs, goods_inputs)
|
||||
stats["orderCount"] = len(order_inputs)
|
||||
stats["goodsCount"] = len(goods_inputs)
|
||||
|
||||
Reference in New Issue
Block a user