添加获取用户聊天室状态的API

This commit is contained in:
heavyrian2012
2023-11-17 09:06:00 +08:00
parent 63f0fc66ce
commit 724be0b273
7 changed files with 117 additions and 1 deletions
@@ -37,6 +37,12 @@ public class ChatroomAdmin {
return AdminHttpUtils.httpJsonPost(path, input, OutputStringList.class);
}
public static IMResult<OutputUserChatroom> getUserChatroom(String userId) throws Exception {
String path = APIPath.Chatroom_GetUserChatroom;
InputUserId input = new InputUserId(userId);
return AdminHttpUtils.httpJsonPost(path, input, OutputUserChatroom.class);
}
//仅专业版支持
//status:0,正常;1,禁言;2,禁止加入
public static IMResult<Void> setChatroomBlacklist(String chatroomId, String userId, int status) throws Exception {
@@ -974,6 +974,14 @@ public class Main {
System.exit(-1);
}
IMResult<OutputUserChatroom> userChatroomIMResult = ChatroomAdmin.getUserChatroom("hygqmws2k");
if(userChatroomIMResult != null && (userChatroomIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS || userChatroomIMResult.getErrorCode() == ErrorCode.ERROR_CODE_NOT_EXIST)) {
System.out.println("get user chatroom success");
} else {
System.out.println("get user chatroom failure");
System.exit(-1);
}
//下面仅专业版支持
if(commercialServer) {
//设置用户聊天室黑名单。0正常;1禁言;2禁止加入。