添加获取所有用户的Server API

This commit is contained in:
heavyrian2012
2023-06-20 15:14:57 +08:00
parent 252204a760
commit c8ff39c2ab
10 changed files with 201 additions and 1 deletions
@@ -300,6 +300,20 @@ public class Main {
System.exit(-1);
}
int limit = 5;
for (int i = 0; i < 100; i++) {
IMResult<OutputGetUserList> getUserListIMResult = UserAdmin.getAllUsers(limit, i*limit);
if (getUserListIMResult != null && getUserListIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("getUserListIMResult success");
if(getUserListIMResult.getResult().userInfoList.size() < limit) {
break;
}
} else {
System.out.println("getUserListIMResult failure");
System.exit(-1);
}
}
if (commercialServer) {
IMResult<GetOnlineUserCountResult> getOnlineUserCountResultIMResult = UserAdmin.getOnlineUserCount();
if (getOnlineUserCountResultIMResult != null && getOnlineUserCountResultIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
@@ -24,6 +24,14 @@ public class UserAdmin {
return AdminHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class);
}
public static IMResult<OutputGetUserList> getAllUsers(int count, int offset) throws Exception {
String path = APIPath.User_Get_All;
InputGetUserList input = new InputGetUserList();
input.count = count;
input.offset = offset;
return AdminHttpUtils.httpJsonPost(path, input, OutputGetUserList.class);
}
public static IMResult<OutputCreateUser> createUser(InputOutputUserInfo user) throws Exception {
String path = APIPath.Create_User;
return AdminHttpUtils.httpJsonPost(path, user, OutputCreateUser.class);