RongIMLib View Markdown
    Preparing search index...

    Function searchMessagesByUser

    • 根据用户 ID 搜索本地消息

      Parameters

      • conversation: IConversationIdentifier

        会话信息

      • userId: string

        用户 ID

      • startTime: number

        搜索时间,搜索时间之前的消息

      • count: number

        获取的数量

      Returns Promise<RCResult<Pick<ISearchMessagesResult, "messages">>>

      本接口仅适用 Electron 平台在指定会话的所有频道中根据用户 ID 搜索时间范围内的消息

      5.7.10

      根据用户 ID 搜索本地消息示例:

      const conversation = {
      conversationType: RongIMLib.ConversationType.PRIVATE,
      targetId: 'targetId'
      };
      const userId = 'userId';
      const startTime = Date.now();
      const count = 10;
      const res = await RongIMLib.electronExtension.searchMessagesByUser(conversation, userId, startTime, count);
      console.info('根据用户 ID 搜索本地消息', res);