添加获取所有用户的Server API
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user