fix(worker-platform): 补齐拼单份额超时自动处置机制与退回大厅流程

- 根因排查:此前超时扫描仅针对整单 in_progress,而拼单母单为 open 且 deadline_at 为空,导致打手超时的拼单份额无法被定时扫描命中与释放;
- 定时扫描:在 settleOverdueWorkOrders 中引入 listOverdueWorkOrderShares,自动扫描超时未提交资料的拼单份额(joined);
- 超时处置:新增 settleOverdueWorkOrderShare 事务处理,按母单 timeout_policy 释放或扣除押金,份额标记 cancelled,母单保持或恢复 open 状态重回抢单大厅,记录 timeout 事件并推送实时变更;
- 提交防呆:在打手提交拼单验收时检测个人份额是否已超时,超时则立即执行处置并拦截提交;
- 倒计时展示:在 mapWorkOrderForWorker 中根据 myShare.created_at + timeout_minutes 为拼单打手计算并展示个人履约截止时间;
- 质量验证:补齐拼单截止时间计算与处置链路测试,全量 676 个测试均通过,通过 npm run check 校验。
This commit is contained in:
yml2213
2026-10-11 14:53:56 +08:00
parent 06d888fb6f
commit b82f9c4063
20 changed files with 418 additions and 44 deletions
@@ -150,7 +150,7 @@ async function api<T = unknown>(
const response = await fetch(`${apiBase}${pathName}`, {
method,
headers: {
'authorization': `Bearer ${token}`,
authorization: `Bearer ${token}`,
...(body ? { 'content-type': 'application/json' } : {}),
},
body: body ? JSON.stringify(body) : undefined,
@@ -174,7 +174,6 @@ function defaultAdminUser(): { username?: string; password?: string } {
return {}
}
/**
* 打平台 messagetest:平台会**按当前订阅**把消息推回 message_url。
* 签名与消息推送同一套(我们扮演平台侧签名)。