发布(0.4.6): 修复预售兑换记录判定与详情展示并新增工作台强制发放

This commit is contained in:
yml
2026-11-27 14:50:45 +08:00
parent 5006367217
commit e25e35994d
22 changed files with 1118 additions and 38 deletions
@@ -383,3 +383,40 @@ def record_douyu_operation_result(
"issueCode": issue_code,
},
)
def record_workbench_force_exchange(
db: Session,
*,
task_id: int,
current: User,
batch_id: str,
douyu_task_id: int,
task_type: str,
commodity_id: str = "",
goods_name: str = "",
account_id: int | None = None,
account_username: str = "",
account_role: str = "",
) -> None:
"""工作台确认账号和角色一致后强制发放时,在履约时间线记一笔操作留痕(不改订单状态)。"""
_append_event(
db,
int(task_id),
"workbench_force_exchange",
actor_type="user",
actor_id=int(current.id),
detail={
"operatorId": int(current.id),
"operatorUsername": str(current.username or ""),
"batchId": batch_id,
"douyuTaskId": int(douyu_task_id),
"taskType": task_type,
"taskLabel": SUPPORTED_DOUYU_TASK_TYPES.get(task_type, task_type),
"commodityId": str(commodity_id or ""),
"goodsName": str(goods_name or ""),
"accountId": int(account_id) if account_id is not None else None,
"accountUsername": str(account_username or ""),
"accountRole": str(account_role or ""),
},
)