excel唯一逻辑修复
This commit is contained in:
@@ -3652,6 +3652,8 @@ export class TaskService {
|
||||
if (!conversationId) {
|
||||
throw new TaskError('task_selection_required', '发送名单附件时必须指定 task_id 或 conversation_id。', 409);
|
||||
}
|
||||
// A retry can update an abandoned task; creation time keeps the attachment
|
||||
// paired with the user's latest roster instruction instead.
|
||||
result = await getPool(this.config).query(
|
||||
`SELECT t.id, t.task_id, t.business_route_id, t.status, t.channel_id,
|
||||
s.conversation_id
|
||||
@@ -3659,11 +3661,13 @@ export class TaskService {
|
||||
JOIN agent_sessions s ON s.task_id = t.id
|
||||
WHERE t.organization_id = $1
|
||||
AND t.status = 'awaiting_attachment'
|
||||
AND t.business_route_id IN ('passenger_list_import_independent', 'passenger_list_import_shared_child')
|
||||
AND t.archived_at IS NULL
|
||||
AND s.conversation_id = $2
|
||||
AND ($3::uuid IS NULL OR t.channel_id = $3::uuid)
|
||||
AND ($4::boolean = false OR t.assigned_user_id = $5)
|
||||
ORDER BY t.updated_at DESC`,
|
||||
ORDER BY t.created_at DESC, t.id DESC
|
||||
LIMIT 1`,
|
||||
[
|
||||
context.organizationId,
|
||||
conversationId,
|
||||
@@ -3672,14 +3676,6 @@ export class TaskService {
|
||||
context.userId || null
|
||||
]
|
||||
);
|
||||
if ((result.rowCount ?? 0) > 1) {
|
||||
throw new TaskError(
|
||||
'task_selection_required',
|
||||
'同一会话有多个等待名单附件的任务,请指定 task_id。',
|
||||
409,
|
||||
{ task_ids: result.rows.map((row: Record<string, unknown>) => text(row.task_id)) }
|
||||
);
|
||||
}
|
||||
if (!result.rowCount) throw new TaskError('awaiting_attachment_task_not_found', '没有找到等待名单附件的任务。', 404);
|
||||
}
|
||||
const row = result.rows[0] as Record<string, unknown>;
|
||||
|
||||
Reference in New Issue
Block a user