添加server api发送朋友圈的api
This commit is contained in:
@@ -61,6 +61,8 @@ public interface APIPath {
|
|||||||
|
|
||||||
String Handle_Friend_Send_Request = "/admin/friend/handle_send_request";
|
String Handle_Friend_Send_Request = "/admin/friend/handle_send_request";
|
||||||
|
|
||||||
|
String Admin_Moments_Post_Feed = "/admin/moments/feed/post";
|
||||||
|
|
||||||
String Msg_Send = "/admin/message/send";
|
String Msg_Send = "/admin/message/send";
|
||||||
String Msg_Publish = "/admin/message/publish";
|
String Msg_Publish = "/admin/message/publish";
|
||||||
String Msg_Recall = "/admin/message/recall";
|
String Msg_Recall = "/admin/message/recall";
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class ChannelServiceApi {
|
|||||||
public IMResult<SendMessageResult> sendMessage(int line, List<String> targets, MessagePayload payload) throws Exception {
|
public IMResult<SendMessageResult> sendMessage(int line, List<String> targets, MessagePayload payload) throws Exception {
|
||||||
String path = APIPath.Channel_Message_Send;
|
String path = APIPath.Channel_Message_Send;
|
||||||
SendChannelMessageData messageData = new SendChannelMessageData();
|
SendChannelMessageData messageData = new SendChannelMessageData();
|
||||||
messageData.setLine(0);
|
messageData.setLine(line);
|
||||||
messageData.setTargets(targets);
|
messageData.setTargets(targets);
|
||||||
messageData.setPayload(payload);
|
messageData.setPayload(payload);
|
||||||
return channelHttpUtils.httpJsonPost(path, messageData, SendMessageResult.class);
|
return channelHttpUtils.httpJsonPost(path, messageData, SendMessageResult.class);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ public class Main {
|
|||||||
private static boolean commercialServer = false;
|
private static boolean commercialServer = false;
|
||||||
private static boolean advanceVoip = false;
|
private static boolean advanceVoip = false;
|
||||||
private static boolean robotMomentsEnabled = false;
|
private static boolean robotMomentsEnabled = false;
|
||||||
|
private static boolean momentsEnabled = false;
|
||||||
//管理端口是8080
|
//管理端口是8080
|
||||||
private static String AdminUrl = "http://localhost:18080";
|
private static String AdminUrl = "http://localhost:18080";
|
||||||
private static String AdminSecret = "123456";
|
private static String AdminSecret = "123456";
|
||||||
@@ -82,6 +83,9 @@ public class Main {
|
|||||||
if(advanceVoip) {
|
if(advanceVoip) {
|
||||||
testConference();
|
testConference();
|
||||||
}
|
}
|
||||||
|
if (momentsEnabled) {
|
||||||
|
testMomentsApi();
|
||||||
|
}
|
||||||
|
|
||||||
System.out.println("Congratulation, all admin test case passed!!!!!!!");
|
System.out.println("Congratulation, all admin test case passed!!!!!!!");
|
||||||
}
|
}
|
||||||
@@ -2053,6 +2057,20 @@ public class Main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void testMomentsApi() throws Exception {
|
||||||
|
FeedPojo feedPojo = new FeedPojo();
|
||||||
|
feedPojo.sender = "73055b4105de4b70993b7258afbfc387";
|
||||||
|
feedPojo.type = 0;
|
||||||
|
feedPojo.text = "hello from admin";
|
||||||
|
IMResult<SendMessageResult> sendResult = MomentsAdmin.postFeeds(feedPojo);
|
||||||
|
if (sendResult != null && sendResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("send moments feed success");
|
||||||
|
} else {
|
||||||
|
System.out.println("send moments feed failure");
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//***********************************************
|
//***********************************************
|
||||||
//**** 物联网相关的API,仅专业版支持
|
//**** 物联网相关的API,仅专业版支持
|
||||||
//***********************************************
|
//***********************************************
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package cn.wildfirechat.sdk;
|
||||||
|
|
||||||
|
import cn.wildfirechat.common.APIPath;
|
||||||
|
import cn.wildfirechat.pojos.*;
|
||||||
|
import cn.wildfirechat.pojos.moments.FeedPojo;
|
||||||
|
import cn.wildfirechat.sdk.model.IMResult;
|
||||||
|
import cn.wildfirechat.sdk.utilities.AdminHttpUtils;
|
||||||
|
|
||||||
|
|
||||||
|
public class MomentsAdmin {
|
||||||
|
public static IMResult<SendMessageResult> postFeeds(FeedPojo feedPojo) throws Exception {
|
||||||
|
String path = APIPath.Admin_Moments_Post_Feed;
|
||||||
|
return AdminHttpUtils.httpJsonPost(path, feedPojo, SendMessageResult.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user