From 8322134e1870cbee3ef0b501aad806ba5e1dd2a6 Mon Sep 17 00:00:00 2001 From: heavyrian2012 Date: Tue, 3 Feb 2026 19:51:03 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=8C=E8=A7=A3=E5=86=B3=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BF=9D=E7=95=99=E4=BF=A1=E6=81=AF=E6=97=B6?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98=EF=BC=9B2=EF=BC=8Cserver?= =?UTF-8?q?=20api=E8=8E=B7=E5=8F=96=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=8F=AF=E4=BB=A5=E6=8C=87=E5=AE=9A=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=8C=85=E5=90=AB=E8=A2=AB=E5=88=A0=E9=99=A4=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/ThreadPoolExecutorWrapper.java | 3 +++ .../loServer/action/admin/GetUserAction.java | 2 +- .../persistence/MemoryMessagesStore.java | 2 +- .../cn/wildfirechat/pojos/InputGetUserInfo.java | 16 ++++++++++++++++ .../main/java/cn/wildfirechat/sdk/UserAdmin.java | 16 ++++++++++++++-- 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/broker/src/main/java/cn/wildfirechat/server/ThreadPoolExecutorWrapper.java b/broker/src/main/java/cn/wildfirechat/server/ThreadPoolExecutorWrapper.java index cffec2bd..24ff3e73 100644 --- a/broker/src/main/java/cn/wildfirechat/server/ThreadPoolExecutorWrapper.java +++ b/broker/src/main/java/cn/wildfirechat/server/ThreadPoolExecutorWrapper.java @@ -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); diff --git a/broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetUserAction.java b/broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetUserAction.java index 700dfc5c..4a5ab898 100755 --- a/broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetUserAction.java +++ b/broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetUserAction.java @@ -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)); diff --git a/broker/src/main/java/io/moquette/persistence/MemoryMessagesStore.java b/broker/src/main/java/io/moquette/persistence/MemoryMessagesStore.java index 91cbc836..0d0d9c81 100755 --- a/broker/src/main/java/io/moquette/persistence/MemoryMessagesStore.java +++ b/broker/src/main/java/io/moquette/persistence/MemoryMessagesStore.java @@ -3176,7 +3176,7 @@ public class MemoryMessagesStore implements IMessagesStore { IMap 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) { diff --git a/common/src/main/java/cn/wildfirechat/pojos/InputGetUserInfo.java b/common/src/main/java/cn/wildfirechat/pojos/InputGetUserInfo.java index abf9f178..cb27c5d5 100755 --- a/common/src/main/java/cn/wildfirechat/pojos/InputGetUserInfo.java +++ b/common/src/main/java/cn/wildfirechat/pojos/InputGetUserInfo.java @@ -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; + } } diff --git a/sdk/src/main/java/cn/wildfirechat/sdk/UserAdmin.java b/sdk/src/main/java/cn/wildfirechat/sdk/UserAdmin.java index d8d918c5..620bc889 100644 --- a/sdk/src/main/java/cn/wildfirechat/sdk/UserAdmin.java +++ b/sdk/src/main/java/cn/wildfirechat/sdk/UserAdmin.java @@ -9,18 +9,30 @@ import java.util.List; public class UserAdmin { public static IMResult getUserByName(String name) throws Exception { + return getUserByName(name, false); + } + + public static IMResult 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 getUserByUserId(String userId) throws Exception { + return getUserByUserId(userId, false); + } + + public static IMResult 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 getUserByMobile(String mobile) throws Exception { + return getUserByMobile(mobile, false); + } + + public static IMResult 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);