add recall boardcast and multicast message api
This commit is contained in:
@@ -44,6 +44,8 @@ public interface APIPath {
|
|||||||
String Msg_Delete = "/admin/message/delete";
|
String Msg_Delete = "/admin/message/delete";
|
||||||
String Msg_Broadcast = "/admin/message/broadcast";
|
String Msg_Broadcast = "/admin/message/broadcast";
|
||||||
String Msg_Multicast = "/admin/message/multicast";
|
String Msg_Multicast = "/admin/message/multicast";
|
||||||
|
String Msg_RecallBroadCast = "/admin/message/recall_broadcast";
|
||||||
|
String Msg_RecallMultiCast = "/admin/message/recall_multicast";
|
||||||
|
|
||||||
String Create_Group = "/admin/group/create";
|
String Create_Group = "/admin/group/create";
|
||||||
String Group_Dismiss = "/admin/group/del";
|
String Group_Dismiss = "/admin/group/del";
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Wildfire Chat package.
|
||||||
|
* (c) Heavyrain2012 <[email protected]>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package cn.wildfirechat.pojos;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RecallMultiCastMessageData {
|
||||||
|
public String operator;
|
||||||
|
public long messageUid;
|
||||||
|
public List<String> receivers;
|
||||||
|
}
|
||||||
@@ -573,6 +573,13 @@ public class Main {
|
|||||||
System.out.println("broad message failure");
|
System.out.println("broad message failure");
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
voidIMResult = MessageAdmin.recallBroadCastMessage("user1", resultBroadcastMessage.result.getMessageUid());
|
||||||
|
if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("Success");
|
||||||
|
} else {
|
||||||
|
System.out.println("failure");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> multicastReceivers = Arrays.asList("user2", "user3", "user4");
|
List<String> multicastReceivers = Arrays.asList("user2", "user3", "user4");
|
||||||
@@ -583,6 +590,13 @@ public class Main {
|
|||||||
System.out.println("multi message failure");
|
System.out.println("multi message failure");
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
voidIMResult = MessageAdmin.recallMultiCastMessage("user1", resultMulticastMessage.result.getMessageUid(), multicastReceivers);
|
||||||
|
if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("Success");
|
||||||
|
} else {
|
||||||
|
System.out.println("failure");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//***********************************************
|
//***********************************************
|
||||||
|
|||||||
@@ -41,19 +41,29 @@ public class MessageAdmin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 撤回群发或者广播的消息
|
* 撤回群发或者广播的消息
|
||||||
* @param target 目标用户
|
* @param operator 操作者
|
||||||
* @param messageUid 消息唯一ID
|
* @param messageUid 消息唯一ID
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static IMResult<Void> recallBroadcastOrMulticastMessage(String target, long messageUid) throws Exception {
|
public static IMResult<Void> recallBroadCastMessage(String operator, long messageUid) throws Exception {
|
||||||
String path = APIPath.Msg_Recall;
|
String path = APIPath.Msg_RecallBroadCast;
|
||||||
RecallMessageData messageData = new RecallMessageData();
|
RecallMessageData messageData = new RecallMessageData();
|
||||||
messageData.setOperator(target);
|
messageData.setOperator(operator);
|
||||||
messageData.setMessageUid(messageUid);
|
messageData.setMessageUid(messageUid);
|
||||||
return AdminHttpUtils.httpJsonPost(path, messageData, Void.class);
|
return AdminHttpUtils.httpJsonPost(path, messageData, Void.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IMResult<Void> recallMultiCastMessage(String operator, long messageUid, List<String> receivers) throws Exception {
|
||||||
|
String path = APIPath.Msg_RecallMultiCast;
|
||||||
|
RecallMultiCastMessageData messageData = new RecallMultiCastMessageData();
|
||||||
|
messageData.operator = operator;
|
||||||
|
messageData.messageUid = messageUid;
|
||||||
|
messageData.receivers = receivers;
|
||||||
|
|
||||||
|
return AdminHttpUtils.httpJsonPost(path, messageData, Void.class);
|
||||||
|
}
|
||||||
|
|
||||||
public static IMResult<BroadMessageResult> broadcastMessage(String sender, int line, MessagePayload payload) throws Exception {
|
public static IMResult<BroadMessageResult> broadcastMessage(String sender, int line, MessagePayload payload) throws Exception {
|
||||||
String path = APIPath.Msg_Broadcast;
|
String path = APIPath.Msg_Broadcast;
|
||||||
BroadMessageData messageData = new BroadMessageData();
|
BroadMessageData messageData = new BroadMessageData();
|
||||||
|
|||||||
Reference in New Issue
Block a user