feat(fulfillment): 支持手动同步斗鱼外部单协作

This commit is contained in:
yml
2026-11-18 21:02:11 +08:00
parent 631862217d
commit c2d47b98ab
15 changed files with 912 additions and 3 deletions
@@ -17,6 +17,7 @@ from sqlalchemy.orm import Session
from ...models import (
Account,
AccountLease,
DouyuExternalOrder,
DouyuGoodsSnapshot,
DouyuTask,
PlatformCommodityMapping,
@@ -949,6 +950,11 @@ def _task_out(
if task.bind_task_id
else None
)
collab_order = (
db.query(DouyuExternalOrder)
.filter(DouyuExternalOrder.source_task_id == task.id)
.first()
)
bind_result = (bind_task.result or {}) if bind_task else {}
# 外层只消费共享绑定规则,不再自己比较角色名或 bindAct。
pending_role = pending_binding_role_from_result(bind_result)
@@ -982,6 +988,16 @@ def _task_out(
"paidAt": task.paid_at,
"createdAt": task.created_at,
"updatedAt": task.updated_at,
"collabOrder": (
{
"id": collab_order.id,
"orderNo": collab_order.order_no,
"status": collab_order.status,
"lastSyncedAt": collab_order.last_synced_at,
}
if collab_order
else None
),
"account": (
{
"id": account.id,