修复 affiliate-dash 提交成功(delivered)后结果页数秒后才显示成功
- syncAffiliateDashTaskStatus 新增 snapshotOnly:submit 拿到 delivered 后直接用本地快照收敛任务为 REDEEMED,不等平台回调(此前要等 delivered notify 落地,约 9 秒) - 新增终态保护:已 REDEEMED/MANUAL_REVIEW/CLOSED/FAILED 的任务,非 delivered 状态不再降级(轮询时平台详情短暂返回 paid/delivering 会把成功任务打回 REDEEMING) - submitAffiliateDashClaim:result.status=delivered 时重新读任务并 snapshotOnly 收敛
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { createTaskEvent } from '../../repositories/task-event-repo.js'
|
||||
import { updateTask } from '../../repositories/task-repo.js'
|
||||
import { getTaskById, updateTask } from '../../repositories/task-repo.js'
|
||||
import { createHttpError } from '../../utils/http.js'
|
||||
import { parseTaskContext as parseTaskContextValue } from '../../utils/task-json.js'
|
||||
import { nowIso } from '../../utils/time.js'
|
||||
@@ -456,6 +456,15 @@ export async function submitAffiliateDashClaim(
|
||||
now,
|
||||
)
|
||||
|
||||
// 平台已返回 delivered:立即用本地快照收敛任务为成功,不等平台回调(避免结果页等数秒)。
|
||||
// delivered 回调到达时 sync 幂等短路(已 REDEEMED 且 delivered 仍会刷新,无副作用)。
|
||||
if (result.status === 'delivered') {
|
||||
const refreshedTask = await getTaskById(task.id)
|
||||
if (refreshedTask) {
|
||||
await syncAffiliateDashTaskStatus(refreshedTask, { snapshotOnly: true })
|
||||
}
|
||||
}
|
||||
|
||||
return getKuaishouCloudClaimDetail(token)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user