腾讯云即时通信IMFlutter_AI解决方案_同尘科技

即时通信 IM 2年前 (2023-06-13) 浏览 22

功能描述

用户搜索只能搜索本地存储过的用户,例如拉取过的好友列表,拉取过的用户资料等。说明Flutter SDK 3.8.0支持。

搜索本地用户资料

调用接口 searchFriends (点击查看详情) 可以搜索本地用户资料。
您可以设置搜索关键字 keywordList,并指定搜索的范围,即是否搜索用户的 userIDnickNameremark 字段。示例代码如下:

// 通过关键词搜索好友    //搜索好友的搜索条件    V2TimFriendSearchParam searchParam = V2TimFriendSearchParam(      isSearchNickName: true,//是否搜索昵称      isSearchRemark: true,//是否搜索备注      isSearchUserID: true,//是否搜索id      keywordList: [],//关键字列表,最多支持5个。    );    V2TimValueCallback<List> searchFriendsRes =        await TencentImSDKPlugin.v2TIMManager            .getFriendshipManager()            .searchFriends(searchParam: searchParam); //搜索好友的搜索条件    if (searchFriendsRes.code == 0) {      // 查询成功      searchFriendsRes.data?.forEach((element) {        element.relation; //好友类型 0:不是好友 1:对方在我的好友列表中 2:我在对方的好友列表中 3:互为好友        element.resultCode; //此条记录的查询结果错误码        element.resultInfo; //此条查询结果描述        //friendInfo为好友个人资料,如果不是好友,除了 userID 字段,其他字段都为空        element.friendInfo            ?.friendCustomInfo; //好友自定义字段 首先要在 控制台 (功能配置 -> 好友自定义字段) 配置好友自定义字段,然后再调用接口进行设置        element.friendInfo?.friendGroups; //好友所在分组列表        element.friendInfo?.friendRemark; //好友备注        element.friendInfo?.userID; //用户的id        element.friendInfo?.userProfile            ?.allowType; //用户的好友验证方式 0:允许所有人加我好友 1:不允许所有人加我好友 2:加我好友需我确认        element.friendInfo?.userProfile?.birthday; //用户生日        element.friendInfo?.userProfile?.customInfo; //用户的自定义状态        element.friendInfo?.userProfile?.faceUrl; //用户头像 url        element.friendInfo?.userProfile?.gender; //用户的性别 1:男 2:女        element.friendInfo?.userProfile?.level; //用户的等级        element.friendInfo?.userProfile?.nickName; //用户昵称        element.friendInfo?.userProfile?.role; //用户的角色        element.friendInfo?.userProfile?.selfSignature; //用户的签名        element.friendInfo?.userProfile?.userID; //用户 ID      });    }

交流与反馈

点此进入IM社群,享有专业工程师的支持,解决您的难题

对即时通讯IM解决方案有疑惑?想了解解决方案收费? 联系解决方案专家

腾讯云限时活动1折起,即将结束: 马上收藏

同尘科技为腾讯云授权服务中心,购买腾讯云享受折上折,更有现金返利:同意关联,立享优惠

阿里云解决方案也看看?: 点击对比阿里云的解决方案

- 0人点赞 -

发表点评 (0条)

not found

暂无评论,你要说点什么吗?