1,解决删除用户保留信息时错误问题;2,server api获取用户信息时,可以指定获取包含被删除用户。
This commit is contained in:
@@ -35,6 +35,9 @@ public class ThreadPoolExecutorWrapper {
|
||||
executor.execute(() -> {
|
||||
try {
|
||||
task.run();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOG.info("execute error = {}", e.toString());
|
||||
} finally {
|
||||
int endCount = runCounter.decrementAndGet();
|
||||
LOG.debug("Finish task and current task count {} use time {}", endCount, System.currentTimeMillis()-startTime);
|
||||
|
||||
@@ -49,7 +49,7 @@ public class GetUserAction extends AdminAction {
|
||||
}
|
||||
|
||||
RestResult result;
|
||||
if (user == null || user.getDeleted() > 0) {
|
||||
if (user == null || (user.getDeleted() > 0 && !inputUserId.isIncludeDeleted())) {
|
||||
result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST);
|
||||
} else {
|
||||
result = RestResult.ok(InputOutputUserInfo.fromPbUser(user));
|
||||
|
||||
@@ -3176,7 +3176,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
IMap<String, WFCMessage.User> mUserMap = hzInstance.getMap(USERS);
|
||||
WFCMessage.User us = mUserMap.get(userId);
|
||||
if (us != null) {
|
||||
WFCMessage.User.Builder builder = WFCMessage.User.newBuilder().setUpdateDt(System.currentTimeMillis()).setDeleted(1);
|
||||
WFCMessage.User.Builder builder = us.toBuilder().setUpdateDt(System.currentTimeMillis()).setDeleted(1);
|
||||
|
||||
if(keepFullInfoWhenDestroyUser) {
|
||||
if(!keepMobileWhenDestroyUser) {
|
||||
|
||||
@@ -12,6 +12,7 @@ public class InputGetUserInfo {
|
||||
private String userId;
|
||||
private String name;
|
||||
private String mobile;
|
||||
private boolean includeDeleted;
|
||||
|
||||
public InputGetUserInfo() {
|
||||
}
|
||||
@@ -22,6 +23,13 @@ public class InputGetUserInfo {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
public InputGetUserInfo(String userId, String name, String mobile, boolean includeDeleted) {
|
||||
this.userId = userId;
|
||||
this.name = name;
|
||||
this.mobile = mobile;
|
||||
this.includeDeleted = includeDeleted;
|
||||
}
|
||||
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
@@ -45,4 +53,12 @@ public class InputGetUserInfo {
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean isIncludeDeleted() {
|
||||
return includeDeleted;
|
||||
}
|
||||
|
||||
public void setIncludeDeleted(boolean includeDeleted) {
|
||||
this.includeDeleted = includeDeleted;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,18 +9,30 @@ import java.util.List;
|
||||
|
||||
public class UserAdmin {
|
||||
public static IMResult<InputOutputUserInfo> getUserByName(String name) throws Exception {
|
||||
return getUserByName(name, false);
|
||||
}
|
||||
|
||||
public static IMResult<InputOutputUserInfo> getUserByName(String name, boolean includeDeleted) throws Exception {
|
||||
String path = APIPath.User_Get_Info;
|
||||
InputGetUserInfo getUserInfo = new InputGetUserInfo(null, name, null);
|
||||
InputGetUserInfo getUserInfo = new InputGetUserInfo(null, name, null, includeDeleted);
|
||||
return AdminHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class);
|
||||
}
|
||||
|
||||
public static IMResult<InputOutputUserInfo> getUserByUserId(String userId) throws Exception {
|
||||
return getUserByUserId(userId, false);
|
||||
}
|
||||
|
||||
public static IMResult<InputOutputUserInfo> getUserByUserId(String userId, boolean includeDeleted) throws Exception {
|
||||
String path = APIPath.User_Get_Info;
|
||||
InputGetUserInfo getUserInfo = new InputGetUserInfo(userId, null, null);
|
||||
InputGetUserInfo getUserInfo = new InputGetUserInfo(userId, null, null, includeDeleted);
|
||||
return AdminHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class);
|
||||
}
|
||||
|
||||
public static IMResult<InputOutputUserInfo> getUserByMobile(String mobile) throws Exception {
|
||||
return getUserByMobile(mobile, false);
|
||||
}
|
||||
|
||||
public static IMResult<InputOutputUserInfo> getUserByMobile(String mobile, boolean includeDeleted) throws Exception {
|
||||
String path = APIPath.User_Get_Info;
|
||||
InputGetUserInfo getUserInfo = new InputGetUserInfo(null, null, mobile);
|
||||
return AdminHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class);
|
||||
|
||||
Reference in New Issue
Block a user