diff --git a/common/src/main/java/cn/wildfirechat/common/APIPath.java b/common/src/main/java/cn/wildfirechat/common/APIPath.java index ed95c013..cd64000e 100644 --- a/common/src/main/java/cn/wildfirechat/common/APIPath.java +++ b/common/src/main/java/cn/wildfirechat/common/APIPath.java @@ -57,6 +57,8 @@ public interface APIPath { String Msg_Multicast = "/admin/message/multicast"; String Msg_RecallBroadCast = "/admin/message/recall_broadcast"; String Msg_RecallMultiCast = "/admin/message/recall_multicast"; + String Msg_ConvRead = "/admin/message/conv_read"; + String Msg_Delivery = "/admin/message/delivery"; String Create_Group = "/admin/group/create"; String Group_Dismiss = "/admin/group/del"; diff --git a/common/src/main/java/cn/wildfirechat/pojos/Conversation.java b/common/src/main/java/cn/wildfirechat/pojos/Conversation.java index 573a888e..5601d43b 100644 --- a/common/src/main/java/cn/wildfirechat/pojos/Conversation.java +++ b/common/src/main/java/cn/wildfirechat/pojos/Conversation.java @@ -13,6 +13,15 @@ public class Conversation { private String target; private int line; + public Conversation() { + } + + public Conversation(int type, String target, int line) { + this.type = type; + this.target = target; + this.line = line; + } + public int getType() { return type; } diff --git a/common/src/main/java/cn.wildfirechat.pojos/InputDestroyUser.java b/common/src/main/java/cn/wildfirechat/pojos/InputDestroyUser.java similarity index 100% rename from common/src/main/java/cn.wildfirechat.pojos/InputDestroyUser.java rename to common/src/main/java/cn/wildfirechat/pojos/InputDestroyUser.java diff --git a/common/src/main/java/cn/wildfirechat/pojos/InputGetConvReadTime.java b/common/src/main/java/cn/wildfirechat/pojos/InputGetConvReadTime.java new file mode 100755 index 00000000..356cdb12 --- /dev/null +++ b/common/src/main/java/cn/wildfirechat/pojos/InputGetConvReadTime.java @@ -0,0 +1,58 @@ +/* + * This file is part of the Wildfire Chat package. + * (c) Heavyrain2012 + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +package cn.wildfirechat.pojos; + +public class InputGetConvReadTime { + private String userId; + private int conversationType; + private String target; + private int line; + + public InputGetConvReadTime() { + } + + public InputGetConvReadTime(String userId, int conversationType, String target, int line) { + this.userId = userId; + this.conversationType = conversationType; + this.target = target; + this.line = line; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public int getConversationType() { + return conversationType; + } + + public void setConversationType(int conversationType) { + this.conversationType = conversationType; + } + + public String getTarget() { + return target; + } + + public void setTarget(String target) { + this.target = target; + } + + public int getLine() { + return line; + } + + public void setLine(int line) { + this.line = line; + } +} diff --git a/common/src/main/java/cn/wildfirechat/pojos/InputUserId.java b/common/src/main/java/cn/wildfirechat/pojos/InputUserId.java index 313ee80d..d361cb55 100755 --- a/common/src/main/java/cn/wildfirechat/pojos/InputUserId.java +++ b/common/src/main/java/cn/wildfirechat/pojos/InputUserId.java @@ -11,6 +11,13 @@ package cn.wildfirechat.pojos; public class InputUserId { private String userId; + public InputUserId() { + } + + public InputUserId(String userId) { + this.userId = userId; + } + public String getUserId() { return userId; } diff --git a/common/src/main/java/cn/wildfirechat/pojos/OutputTimestamp.java b/common/src/main/java/cn/wildfirechat/pojos/OutputTimestamp.java new file mode 100755 index 00000000..c65101da --- /dev/null +++ b/common/src/main/java/cn/wildfirechat/pojos/OutputTimestamp.java @@ -0,0 +1,28 @@ +/* + * This file is part of the Wildfire Chat package. + * (c) Heavyrain2012 + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +package cn.wildfirechat.pojos; + +public class OutputTimestamp { + private long timestamp; + + public OutputTimestamp() { + } + + public OutputTimestamp(long timestamp) { + this.timestamp = timestamp; + } + + public long getTimestamp() { + return timestamp; + } + + public void setTimestamp(long timestamp) { + this.timestamp = timestamp; + } +} diff --git a/sdk/src/main/java/cn/wildfirechat/sdk/Main.java b/sdk/src/main/java/cn/wildfirechat/sdk/Main.java index 14c2edc8..1ea6dad8 100644 --- a/sdk/src/main/java/cn/wildfirechat/sdk/Main.java +++ b/sdk/src/main/java/cn/wildfirechat/sdk/Main.java @@ -750,6 +750,20 @@ public class Main { } else { System.out.println("failure"); } + + IMResult timestampResult = MessageAdmin.getConversationReadTimestamp("57gqmws2k", new Conversation(0, "admin", 0)); + if(timestampResult != null && timestampResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { + System.out.println("Get conversation read time success"); + } else { + System.out.println("Get conversation read time failure"); + } + + timestampResult = MessageAdmin.getMessageDelivery("57gqmws2k"); + if(timestampResult != null && timestampResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { + System.out.println("Get message delivery success"); + } else { + System.out.println("Get message delivery failure"); + } } List multicastReceivers = Arrays.asList("user2", "user3", "user4"); diff --git a/sdk/src/main/java/cn/wildfirechat/sdk/MessageAdmin.java b/sdk/src/main/java/cn/wildfirechat/sdk/MessageAdmin.java index 6b27d9ef..d189cc0c 100644 --- a/sdk/src/main/java/cn/wildfirechat/sdk/MessageAdmin.java +++ b/sdk/src/main/java/cn/wildfirechat/sdk/MessageAdmin.java @@ -103,4 +103,16 @@ public class MessageAdmin { messageData.setPayload(payload); return AdminHttpUtils.httpJsonPost(path, messageData, MultiMessageResult.class); } + + public static IMResult getConversationReadTimestamp(String userId, Conversation conversation) throws Exception { + String path = APIPath.Msg_ConvRead; + InputGetConvReadTime input = new InputGetConvReadTime(userId, conversation.getType(), conversation.getTarget(), conversation.getLine()); + return AdminHttpUtils.httpJsonPost(path, input, OutputTimestamp.class); + } + + public static IMResult getMessageDelivery(String userId) throws Exception { + String path = APIPath.Msg_Delivery; + InputUserId input = new InputUserId(userId); + return AdminHttpUtils.httpJsonPost(path, input, OutputTimestamp.class); + } }