diff --git a/yunkes/src/api/index.ts b/yunkes/src/api/index.ts index 9045666..29dad02 100644 --- a/yunkes/src/api/index.ts +++ b/yunkes/src/api/index.ts @@ -76,7 +76,8 @@ export function getCustomers(query: CustomerQuery = {}): Promise> export interface MessageQuery { channel?: Channel - owner_account_id: string + /** 群聊按 room_id 查时可省略(chat_group owner 与消息 owner 可能错位)。 */ + owner_account_id?: string talker_id?: string room_id?: string start?: number diff --git a/yunkes/src/views/ChatTimeline.vue b/yunkes/src/views/ChatTimeline.vue index 039ced4..12c9699 100644 --- a/yunkes/src/views/ChatTimeline.vue +++ b/yunkes/src/views/ChatTimeline.vue @@ -170,11 +170,13 @@ function scrollToBottom(): void { function queryFor(pageNum: number) { return { channel: channelTyped.value, - owner_account_id: props.ownerId, - talker_id: isGroup.value ? undefined : props.talkerId, - room_id: isGroup.value ? props.roomId : undefined, - start: winStart.value, - end: winEnd.value, + // 群聊不带 owner:chat_group 表按 room_id 去重、owner 被最后写入的员工 + // 覆盖,与消息实际归属的 owner 错位会查空(实测 2026-08-22);room 全局 + // 唯一且消息只在单一 owner 名下(多 owner 群=0),按 room 查即正确。 + ...(isGroup.value + ? { room_id: props.roomId as string } + : { owner_account_id: props.ownerId, talker_id: props.talkerId as string }), + ...(winStart.value != null && winEnd.value != null ? { start: winStart.value, end: winEnd.value } : {}), page: pageNum, page_size: PAGE_SIZE, }