添加获取单条消息的接口

This commit is contained in:
heavyrian2012
2022-04-26 20:05:35 +08:00
parent 9d96fe927f
commit c44062855b
5 changed files with 101 additions and 15 deletions
+21 -14
View File
@@ -34,8 +34,8 @@ public class Main {
testAdmin();
//Robot和Channel都是使用的80端口,第三方可以创建或者为第三方创建,第三方可以使用robot或者channel与IM系统进行对接。
testRobot();
testChannel();
// testRobot();
// testChannel();
}
@@ -43,19 +43,19 @@ public class Main {
//初始化服务API
AdminConfig.initAdmin(AdminUrl, AdminSecret);
testUser();
testUserRelation();
testGroup();
testChatroom();
// testUser();
// testUserRelation();
// testGroup();
// testChatroom();
testMessage();
testGeneralApi();
testSensitiveApi();
if (commercialServer) {
testDevice();
}
if(advanceVoip) {
testConference();
}
// testGeneralApi();
// testSensitiveApi();
// if (commercialServer) {
// testDevice();
// }
// if(advanceVoip) {
// testConference();
// }
System.out.println("Congratulation, all admin test case passed!!!!!!!");
}
@@ -667,6 +667,13 @@ public class Main {
System.exit(-1);
}
IMResult<OutputMessageData> outputMessageDataIMResult = MessageAdmin.getMessage(resultSendMessage.result.getMessageUid());
if(outputMessageDataIMResult != null && outputMessageDataIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && outputMessageDataIMResult.getResult().getMessageId() == resultSendMessage.getResult().getMessageUid()) {
System.out.println("get message success");
} else {
System.out.println("get message failure");
System.exit(-1);
}
IMResult<Void> voidIMResult = MessageAdmin.recallMessage("user1", resultSendMessage.getResult().getMessageUid());
if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
@@ -48,7 +48,17 @@ public class MessageAdmin {
return AdminHttpUtils.httpJsonPost(path, updateMessageContentData, Void.class);
}
/**
* 获取单条消息。如果想要更多消息的读取,可以直接读取IM服务的数据库。
* @param messageUid
* @return
* @throws Exception
*/
public static IMResult<OutputMessageData> getMessage(long messageUid) throws Exception {
String path = APIPath.Msg_GetOne;
InputMessageUid inputMessageUid = new InputMessageUid(messageUid);
return AdminHttpUtils.httpJsonPost(path, inputMessageUid, OutputMessageData.class);
}
/**
* 撤回群发或者广播的消息