fix(im): add toId/chatType filters to MessageSearchParams and searchMessages

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
这个提交包含在:
XuqmGroup 2026-04-27 13:36:44 +08:00
父节点 21f27c1770
当前提交 afe13d1c90

查看文件

@ -20,6 +20,8 @@ function conversationId(appId: string, userId: string, targetId: string, chatTyp
export interface MessageSearchParams {
keyword?: string
toId?: string
chatType?: string
startTime?: number
endTime?: number
msgTypes?: string[]
@ -165,6 +167,12 @@ export const ImDatabase = {
Q.where('app_id', appId),
]
if (params.toId) {
conditions.push(Q.where('to_id', params.toId))
}
if (params.chatType) {
conditions.push(Q.where('chat_type', params.chatType))
}
if (params.keyword) {
conditions.push(Q.where('content', Q.like(`%${Q.sanitizeLikeString(params.keyword)}%`)))
}