From 867227fc51bf699693cb5912014a0625a3dd533d Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Tue, 28 Apr 2026 16:55:12 +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=AF=E5=8A=9F=E8=83=BD=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加了 IM API 接口定义,包含登录、消息、群组、好友等接口 - 实现了 ImSDK 核心功能,支持发送各类消息和管理会话 - 集成了 WebSocket 连接管理和自动重连机制 - 添加了本地联系人缓存并优化对话标题显示逻辑 - 实现了 HarmonyOS 平台 HTTP 客户端基础功能 --- tenant-platform/src/api/im.ts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tenant-platform/src/api/im.ts b/tenant-platform/src/api/im.ts index 050346f..3fa724d 100644 --- a/tenant-platform/src/api/im.ts +++ b/tenant-platform/src/api/im.ts @@ -40,6 +40,17 @@ export interface ImUser { createdAt: number } +export interface ImProfile { + id?: string + appId?: string + userId: string + nickname?: string | null + avatar?: string | null + gender?: 'UNKNOWN' | 'MALE' | 'FEMALE' | string | null + status?: 'ACTIVE' | 'BANNED' | string | null + createdAt?: number | null +} + export interface ImGroup { id: string appId: string @@ -162,4 +173,26 @@ export const imAdminApi = { { params: { appId, keyword, size } }, ) }, + + getProfile(appId: string, userId: string) { + return imClient.get<{ data: ImProfile }>( + `/api/im/accounts/${encodeURIComponent(userId)}`, + { params: { appId } }, + ) + }, + + updateProfile(appId: string, userId: string, nickname?: string, avatar?: string, gender?: string) { + return imClient.put<{ data: ImProfile }>( + `/api/im/accounts/${encodeURIComponent(userId)}`, + {}, + { + params: { + appId, + ...(nickname ? { nickname } : {}), + ...(avatar ? { avatar } : {}), + ...(gender ? { gender } : {}), + }, + }, + ) + }, }