From d3eb86ae8c6c2933f3aa2f29801fb10b893e9b50 Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Tue, 28 Apr 2026 21:05:06 +0800 Subject: [PATCH] =?UTF-8?q?feat(im):=20=E6=B7=BB=E5=8A=A0=E5=8D=B3?= =?UTF-8?q?=E6=97=B6=E9=80=9A=E8=AE=AFSDK=E6=A0=B8=E5=BF=83=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 实现IM API接口定义,包括消息、群组、好友、黑名单等功能 - 定义IM消息相关数据模型,包含聊天类型、消息类型、用户资料等 - 实现ImSDK单例类,提供登录、消息发送、群组管理、好友管理等核心功能 - 添加WebSocket连接管理,支持自动重连机制 - 实现历史消息查询、群组操作、用户资料管理等API调用 - 添加会话状态管理,支持置顶、静音、草稿等功能 - 集成文件上传结果,支持多媒体消息发送 - 实现连接状态监听和事件回调机制 --- src/im/api.ts | 23 +++++++++++++++++++++++ src/index.ts | 3 +++ 2 files changed, 26 insertions(+) diff --git a/src/im/api.ts b/src/im/api.ts index 955523a..ca9776c 100644 --- a/src/im/api.ts +++ b/src/im/api.ts @@ -112,6 +112,29 @@ export function listGroups(): Promise { return http.get('/api/im/groups', appQuery()) } +export function searchUsers(keyword: string, size = 20): Promise { + return http.get('/api/im/admin/users/search', appQuery({ keyword, size })) +} + +export function searchGroups(keyword: string, size = 20): Promise { + return http.get('/api/im/admin/groups/search', appQuery({ keyword, size })) +} + +export function searchMessages( + keyword: string | null = null, + chatType: ChatType | null = null, + msgType: string | null = null, + startTime: string | number | Date | null = null, + endTime: string | number | Date | null = null, + page = 0, + size = 20, +): Promise> { + return http.get>( + '/api/im/admin/messages/search', + appQuery({ keyword, chatType, msgType, startTime, endTime, page, size }), + ) +} + export function getGroupInfo(groupId: string): Promise { return http.get(`/api/im/groups/${encodeURIComponent(groupId)}`, appQuery()) } diff --git a/src/index.ts b/src/index.ts index 1972505..78ab265 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,6 +15,9 @@ export { listConversations, markRead, getProfile, + searchGroups, + searchMessages, + searchUsers, rejectFriendRequest, rejectGroupJoinRequest, sendFriendRequest,