Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b95a6b7785 | ||
|
|
5acb3044ac | ||
|
|
ae084063f4 | ||
|
|
cb3a82559d | ||
|
|
9191204bb0 | ||
|
|
6587a88ca9 | ||
|
|
86c1a2e140 | ||
|
|
83e9679339 | ||
|
|
dafb0cd4d9 | ||
|
|
cbcc8310c4 | ||
|
|
ade58efc11 | ||
|
|
d45da9674e | ||
|
|
f603a677ea | ||
|
|
03894aea9a | ||
|
|
8635153e59 | ||
|
|
3d98d17b0d | ||
|
|
0549bc502f | ||
|
|
1b8cf3e5f9 |
@@ -95,6 +95,9 @@ message.disable_stranger_chat false
|
|||||||
##当禁止陌生人聊天时,允许聊天的用户id,比如管理员或者文件传输助手等。用户id以英文逗号分割。
|
##当禁止陌生人聊天时,允许聊天的用户id,比如管理员或者文件传输助手等。用户id以英文逗号分割。
|
||||||
message.allow_stranger_chat_list admin,FireRobot,wfc_file_transfer
|
message.allow_stranger_chat_list admin,FireRobot,wfc_file_transfer
|
||||||
|
|
||||||
|
##当禁止陌生人聊天时,允许聊天的线路。
|
||||||
|
#message.allow_stranger_line 100,101
|
||||||
|
|
||||||
##黑名单策略,0 发送失败,返回被拉黑的错误码;1 发送成功但消息被服务器直接丢弃
|
##黑名单策略,0 发送失败,返回被拉黑的错误码;1 发送成功但消息被服务器直接丢弃
|
||||||
message.blacklist.strategy 0
|
message.blacklist.strategy 0
|
||||||
|
|
||||||
@@ -327,7 +330,7 @@ server.mobile_default_silent_when_pc_online true
|
|||||||
|
|
||||||
## 客户端是否支持kickoff事件。当客户端被其他端登录踢出时,如果此开关为false时,客户端协议栈上报secret_mismatch。如果此开关为ture时,客户端协议栈上报kicked_off。
|
## 客户端是否支持kickoff事件。当客户端被其他端登录踢出时,如果此开关为false时,客户端协议栈上报secret_mismatch。如果此开关为ture时,客户端协议栈上报kicked_off。
|
||||||
## 客户端被踢时上报kicked_off是在2021.9.15之后才加上的。如果客户端协议栈全部为此日期之后的版本才可以打开此开关。
|
## 客户端被踢时上报kicked_off是在2021.9.15之后才加上的。如果客户端协议栈全部为此日期之后的版本才可以打开此开关。
|
||||||
server.client_support_kickoff_event false
|
server.client_support_kickoff_event true
|
||||||
|
|
||||||
#*********************************************************************
|
#*********************************************************************
|
||||||
# Push server configuration
|
# Push server configuration
|
||||||
@@ -418,7 +421,10 @@ push.harmony.server.address http://localhost:8085/harmony/push
|
|||||||
## 内置文本敏感词过滤处理方法,当命中敏感词后,消息会被记录到t_sensitive_messages表中,然后根据type类型做不同的处理,处理方式如下:
|
## 内置文本敏感词过滤处理方法,当命中敏感词后,消息会被记录到t_sensitive_messages表中,然后根据type类型做不同的处理,处理方式如下:
|
||||||
## 0 发送失败;1 发送成功但消息被服务器直接丢弃;2 命中的敏感词被替换成***然后正常发送;3 正常发送。
|
## 0 发送失败;1 发送成功但消息被服务器直接丢弃;2 命中的敏感词被替换成***然后正常发送;3 正常发送。
|
||||||
## 如果开启 message.sensitive.forward.url 配置,命中敏感词的消息还会被回调到这个地址
|
## 如果开启 message.sensitive.forward.url 配置,命中敏感词的消息还会被回调到这个地址
|
||||||
sensitive.filter.type 0
|
sensitive.filter.type 2
|
||||||
|
|
||||||
|
## 敏感词添加或者删除有2种方式,一种是通过Server API进行,这种方式会立即生效。另外一种方法是修改数据库,直接中数据库的t_sensitive_word表中处理
|
||||||
|
## 修改数据库的方法不会立即生效,IM服务会2个小时重新加载一次敏感词。所以如果直接修改敏感词表,需要等2个小时,或者重启才能生效。
|
||||||
|
|
||||||
## 如果内置敏感词库无法满足您的需求,可以开发部署独立敏感词审核服务。配置如下地址和消息类型,IM服务会把指定消息类型的消息回调到指定地址,内置的敏感词审核和敏感词转发功能就不再起作用了。
|
## 如果内置敏感词库无法满足您的需求,可以开发部署独立敏感词审核服务。配置如下地址和消息类型,IM服务会把指定消息类型的消息回调到指定地址,内置的敏感词审核和敏感词转发功能就不再起作用了。
|
||||||
## 审核服务返回状态码200表示继续发送,如果需要替换内容,返回状态码200并且内容为替换后的内容。返回403表示不允许发送。其它错误继续发送。
|
## 审核服务返回状态码200表示继续发送,如果需要替换内容,返回状态码200并且内容为替换后的内容。返回403表示不允许发送。其它错误继续发送。
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ server {
|
|||||||
root html;
|
root html;
|
||||||
index index.html index.htm index.php;
|
index index.html index.htm index.php;
|
||||||
|
|
||||||
|
#同步服务设置
|
||||||
location /route {
|
location /route {
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-real-ip $remote_addr;
|
proxy_set_header X-real-ip $remote_addr;
|
||||||
@@ -16,7 +17,7 @@ server {
|
|||||||
proxy_pass http://imserver;
|
proxy_pass http://imserver;
|
||||||
}
|
}
|
||||||
|
|
||||||
#社区版需要启用下面一段,专业版不能用
|
#客户端短连接业务
|
||||||
location /im {
|
location /im {
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-real-ip $remote_addr;
|
proxy_set_header X-real-ip $remote_addr;
|
||||||
@@ -24,14 +25,21 @@ server {
|
|||||||
proxy_pass http://imserver;
|
proxy_pass http://imserver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#版本检查/api/version,可以删掉
|
||||||
location /api {
|
location /api {
|
||||||
proxy_pass http://imserver;
|
proxy_pass http://imserver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#内置文件上传和下载
|
||||||
location /fs {
|
location /fs {
|
||||||
|
client_max_body_size 200M;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-real-ip $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_pass http://imserver;
|
proxy_pass http://imserver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#机器人API
|
||||||
location /robot {
|
location /robot {
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-real-ip $remote_addr;
|
proxy_set_header X-real-ip $remote_addr;
|
||||||
@@ -39,6 +47,7 @@ server {
|
|||||||
proxy_pass http://imserver;
|
proxy_pass http://imserver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#频道API
|
||||||
location /channel {
|
location /channel {
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-real-ip $remote_addr;
|
proxy_set_header X-real-ip $remote_addr;
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<relativePath>../</relativePath>
|
<relativePath>../</relativePath>
|
||||||
<artifactId>wildfirechat-parent</artifactId>
|
<artifactId>wildfirechat-parent</artifactId>
|
||||||
<groupId>cn.wildfirechat</groupId>
|
<groupId>cn.wildfirechat</groupId>
|
||||||
<version>1.3.1</version>
|
<version>1.3.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>moquette-broker</artifactId>
|
<artifactId>moquette-broker</artifactId>
|
||||||
|
|||||||
+61
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.xiaoleilu.loServer.action.admin;
|
||||||
|
|
||||||
|
import cn.wildfirechat.common.APIPath;
|
||||||
|
import cn.wildfirechat.common.ErrorCode;
|
||||||
|
import cn.wildfirechat.pojos.*;
|
||||||
|
import cn.wildfirechat.proto.WFCMessage;
|
||||||
|
import com.xiaoleilu.loServer.RestResult;
|
||||||
|
import com.xiaoleilu.loServer.annotation.HttpMethod;
|
||||||
|
import com.xiaoleilu.loServer.annotation.Route;
|
||||||
|
import com.xiaoleilu.loServer.handler.Request;
|
||||||
|
import com.xiaoleilu.loServer.handler.Response;
|
||||||
|
import io.netty.handler.codec.http.FullHttpRequest;
|
||||||
|
import io.netty.handler.codec.http.HttpResponseStatus;
|
||||||
|
import io.netty.util.internal.StringUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Route(APIPath.User_Batch_Get_Infos)
|
||||||
|
@HttpMethod("POST")
|
||||||
|
public class GetBatchUserAction extends AdminAction {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTransactionAction() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean action(Request request, Response response) {
|
||||||
|
if (request.getNettyRequest() instanceof FullHttpRequest) {
|
||||||
|
InputStringList inputUserId = getRequestBody(request.getNettyRequest(), InputStringList.class);
|
||||||
|
if (inputUserId != null && inputUserId.getList() != null && !inputUserId.getList().isEmpty()) {
|
||||||
|
|
||||||
|
OutputUserInfoList res = new OutputUserInfoList();
|
||||||
|
res.userInfos = new ArrayList<>();
|
||||||
|
for (String userId : inputUserId.getList()) {
|
||||||
|
WFCMessage.User user = messagesStore.getUserInfo(userId);
|
||||||
|
if(user == null || StringUtil.isNullOrEmpty(user.getName())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
InputOutputUserInfo inputOutputUserInfo = InputOutputUserInfo.fromPbUser(user);
|
||||||
|
res.userInfos.add(inputOutputUserInfo);
|
||||||
|
}
|
||||||
|
RestResult result = RestResult.ok(res);
|
||||||
|
setResponseContent(result, response);
|
||||||
|
} else {
|
||||||
|
setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -152,6 +152,7 @@ public final class BrokerConstants {
|
|||||||
|
|
||||||
public static final String MESSAGE_Disable_Stranger_Chat = "message.disable_stranger_chat";
|
public static final String MESSAGE_Disable_Stranger_Chat = "message.disable_stranger_chat";
|
||||||
public static final String MESSAGE_Allow_Stranger_Chat_List = "message.allow_stranger_chat_list";
|
public static final String MESSAGE_Allow_Stranger_Chat_List = "message.allow_stranger_chat_list";
|
||||||
|
public static final String MESSAGE_Allow_Stranger_Line = "message.allow_stranger_line";
|
||||||
|
|
||||||
public static final String MESSAGE_Blacklist_Strategy = "message.blacklist.strategy";
|
public static final String MESSAGE_Blacklist_Strategy = "message.blacklist.strategy";
|
||||||
public static final String MESSAGE_Blacklist_Allow_Send = "message.blacklist.allow_send_to_black";
|
public static final String MESSAGE_Blacklist_Allow_Send = "message.blacklist.allow_send_to_black";
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
|
|||||||
|
|
||||||
if (message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Private) {
|
if (message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Private) {
|
||||||
if(!m_messagesStore.getBlackListExceptionTypes().contains(message.getContent().getType())) {
|
if(!m_messagesStore.getBlackListExceptionTypes().contains(message.getContent().getType())) {
|
||||||
errorCode = m_messagesStore.isAllowUserMessage(message.getConversation().getTarget(), fromUser);
|
errorCode = m_messagesStore.isAllowUserMessage(message.getConversation().getTarget(), fromUser, message.getConversation().getLine());
|
||||||
if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) {
|
if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
if (errorCode == ErrorCode.ERROR_CODE_IN_BLACK_LIST && mBlacklistStrategy != ProtoConstants.BlacklistStrategy.Message_Reject) {
|
if (errorCode == ErrorCode.ERROR_CODE_IN_BLACK_LIST && mBlacklistStrategy != ProtoConstants.BlacklistStrategy.Message_Reject) {
|
||||||
ignoreMsg = true;
|
ignoreMsg = true;
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
private boolean mMobileDefaultSilentWhenPCOnline = true;
|
private boolean mMobileDefaultSilentWhenPCOnline = true;
|
||||||
private boolean mDisableStrangerChat = false;
|
private boolean mDisableStrangerChat = false;
|
||||||
private Set<String> mAllowStrangerChatSet = new HashSet<>();
|
private Set<String> mAllowStrangerChatSet = new HashSet<>();
|
||||||
|
private Set<Integer> mAllowStrangerLineSet = new HashSet<>();
|
||||||
private boolean mDisableStrangerAddGroup = false;
|
private boolean mDisableStrangerAddGroup = false;
|
||||||
|
|
||||||
private boolean mIDUseUUID = true;
|
private boolean mIDUseUUID = true;
|
||||||
@@ -265,6 +266,18 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String allowStrangerList = m_Server.getConfig().getProperty(BrokerConstants.MESSAGE_Allow_Stranger_Line);
|
||||||
|
if(!StringUtil.isNullOrEmptyAfterTrim(allowStrangerList)) {
|
||||||
|
allowStrangerList = allowStrangerList.replace(",", ",");
|
||||||
|
for (String s : allowStrangerList.split(",")) {
|
||||||
|
mAllowStrangerLineSet.add(Integer.parseInt(s.trim()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String forcePushTypes = m_Server.getConfig().getProperty(BrokerConstants.MESSAGE_Force_Push_Types);
|
String forcePushTypes = m_Server.getConfig().getProperty(BrokerConstants.MESSAGE_Force_Push_Types);
|
||||||
if(!StringUtil.isNullOrEmptyAfterTrim(forcePushTypes)) {
|
if(!StringUtil.isNullOrEmptyAfterTrim(forcePushTypes)) {
|
||||||
@@ -733,7 +746,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
}
|
}
|
||||||
pullType = ProtoConstants.PullType.Pull_Normal;
|
pullType = ProtoConstants.PullType.Pull_Normal;
|
||||||
} else if (type == ProtoConstants.ConversationType.ConversationType_ChatRoom) {
|
} else if (type == ProtoConstants.ConversationType.ConversationType_ChatRoom) {
|
||||||
boolean isDirect = !StringUtil.isNullOrEmpty(message.getToUser());
|
boolean isDirect = !StringUtil.isNullOrEmpty(message.getToUser()) || !message.getToList().isEmpty();
|
||||||
Collection<UserClientEntry> entries = getChatroomMembers(message.getConversation().getTarget());
|
Collection<UserClientEntry> entries = getChatroomMembers(message.getConversation().getTarget());
|
||||||
for (UserClientEntry entry : entries) {
|
for (UserClientEntry entry : entries) {
|
||||||
if (isDirect) {
|
if (isDirect) {
|
||||||
@@ -741,6 +754,9 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
notifyReceivers.add(message.getToUser());
|
notifyReceivers.add(message.getToUser());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (message.getToList().contains(entry.userId)) {
|
||||||
|
notifyReceivers.add(entry.userId);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
notifyReceivers.add(entry.userId);
|
notifyReceivers.add(entry.userId);
|
||||||
}
|
}
|
||||||
@@ -2250,15 +2266,29 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//check the new owner is in member list? is that necessary?
|
//check the new owner is in member list? is that necessary?
|
||||||
long updateDt = System.currentTimeMillis();
|
|
||||||
groupInfo = groupInfo.toBuilder().setOwner(newOwner).setUpdateDt(updateDt).setMemberUpdateDt(updateDt).build();
|
|
||||||
mIMap.set(groupId, groupInfo);
|
|
||||||
|
|
||||||
MultiMap<String, WFCMessage.GroupMember> groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS);
|
MultiMap<String, WFCMessage.GroupMember> groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS);
|
||||||
Collection<WFCMessage.GroupMember> members = groupMembers.get(groupId);
|
Collection<WFCMessage.GroupMember> members = groupMembers.get(groupId);
|
||||||
if (members == null || members.size() == 0) {
|
if (members == null || members.size() == 0) {
|
||||||
members = loadGroupMemberFromDB(hzInstance, groupId);
|
members = loadGroupMemberFromDB(hzInstance, groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isNewOwnerInGroup = false;
|
||||||
|
for (WFCMessage.GroupMember member : members) {
|
||||||
|
if (member.getMemberId().equals(newOwner)) {
|
||||||
|
if(member.getType() != GroupMemberType_Removed) {
|
||||||
|
isNewOwnerInGroup = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!isNewOwnerInGroup) {
|
||||||
|
return ErrorCode.ERROR_CODE_NOT_IN_GROUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
long updateDt = System.currentTimeMillis();
|
||||||
|
groupInfo = groupInfo.toBuilder().setOwner(newOwner).setUpdateDt(updateDt).setMemberUpdateDt(updateDt).build();
|
||||||
|
mIMap.set(groupId, groupInfo);
|
||||||
|
|
||||||
int modifyMemeberCount = 0;
|
int modifyMemeberCount = 0;
|
||||||
for (WFCMessage.GroupMember member : members) {
|
for (WFCMessage.GroupMember member : members) {
|
||||||
if (modifyMemeberCount == 2) {
|
if (modifyMemeberCount == 2) {
|
||||||
@@ -3193,7 +3223,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ErrorCode isAllowUserMessage(String targetUser, String fromUser) {
|
public ErrorCode isAllowUserMessage(String targetUser, String fromUser, int line) {
|
||||||
HazelcastInstance hzInstance = m_Server.getHazelcastInstance();
|
HazelcastInstance hzInstance = m_Server.getHazelcastInstance();
|
||||||
MultiMap<String, FriendData> friendsMap = hzInstance.getMultiMap(USER_FRIENDS);
|
MultiMap<String, FriendData> friendsMap = hzInstance.getMultiMap(USER_FRIENDS);
|
||||||
|
|
||||||
@@ -3220,7 +3250,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
|
|
||||||
if (mDisableStrangerChat) {
|
if (mDisableStrangerChat) {
|
||||||
//在禁止私聊时,是否是允许私聊的用户id
|
//在禁止私聊时,是否是允许私聊的用户id
|
||||||
if(mAllowStrangerChatSet.contains(targetUser) || mAllowStrangerChatSet.contains(fromUser)) {
|
if(mAllowStrangerChatSet.contains(targetUser) || mAllowStrangerChatSet.contains(fromUser) || mAllowStrangerLineSet.contains(line)) {
|
||||||
return ErrorCode.ERROR_CODE_SUCCESS;
|
return ErrorCode.ERROR_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public class Server {
|
|||||||
Runtime.getRuntime().addShutdownHook(new Thread(instance::stopServer));
|
Runtime.getRuntime().addShutdownHook(new Thread(instance::stopServer));
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread(httpServer::shutdown));
|
Runtime.getRuntime().addShutdownHook(new Thread(httpServer::shutdown));
|
||||||
|
|
||||||
System.out.println("Wildfire IM server start success...");
|
System.out.println("Wildfire IM server start success.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ public interface IMessagesStore {
|
|||||||
ErrorCode blackUserRequest(String fromUser, String targetUserId, int status, long[] head);
|
ErrorCode blackUserRequest(String fromUser, String targetUserId, int status, long[] head);
|
||||||
FriendData getFriendData(String fromUser, String targetUserId);
|
FriendData getFriendData(String fromUser, String targetUserId);
|
||||||
ErrorCode SyncFriendRequestUnread(String userId, long unreadDt, long[] head);
|
ErrorCode SyncFriendRequestUnread(String userId, long unreadDt, long[] head);
|
||||||
ErrorCode isAllowUserMessage(String fromUser, String userId);
|
ErrorCode isAllowUserMessage(String fromUser, String userId, int line);
|
||||||
ErrorCode isBlacked(String fromUser, String userId);
|
ErrorCode isBlacked(String fromUser, String userId);
|
||||||
ErrorCode setFriendAliasRequest(String fromUser, String targetUserId, String alias, long[] head);
|
ErrorCode setFriendAliasRequest(String fromUser, String targetUserId, String alias, long[] head);
|
||||||
ErrorCode setFriendExtraRequest(String fromUser, String targetUserId, String extra, long[] head);
|
ErrorCode setFriendExtraRequest(String fromUser, String targetUserId, String extra, long[] head);
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>wildfirechat-parent</artifactId>
|
<artifactId>wildfirechat-parent</artifactId>
|
||||||
<groupId>cn.wildfirechat</groupId>
|
<groupId>cn.wildfirechat</groupId>
|
||||||
<version>1.3.1</version>
|
<version>1.3.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -157,5 +157,17 @@ public interface APIPath {
|
|||||||
String Robot_Group_Transfer = "/robot/group/transfer";
|
String Robot_Group_Transfer = "/robot/group/transfer";
|
||||||
String Robot_Group_Set_Manager = "/robot/group/manager/set";
|
String Robot_Group_Set_Manager = "/robot/group/manager/set";
|
||||||
|
|
||||||
|
String Robot_Moments_Post_Feed = "/robot/moments/feed/post";
|
||||||
|
String Robot_Moments_Pull_Feeds = "/robot/moments/feed/pull";
|
||||||
|
String Robot_Moments_Update_Feed = "/robot/moments/feed/update";
|
||||||
|
String Robot_Moments_Post_Comment = "/robot/moments/comment/post";
|
||||||
|
String Robot_Moments_Pull_Comment = "/robot/moments/comment/pull";
|
||||||
|
String Robot_Moments_Fetch_Feed = "/robot/moments/feed/pull_one";
|
||||||
|
String Robot_Moments_Fetch_Profiles = "/robot/moments/profiles/pull";
|
||||||
|
String Robot_Moments_Recall_Comment = "/robot/moments/comment/recall";
|
||||||
|
String Robot_Moments_Recall_Feed = "/robot/moments/feed/recall";
|
||||||
|
String Robot_Moments_Update_Profiles_List_Value = "/robot/moments/profiles/list/push";
|
||||||
|
String Robot_Moments_Update_Profiles_Value = "/robot/moments/profiles/value/push";
|
||||||
|
|
||||||
String Robot_Conference_Request = "/robot/conference/request";
|
String Robot_Conference_Request = "/robot/conference/request";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package cn.wildfirechat.pojos;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class InputStringList {
|
||||||
|
private List<String> list;
|
||||||
|
|
||||||
|
public InputStringList() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public InputStringList(List<String> list) {
|
||||||
|
this.list = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getList() {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setList(List<String> list) {
|
||||||
|
this.list = list;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package cn.wildfirechat.pojos.moments;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CommentMsgPojo {
|
||||||
|
//commentId;
|
||||||
|
public long commentId;
|
||||||
|
|
||||||
|
//sender;
|
||||||
|
public String sender;
|
||||||
|
|
||||||
|
//timestamp
|
||||||
|
public long serverTime;
|
||||||
|
|
||||||
|
//feedId
|
||||||
|
public long feedId;
|
||||||
|
|
||||||
|
//type
|
||||||
|
public int type;
|
||||||
|
|
||||||
|
//content
|
||||||
|
public String text;
|
||||||
|
|
||||||
|
//to replyTo
|
||||||
|
public String replyTo;
|
||||||
|
|
||||||
|
//extra
|
||||||
|
public String extra;
|
||||||
|
|
||||||
|
public int ftype;
|
||||||
|
|
||||||
|
public String fcontent;
|
||||||
|
|
||||||
|
public String fsender;
|
||||||
|
|
||||||
|
public List<MediaEntry> fmedias;
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package cn.wildfirechat.pojos.moments;
|
||||||
|
|
||||||
|
public class CommentPojo {
|
||||||
|
//commentId;
|
||||||
|
public long commentId;
|
||||||
|
|
||||||
|
//replyId;
|
||||||
|
public long replyId;
|
||||||
|
|
||||||
|
//sender;
|
||||||
|
public String sender;
|
||||||
|
|
||||||
|
//timestamp
|
||||||
|
public long timestamp;
|
||||||
|
|
||||||
|
//feedId
|
||||||
|
public long feedId;
|
||||||
|
|
||||||
|
//type
|
||||||
|
public int type;
|
||||||
|
|
||||||
|
//content
|
||||||
|
public String text;
|
||||||
|
|
||||||
|
//to replyTo
|
||||||
|
public String replyTo;
|
||||||
|
|
||||||
|
//extra
|
||||||
|
public String extra;
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package cn.wildfirechat.pojos.moments;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class FeedPojo {
|
||||||
|
//feedid
|
||||||
|
public long feedId;
|
||||||
|
|
||||||
|
//sender
|
||||||
|
public String sender;
|
||||||
|
|
||||||
|
//timestamp
|
||||||
|
public long timestamp;
|
||||||
|
|
||||||
|
//type
|
||||||
|
public int type;
|
||||||
|
|
||||||
|
//content
|
||||||
|
public String text;
|
||||||
|
|
||||||
|
//media urls
|
||||||
|
public List<MediaEntry> medias;
|
||||||
|
|
||||||
|
//to users
|
||||||
|
public List<String> to;
|
||||||
|
|
||||||
|
//excloud users
|
||||||
|
public List<String> ex;
|
||||||
|
|
||||||
|
//mentioned users
|
||||||
|
public List<String> mu;
|
||||||
|
|
||||||
|
//extra
|
||||||
|
public String extra;
|
||||||
|
|
||||||
|
public List<CommentPojo> comments;
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package cn.wildfirechat.pojos.moments;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class FeedsPojo {
|
||||||
|
public List<FeedPojo> feeds;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package cn.wildfirechat.pojos.moments;
|
||||||
|
|
||||||
|
public class IdPojo {
|
||||||
|
//feedid
|
||||||
|
public long id;
|
||||||
|
|
||||||
|
//feedid
|
||||||
|
public long id2;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package cn.wildfirechat.pojos.moments;
|
||||||
|
|
||||||
|
public class MediaEntry {
|
||||||
|
public String m;
|
||||||
|
public String t;
|
||||||
|
public int w;
|
||||||
|
public int h;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cn.wildfirechat.pojos.moments;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MomentProfilePojo {
|
||||||
|
public String bgUrl;
|
||||||
|
public List<String> blackList;
|
||||||
|
public List<String> blockList;
|
||||||
|
//stranger visiable count
|
||||||
|
public int svc;
|
||||||
|
public int visiableScope;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package cn.wildfirechat.pojos.moments;
|
||||||
|
|
||||||
|
public class PostFeedResult {
|
||||||
|
public long id;
|
||||||
|
public long timestamp;
|
||||||
|
|
||||||
|
public PostFeedResult(long id, long timestamp) {
|
||||||
|
this.id = id;
|
||||||
|
this.timestamp = timestamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package cn.wildfirechat.pojos.moments;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PullCommentsRequestPojo {
|
||||||
|
public static class IdPair {
|
||||||
|
public long fid;
|
||||||
|
public long cid;
|
||||||
|
}
|
||||||
|
public List<IdPair> ids;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package cn.wildfirechat.pojos.moments;
|
||||||
|
|
||||||
|
public class PullFeedRequestPojo {
|
||||||
|
//feedid
|
||||||
|
public long feedId;
|
||||||
|
public int count;
|
||||||
|
public String user;
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package cn.wildfirechat.pojos.moments;
|
||||||
|
|
||||||
|
public class PullOneFeedRequestPojo {
|
||||||
|
public long feedId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package cn.wildfirechat.pojos.moments;
|
||||||
|
|
||||||
|
public class PullProfileRequestPojo {
|
||||||
|
//userId
|
||||||
|
public String u;
|
||||||
|
|
||||||
|
//update date
|
||||||
|
public long d;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cn.wildfirechat.pojos.moments;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PushProfileListRequestPojo {
|
||||||
|
//block or black
|
||||||
|
public boolean b;
|
||||||
|
|
||||||
|
//add user list
|
||||||
|
public List<String> al;
|
||||||
|
|
||||||
|
//remove user list
|
||||||
|
public List<String> rl;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package cn.wildfirechat.pojos.moments;
|
||||||
|
|
||||||
|
public class PushProfileValueRequestPojo {
|
||||||
|
/*
|
||||||
|
WFMUpdateUserProfileType_BackgroudUrl,
|
||||||
|
WFMUpdateUserProfileType_StrangerVisiableCount,
|
||||||
|
WFMUpdateUserProfileType_VisiableScope
|
||||||
|
*/
|
||||||
|
public int t;
|
||||||
|
|
||||||
|
//string value depends on t
|
||||||
|
public String v;
|
||||||
|
|
||||||
|
//int value depends on t
|
||||||
|
public int i;
|
||||||
|
}
|
||||||
@@ -347,6 +347,25 @@ public class ProtoConstants {
|
|||||||
int Forbidden_Mute_Group_Member = 0x800;
|
int Forbidden_Mute_Group_Member = 0x800;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface MomentsContentType {
|
||||||
|
int Moments_Content_Text_Type = 0;
|
||||||
|
int Moments_Content_Image_Type = 1;
|
||||||
|
int Moments_Content_Video_Type = 2;
|
||||||
|
int Moments_Content_Link_Type = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface MomentsCommentType {
|
||||||
|
int Moments_Comment_Text_Type = 0;
|
||||||
|
int Moments_Comment_Thumbup_Type = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface MomentsVisibleScope {
|
||||||
|
int Moments_VisibleScope_NoLimit = 0;
|
||||||
|
int Moments_VisibleScope_3Days = 1;
|
||||||
|
int Moments_VisibleScope_1Month = 2;
|
||||||
|
int Moments_VisibleScope_6Months = 3;
|
||||||
|
};
|
||||||
|
|
||||||
public static final int MESSAGE_CONTENT_TYPE_CREATE_GROUP = 104;
|
public static final int MESSAGE_CONTENT_TYPE_CREATE_GROUP = 104;
|
||||||
public static final int MESSAGE_CONTENT_TYPE_ADD_GROUP_MEMBER = 105;
|
public static final int MESSAGE_CONTENT_TYPE_ADD_GROUP_MEMBER = 105;
|
||||||
public static final int MESSAGE_CONTENT_TYPE_KICKOF_GROUP_MEMBER = 106;
|
public static final int MESSAGE_CONTENT_TYPE_KICKOF_GROUP_MEMBER = 106;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<!--<relativePath>../pom.xml</relativePath>-->
|
<!--<relativePath>../pom.xml</relativePath>-->
|
||||||
<artifactId>wildfirechat-parent</artifactId>
|
<artifactId>wildfirechat-parent</artifactId>
|
||||||
<groupId>cn.wildfirechat</groupId>
|
<groupId>cn.wildfirechat</groupId>
|
||||||
<version>1.3.1</version>
|
<version>1.3.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>distribution</artifactId>
|
<artifactId>distribution</artifactId>
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ message.disable_stranger_chat false
|
|||||||
##当禁止陌生人聊天时,允许聊天的用户id,比如管理员或者文件传输助手等。用户id以英文逗号分割。
|
##当禁止陌生人聊天时,允许聊天的用户id,比如管理员或者文件传输助手等。用户id以英文逗号分割。
|
||||||
message.allow_stranger_chat_list admin,FireRobot,wfc_file_transfer
|
message.allow_stranger_chat_list admin,FireRobot,wfc_file_transfer
|
||||||
|
|
||||||
|
##当禁止陌生人聊天时,允许聊天的线路。
|
||||||
|
#message.allow_stranger_line 100,101
|
||||||
|
|
||||||
##黑名单策略,0 发送失败,返回被拉黑的错误码;1 发送成功但消息被服务器直接丢弃
|
##黑名单策略,0 发送失败,返回被拉黑的错误码;1 发送成功但消息被服务器直接丢弃
|
||||||
message.blacklist.strategy 0
|
message.blacklist.strategy 0
|
||||||
|
|
||||||
@@ -322,7 +325,7 @@ server.mobile_default_silent_when_pc_online true
|
|||||||
|
|
||||||
## 客户端是否支持kickoff事件。当客户端被其他端登录踢出时,如果此开关为false时,客户端协议栈上报secret_mismatch。如果此开关为ture时,客户端协议栈上报kicked_off。
|
## 客户端是否支持kickoff事件。当客户端被其他端登录踢出时,如果此开关为false时,客户端协议栈上报secret_mismatch。如果此开关为ture时,客户端协议栈上报kicked_off。
|
||||||
## 客户端被踢时上报kicked_off是在2021.9.15之后才加上的。如果客户端协议栈全部为此日期之后的版本才可以打开此开关。
|
## 客户端被踢时上报kicked_off是在2021.9.15之后才加上的。如果客户端协议栈全部为此日期之后的版本才可以打开此开关。
|
||||||
server.client_support_kickoff_event false
|
server.client_support_kickoff_event true
|
||||||
|
|
||||||
#*********************************************************************
|
#*********************************************************************
|
||||||
# Push server configuration
|
# Push server configuration
|
||||||
@@ -423,7 +426,10 @@ push.harmony.server.address http://localhost:8085/harmony/push
|
|||||||
## 内置文本敏感词过滤处理方法,当命中敏感词后,消息会被记录到t_sensitive_messages表中,然后根据type类型做不同的处理,处理方式如下:
|
## 内置文本敏感词过滤处理方法,当命中敏感词后,消息会被记录到t_sensitive_messages表中,然后根据type类型做不同的处理,处理方式如下:
|
||||||
## 0 发送失败;1 发送成功但消息被服务器直接丢弃;2 命中的敏感词被替换成***然后正常发送;3 正常发送。
|
## 0 发送失败;1 发送成功但消息被服务器直接丢弃;2 命中的敏感词被替换成***然后正常发送;3 正常发送。
|
||||||
## 如果开启 message.sensitive.forward.url 配置,命中敏感词的消息还会被回调到这个地址
|
## 如果开启 message.sensitive.forward.url 配置,命中敏感词的消息还会被回调到这个地址
|
||||||
sensitive.filter.type 0
|
sensitive.filter.type 2
|
||||||
|
|
||||||
|
## 敏感词添加或者删除有2种方式,一种是通过Server API进行,这种方式会立即生效。另外一种方法是修改数据库,直接中数据库的t_sensitive_word表中处理
|
||||||
|
## 修改数据库的方法不会立即生效,IM服务会2个小时重新加载一次敏感词。所以如果直接修改敏感词表,需要等2个小时,或者重启才能生效。
|
||||||
|
|
||||||
## 如果内置敏感词库无法满足您的需求,可以开发部署独立敏感词审核服务。配置如下地址和消息类型,IM服务会把指定消息类型的消息回调到指定地址,内置的敏感词审核和敏感词转发功能就不再起作用了。
|
## 如果内置敏感词库无法满足您的需求,可以开发部署独立敏感词审核服务。配置如下地址和消息类型,IM服务会把指定消息类型的消息回调到指定地址,内置的敏感词审核和敏感词转发功能就不再起作用了。
|
||||||
## 审核服务返回状态码200表示继续发送,如果需要替换内容,返回状态码200并且内容为替换后的内容。返回403表示不允许发送。其它错误继续发送。
|
## 审核服务返回状态码200表示继续发送,如果需要替换内容,返回状态码200并且内容为替换后的内容。返回403表示不允许发送。其它错误继续发送。
|
||||||
|
|||||||
@@ -90,7 +90,8 @@ JAVA_OPTS="$JAVA_OPTS -XX:MaxGCPauseMillis=500"
|
|||||||
#JAVA_OPTS="$JAVA_OPTS --add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED"
|
#JAVA_OPTS="$JAVA_OPTS --add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED"
|
||||||
|
|
||||||
echo "警告:没有设置JVM内存参数!"
|
echo "警告:没有设置JVM内存参数!"
|
||||||
echo "请设置JVM参数Xmx和Xms,设置为您为IM服务预留的内存大小,注意需要刨除操作系统占用,如果有其它系统也需要相应去除占用。"
|
echo "请设置JVM参数Xmx和Xms,设置为您为IM服务预留的内存大小,注意需要刨除操作系统占用,如果有其它系统也需要相应去除占用,还需要减去堆外内存占用。"
|
||||||
|
echo "建议设置为总内存的60%以下,比如16G总内存,Xmx可以设置为9G"
|
||||||
echo ""
|
echo ""
|
||||||
#JAVA_OPTS="$JAVA_OPTS -Xmx2G"
|
#JAVA_OPTS="$JAVA_OPTS -Xmx2G"
|
||||||
#JAVA_OPTS="$JAVA_OPTS -Xms2G"
|
#JAVA_OPTS="$JAVA_OPTS -Xms2G"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<artifactId>wildfirechat-parent</artifactId>
|
<artifactId>wildfirechat-parent</artifactId>
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>1.3.1</version>
|
<version>1.3.3</version>
|
||||||
<name>Wildfire Chat</name>
|
<name>Wildfire Chat</name>
|
||||||
<description>Wildfire Chat Server</description>
|
<description>Wildfire Chat Server</description>
|
||||||
<inceptionYear>2019</inceptionYear>
|
<inceptionYear>2019</inceptionYear>
|
||||||
|
|||||||
@@ -12,6 +12,18 @@
|
|||||||
|
|
||||||
# 更新记录
|
# 更新记录
|
||||||
|
|
||||||
|
--------------
|
||||||
|
Release note 1.3.3:
|
||||||
|
1. 转移群组时检查新群主是否在群中。
|
||||||
|
2. 机器人API添加定向消息接口。
|
||||||
|
|
||||||
|
--------------
|
||||||
|
Release note 1.3.2:
|
||||||
|
1. 机器人Server SDK添加朋友圈相关接口。
|
||||||
|
2. Server API添加批量获取用户接口。
|
||||||
|
3. 解决聊天室定向消息无效的问题。
|
||||||
|
4. 添加配置,可以在禁止私聊时添加例外聊天线路。
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
Release note 1.3.1:
|
Release note 1.3.1:
|
||||||
1. 透传消息去掉消息ID,减少消息传输大小。
|
1. 透传消息去掉消息ID,减少消息传输大小。
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>wildfirechat-parent</artifactId>
|
<artifactId>wildfirechat-parent</artifactId>
|
||||||
<groupId>cn.wildfirechat</groupId>
|
<groupId>cn.wildfirechat</groupId>
|
||||||
<version>1.3.1</version>
|
<version>1.3.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
package cn.wildfirechat.sdk;
|
package cn.wildfirechat.sdk;
|
||||||
|
|
||||||
import cn.wildfirechat.common.ErrorCode;
|
import cn.wildfirechat.common.ErrorCode;
|
||||||
|
import cn.wildfirechat.pojos.moments.CommentPojo;
|
||||||
|
import cn.wildfirechat.pojos.moments.FeedPojo;
|
||||||
|
import cn.wildfirechat.pojos.moments.FeedsPojo;
|
||||||
|
import cn.wildfirechat.pojos.moments.MomentProfilePojo;
|
||||||
import cn.wildfirechat.proto.WFCMessage;
|
import cn.wildfirechat.proto.WFCMessage;
|
||||||
import cn.wildfirechat.sdk.messagecontent.*;
|
import cn.wildfirechat.sdk.messagecontent.*;
|
||||||
import cn.wildfirechat.pojos.*;
|
import cn.wildfirechat.pojos.*;
|
||||||
@@ -19,6 +23,7 @@ import static cn.wildfirechat.proto.ProtoConstants.SystemSettingType.Group_Max_M
|
|||||||
public class Main {
|
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;
|
||||||
//管理端口是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";
|
||||||
@@ -188,6 +193,14 @@ public class Main {
|
|||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IMResult<OutputUserInfoList> batchGetUsers = UserAdmin.getBatchUsers(Arrays.asList("userId1", "admin", "FireRobot", "TestUser"));
|
||||||
|
if (batchGetUsers.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("get batch user success");
|
||||||
|
} else {
|
||||||
|
System.out.println("get batch user failure");
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
InputOutputUserInfo updateUserInfo = new InputOutputUserInfo();
|
InputOutputUserInfo updateUserInfo = new InputOutputUserInfo();
|
||||||
updateUserInfo.setUserId(System.currentTimeMillis()+"");
|
updateUserInfo.setUserId(System.currentTimeMillis()+"");
|
||||||
updateUserInfo.setDisplayName("updatedUserName");
|
updateUserInfo.setDisplayName("updatedUserName");
|
||||||
@@ -1575,8 +1588,6 @@ public class Main {
|
|||||||
System.out.println(config);
|
System.out.println(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//仅专业版支持
|
//仅专业版支持
|
||||||
if (commercialServer) {
|
if (commercialServer) {
|
||||||
//开启群成员禁言
|
//开启群成员禁言
|
||||||
@@ -1643,6 +1654,88 @@ public class Main {
|
|||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//仅专业版支持,且服务器端支持朋友圈
|
||||||
|
if (robotMomentsEnabled) {
|
||||||
|
IMResult<FeedPojo> postResult = robotService.postMomentsFeed(ProtoConstants.MomentsContentType.Moments_Content_Text_Type, "hello from robot", null, null, null, null, "hello_extra");
|
||||||
|
if (postResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("post moments feed success");
|
||||||
|
} else {
|
||||||
|
System.out.println("post moments feed failure:" + postResult.getErrorCode().code);
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMResult<FeedsPojo> pullResult = robotService.getMomentsFeeds(0, 10, null);
|
||||||
|
if (pullResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("pull moments feeds success");
|
||||||
|
} else {
|
||||||
|
System.out.println("pull moments feeds failure:" + pullResult.getErrorCode().code);
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMResult<FeedPojo> feedResult = robotService.getMomentsFeed(postResult.getResult().feedId);
|
||||||
|
if (feedResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("pull moments one feed success");
|
||||||
|
} else {
|
||||||
|
System.out.println("pull moments one feed failure:" + feedResult.getErrorCode().code);
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMResult<CommentPojo> commentThumbUpResult = robotService.postMomentsComment(postResult.result.feedId, 0, ProtoConstants.MomentsCommentType.Moments_Comment_Thumbup_Type, null, null, null);
|
||||||
|
if (commentThumbUpResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("post moments thumb up success");
|
||||||
|
} else {
|
||||||
|
System.out.println("post moments thumb up failure:" + commentThumbUpResult.getErrorCode().code);
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMResult<CommentPojo> commentTextResult = robotService.postMomentsComment(postResult.result.feedId, 0, ProtoConstants.MomentsCommentType.Moments_Comment_Text_Type, "comment hello", null, null);
|
||||||
|
if (commentTextResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("post moments comment text success");
|
||||||
|
} else {
|
||||||
|
System.out.println("post moments comment text failure:" + commentTextResult.getErrorCode().code);
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMResult<Void> updateResult = robotService.updateMomentsFeed(postResult.getResult().feedId, ProtoConstants.MomentsContentType.Moments_Content_Text_Type, "hello from robot2", null, null, null, null, "hello_extra2");
|
||||||
|
if (updateResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("update moments feed success");
|
||||||
|
} else {
|
||||||
|
System.out.println("update moments feed failure:" + updateResult.getErrorCode().code);
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMResult<Void> deleteCommentThumbUpResult = robotService.deleteMomentsComment(postResult.result.feedId, commentThumbUpResult.result.commentId);
|
||||||
|
if (deleteCommentThumbUpResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("delete moments thumb up success");
|
||||||
|
} else {
|
||||||
|
System.out.println("delete moments thumb up failure:" + deleteCommentThumbUpResult.getErrorCode().code);
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMResult<Void> deleteCommentTextResult = robotService.deleteMomentsComment(postResult.result.feedId, commentTextResult.result.commentId);
|
||||||
|
if (deleteCommentTextResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("delete moments comment text success");
|
||||||
|
} else {
|
||||||
|
System.out.println("delete moments comment text failure:" + deleteCommentTextResult.getErrorCode().code);
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMResult<Void> deleteFeedResult = robotService.deleteMomentsFeed(postResult.result.feedId);
|
||||||
|
if (deleteFeedResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("delete moments feed success");
|
||||||
|
} else {
|
||||||
|
System.out.println("delete moments feed failure:" + deleteFeedResult.getErrorCode().code);
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMResult<MomentProfilePojo> profileResult = robotService.getUserMomentsProfile(robotId);
|
||||||
|
if (profileResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("get user moments profile success");
|
||||||
|
} else {
|
||||||
|
System.out.println("get user moments profile failure:" + profileResult.getErrorCode().code);
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//***测试频道API功能,仅专业版支持***
|
//***测试频道API功能,仅专业版支持***
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package cn.wildfirechat.sdk;
|
package cn.wildfirechat.sdk;
|
||||||
|
|
||||||
import cn.wildfirechat.common.APIPath;
|
import cn.wildfirechat.common.APIPath;
|
||||||
|
import cn.wildfirechat.common.ErrorCode;
|
||||||
import cn.wildfirechat.pojos.*;
|
import cn.wildfirechat.pojos.*;
|
||||||
|
import cn.wildfirechat.pojos.moments.*;
|
||||||
import cn.wildfirechat.sdk.model.IMResult;
|
import cn.wildfirechat.sdk.model.IMResult;
|
||||||
import cn.wildfirechat.sdk.utilities.RobotHttpUtils;
|
import cn.wildfirechat.sdk.utilities.RobotHttpUtils;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
@@ -22,10 +24,15 @@ public class RobotService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IMResult<SendMessageResult> sendMessage(String sender, Conversation conversation, MessagePayload payload) throws Exception {
|
public IMResult<SendMessageResult> sendMessage(String sender, Conversation conversation, MessagePayload payload) throws Exception {
|
||||||
|
return sendMessage(sender, conversation, payload, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMResult<SendMessageResult> sendMessage(String sender, Conversation conversation, MessagePayload payload, List<String> toUsers) throws Exception {
|
||||||
String path = APIPath.Robot_Message_Send;
|
String path = APIPath.Robot_Message_Send;
|
||||||
SendMessageData messageData = new SendMessageData();
|
SendMessageData messageData = new SendMessageData();
|
||||||
messageData.setSender(sender);
|
messageData.setSender(sender);
|
||||||
messageData.setConv(conversation);
|
messageData.setConv(conversation);
|
||||||
|
messageData.setToUsers(toUsers);
|
||||||
messageData.setPayload(payload);
|
messageData.setPayload(payload);
|
||||||
return robotHttpUtils.httpJsonPost(path, messageData, SendMessageResult.class);
|
return robotHttpUtils.httpJsonPost(path, messageData, SendMessageResult.class);
|
||||||
}
|
}
|
||||||
@@ -96,7 +103,7 @@ public class RobotService {
|
|||||||
return robotHttpUtils.httpJsonPost(path, pojo, Void.class);
|
return robotHttpUtils.httpJsonPost(path, pojo, Void.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMResult<OutputCreateGroupResult> createGroup(PojoGroupInfo group_info, List<PojoGroupMember> members, String member_extra, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
public IMResult<OutputCreateGroupResult> createGroup(PojoGroupInfo group_info, List<PojoGroupMember> members, String member_extra, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||||
String path = APIPath.Robot_Create_Group;
|
String path = APIPath.Robot_Create_Group;
|
||||||
PojoGroup pojoGroup = new PojoGroup();
|
PojoGroup pojoGroup = new PojoGroup();
|
||||||
pojoGroup.setGroup_info(group_info);
|
pojoGroup.setGroup_info(group_info);
|
||||||
@@ -118,7 +125,7 @@ public class RobotService {
|
|||||||
return robotHttpUtils.httpJsonPost(path, input, PojoGroupInfo.class);
|
return robotHttpUtils.httpJsonPost(path, input, PojoGroupInfo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMResult<Void> dismissGroup(String groupId, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
public IMResult<Void> dismissGroup(String groupId, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||||
String path = APIPath.Robot_Group_Dismiss;
|
String path = APIPath.Robot_Group_Dismiss;
|
||||||
InputDismissGroup dismissGroup = new InputDismissGroup();
|
InputDismissGroup dismissGroup = new InputDismissGroup();
|
||||||
dismissGroup.setGroup_id(groupId);
|
dismissGroup.setGroup_id(groupId);
|
||||||
@@ -127,7 +134,7 @@ public class RobotService {
|
|||||||
return robotHttpUtils.httpJsonPost(path, dismissGroup, Void.class);
|
return robotHttpUtils.httpJsonPost(path, dismissGroup, Void.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMResult<Void> transferGroup(String groupId, String newOwner, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
public IMResult<Void> transferGroup(String groupId, String newOwner, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||||
String path = APIPath.Robot_Group_Transfer;
|
String path = APIPath.Robot_Group_Transfer;
|
||||||
InputTransferGroup transferGroup = new InputTransferGroup();
|
InputTransferGroup transferGroup = new InputTransferGroup();
|
||||||
transferGroup.setGroup_id(groupId);
|
transferGroup.setGroup_id(groupId);
|
||||||
@@ -137,7 +144,7 @@ public class RobotService {
|
|||||||
return robotHttpUtils.httpJsonPost(path, transferGroup, Void.class);
|
return robotHttpUtils.httpJsonPost(path, transferGroup, Void.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMResult<Void> modifyGroupInfo(String groupId, /*ModifyGroupInfoType*/int type, String value, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
public IMResult<Void> modifyGroupInfo(String groupId, /*ModifyGroupInfoType*/int type, String value, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||||
String path = APIPath.Robot_Group_Modify_Info;
|
String path = APIPath.Robot_Group_Modify_Info;
|
||||||
InputModifyGroupInfo modifyGroupInfo = new InputModifyGroupInfo();
|
InputModifyGroupInfo modifyGroupInfo = new InputModifyGroupInfo();
|
||||||
modifyGroupInfo.setGroup_id(groupId);
|
modifyGroupInfo.setGroup_id(groupId);
|
||||||
@@ -164,7 +171,7 @@ public class RobotService {
|
|||||||
return robotHttpUtils.httpJsonPost(path, input, PojoGroupMember.class);
|
return robotHttpUtils.httpJsonPost(path, input, PojoGroupMember.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMResult<Void> addGroupMembers(String groupId, List<PojoGroupMember> groupMembers, String member_extra, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
public IMResult<Void> addGroupMembers(String groupId, List<PojoGroupMember> groupMembers, String member_extra, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||||
String path = APIPath.Robot_Group_Member_Add;
|
String path = APIPath.Robot_Group_Member_Add;
|
||||||
InputAddGroupMember addGroupMember = new InputAddGroupMember();
|
InputAddGroupMember addGroupMember = new InputAddGroupMember();
|
||||||
addGroupMember.setGroup_id(groupId);
|
addGroupMember.setGroup_id(groupId);
|
||||||
@@ -175,7 +182,7 @@ public class RobotService {
|
|||||||
return robotHttpUtils.httpJsonPost(path, addGroupMember, Void.class);
|
return robotHttpUtils.httpJsonPost(path, addGroupMember, Void.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMResult<Void> setGroupManager(String groupId, List<String> groupMemberIds, boolean isManager, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
public IMResult<Void> setGroupManager(String groupId, List<String> groupMemberIds, boolean isManager, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||||
String path = APIPath.Robot_Group_Set_Manager;
|
String path = APIPath.Robot_Group_Set_Manager;
|
||||||
InputSetGroupManager addGroupMember = new InputSetGroupManager();
|
InputSetGroupManager addGroupMember = new InputSetGroupManager();
|
||||||
addGroupMember.setGroup_id(groupId);
|
addGroupMember.setGroup_id(groupId);
|
||||||
@@ -186,7 +193,7 @@ public class RobotService {
|
|||||||
return robotHttpUtils.httpJsonPost(path, addGroupMember, Void.class);
|
return robotHttpUtils.httpJsonPost(path, addGroupMember, Void.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMResult<Void> muteGroupMember(String groupId, List<String> groupMemberIds, boolean isMute, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
public IMResult<Void> muteGroupMember(String groupId, List<String> groupMemberIds, boolean isMute, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||||
String path = APIPath.Robot_Group_Mute_Member;
|
String path = APIPath.Robot_Group_Mute_Member;
|
||||||
InputMuteGroupMember addGroupMember = new InputMuteGroupMember();
|
InputMuteGroupMember addGroupMember = new InputMuteGroupMember();
|
||||||
addGroupMember.setGroup_id(groupId);
|
addGroupMember.setGroup_id(groupId);
|
||||||
@@ -197,7 +204,7 @@ public class RobotService {
|
|||||||
return robotHttpUtils.httpJsonPost(path, addGroupMember, Void.class);
|
return robotHttpUtils.httpJsonPost(path, addGroupMember, Void.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMResult<Void> allowGroupMember(String groupId, List<String> groupMemberIds, boolean isAllow, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
public IMResult<Void> allowGroupMember(String groupId, List<String> groupMemberIds, boolean isAllow, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||||
String path = APIPath.Robot_Group_Allow_Member;
|
String path = APIPath.Robot_Group_Allow_Member;
|
||||||
InputMuteGroupMember addGroupMember = new InputMuteGroupMember();
|
InputMuteGroupMember addGroupMember = new InputMuteGroupMember();
|
||||||
addGroupMember.setGroup_id(groupId);
|
addGroupMember.setGroup_id(groupId);
|
||||||
@@ -208,7 +215,7 @@ public class RobotService {
|
|||||||
return robotHttpUtils.httpJsonPost(path, addGroupMember, Void.class);
|
return robotHttpUtils.httpJsonPost(path, addGroupMember, Void.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMResult<Void> kickoffGroupMembers(String groupId, List<String> groupMemberIds, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
public IMResult<Void> kickoffGroupMembers(String groupId, List<String> groupMemberIds, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||||
String path = APIPath.Robot_Group_Member_Kickoff;
|
String path = APIPath.Robot_Group_Member_Kickoff;
|
||||||
InputKickoffGroupMember kickoffGroupMember = new InputKickoffGroupMember();
|
InputKickoffGroupMember kickoffGroupMember = new InputKickoffGroupMember();
|
||||||
kickoffGroupMember.setGroup_id(groupId);
|
kickoffGroupMember.setGroup_id(groupId);
|
||||||
@@ -218,7 +225,7 @@ public class RobotService {
|
|||||||
return robotHttpUtils.httpJsonPost(path, kickoffGroupMember, Void.class);
|
return robotHttpUtils.httpJsonPost(path, kickoffGroupMember, Void.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMResult<Void> quitGroup(String groupId, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
public IMResult<Void> quitGroup(String groupId, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||||
String path = APIPath.Robot_Group_Member_Quit;
|
String path = APIPath.Robot_Group_Member_Quit;
|
||||||
InputQuitGroup quitGroup = new InputQuitGroup();
|
InputQuitGroup quitGroup = new InputQuitGroup();
|
||||||
quitGroup.setGroup_id(groupId);
|
quitGroup.setGroup_id(groupId);
|
||||||
@@ -227,7 +234,7 @@ public class RobotService {
|
|||||||
return robotHttpUtils.httpJsonPost(path, quitGroup, Void.class);
|
return robotHttpUtils.httpJsonPost(path, quitGroup, Void.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMResult<Void> setGroupMemberAlias(String groupId, String memberId, String alias, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
public IMResult<Void> setGroupMemberAlias(String groupId, String memberId, String alias, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||||
String path = APIPath.Robot_Group_Set_Member_Alias;
|
String path = APIPath.Robot_Group_Set_Member_Alias;
|
||||||
InputSetGroupMemberAlias input = new InputSetGroupMemberAlias();
|
InputSetGroupMemberAlias input = new InputSetGroupMemberAlias();
|
||||||
input.setGroup_id(groupId);
|
input.setGroup_id(groupId);
|
||||||
@@ -238,7 +245,7 @@ public class RobotService {
|
|||||||
return robotHttpUtils.httpJsonPost(path, input, Void.class);
|
return robotHttpUtils.httpJsonPost(path, input, Void.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMResult<Void> setGroupMemberExtra(String groupId, String memberId, String extra, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
public IMResult<Void> setGroupMemberExtra(String groupId, String memberId, String extra, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||||
String path = APIPath.Robot_Group_Set_Member_Extra;
|
String path = APIPath.Robot_Group_Set_Member_Extra;
|
||||||
InputSetGroupMemberExtra input = new InputSetGroupMemberExtra();
|
InputSetGroupMemberExtra input = new InputSetGroupMemberExtra();
|
||||||
input.setGroup_id(groupId);
|
input.setGroup_id(groupId);
|
||||||
@@ -276,4 +283,144 @@ public class RobotService {
|
|||||||
return robotHttpUtils.httpJsonPost(path, input, String.class);
|
return robotHttpUtils.httpJsonPost(path, input, String.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IMResult<FeedPojo> postMomentsFeed(int/*MomentsContentType*/ type, String text, List<MediaEntry> medias, List<String> toUsers, List<String> excludeUsers, List<String> mentionedUsers, String extra) throws Exception {
|
||||||
|
String path = APIPath.Robot_Moments_Post_Feed;
|
||||||
|
FeedPojo feedPojo = new FeedPojo();
|
||||||
|
feedPojo.type = type;
|
||||||
|
feedPojo.text = text;
|
||||||
|
feedPojo.medias = medias;
|
||||||
|
feedPojo.to = toUsers;
|
||||||
|
feedPojo.ex = excludeUsers;
|
||||||
|
feedPojo.mu = mentionedUsers;
|
||||||
|
feedPojo.extra = extra;
|
||||||
|
IMResult<PostFeedResult> imResult = robotHttpUtils.httpJsonPost(path, feedPojo, PostFeedResult.class);
|
||||||
|
IMResult<FeedPojo> feedResult = new IMResult<>();
|
||||||
|
if(imResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
feedPojo.feedId = imResult.result.id;
|
||||||
|
feedPojo.timestamp = imResult.result.timestamp;
|
||||||
|
feedResult.setCode(ErrorCode.ERROR_CODE_SUCCESS.getCode());
|
||||||
|
feedResult.setResult(feedPojo);
|
||||||
|
} else {
|
||||||
|
feedResult.setCode(imResult.getCode());
|
||||||
|
feedResult.setMsg(imResult.getMsg());
|
||||||
|
}
|
||||||
|
return feedResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMResult<Void> updateMomentsFeed(long feedId, int/*MomentsContentType*/ type, String text, List<MediaEntry> medias, List<String> toUsers, List<String> excludeUsers, List<String> mentionedUsers, String extra) throws Exception {
|
||||||
|
String path = APIPath.Robot_Moments_Update_Feed;
|
||||||
|
FeedPojo feedPojo = new FeedPojo();
|
||||||
|
feedPojo.feedId = feedId;
|
||||||
|
feedPojo.type = type;
|
||||||
|
feedPojo.text = text;
|
||||||
|
feedPojo.medias = medias;
|
||||||
|
feedPojo.to = toUsers;
|
||||||
|
feedPojo.ex = excludeUsers;
|
||||||
|
feedPojo.mu = mentionedUsers;
|
||||||
|
feedPojo.extra = extra;
|
||||||
|
return robotHttpUtils.httpJsonPost(path, feedPojo, Void.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMResult<FeedsPojo> getMomentsFeeds(long feedId, int count, String user) throws Exception {
|
||||||
|
String path = APIPath.Robot_Moments_Pull_Feeds;
|
||||||
|
PullFeedRequestPojo requestPojo = new PullFeedRequestPojo();
|
||||||
|
requestPojo.feedId = feedId;
|
||||||
|
requestPojo.count = count;
|
||||||
|
requestPojo.user = user;
|
||||||
|
return robotHttpUtils.httpJsonPost(path, requestPojo, FeedsPojo.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMResult<FeedPojo> getMomentsFeed(long feedId) throws Exception {
|
||||||
|
String path = APIPath.Robot_Moments_Fetch_Feed;
|
||||||
|
PullOneFeedRequestPojo requestPojo = new PullOneFeedRequestPojo();
|
||||||
|
requestPojo.feedId = feedId;
|
||||||
|
return robotHttpUtils.httpJsonPost(path, requestPojo, FeedPojo.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMResult<Void> deleteMomentsFeed(long feedId) throws Exception {
|
||||||
|
String path = APIPath.Robot_Moments_Recall_Feed;
|
||||||
|
IdPojo requestPojo = new IdPojo();
|
||||||
|
requestPojo.id = feedId;
|
||||||
|
return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMResult<CommentPojo> postMomentsComment(long feedId, long replyId, int/*MomentsCommentType*/ type, String text, String replyTo, String extra) throws Exception {
|
||||||
|
String path = APIPath.Robot_Moments_Post_Comment;
|
||||||
|
CommentPojo commentPojo = new CommentPojo();
|
||||||
|
commentPojo.type = type;
|
||||||
|
commentPojo.text = text;
|
||||||
|
commentPojo.replyId = replyId;
|
||||||
|
commentPojo.feedId = feedId;
|
||||||
|
commentPojo.replyTo = replyTo;
|
||||||
|
commentPojo.extra = extra;
|
||||||
|
IMResult<PostFeedResult> imResult = robotHttpUtils.httpJsonPost(path, commentPojo, PostFeedResult.class);
|
||||||
|
IMResult<CommentPojo> feedResult = new IMResult<>();
|
||||||
|
if(imResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
commentPojo.commentId = imResult.result.id;
|
||||||
|
commentPojo.timestamp = imResult.result.timestamp;
|
||||||
|
feedResult.setCode(ErrorCode.ERROR_CODE_SUCCESS.getCode());
|
||||||
|
feedResult.setResult(commentPojo);
|
||||||
|
} else {
|
||||||
|
feedResult.setCode(imResult.getCode());
|
||||||
|
feedResult.setMsg(imResult.getMsg());
|
||||||
|
}
|
||||||
|
return feedResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMResult<Void> deleteMomentsComment(long feedId, long commentId) throws Exception {
|
||||||
|
String path = APIPath.Robot_Moments_Recall_Comment;
|
||||||
|
IdPojo requestPojo = new IdPojo();
|
||||||
|
requestPojo.id = commentId;
|
||||||
|
requestPojo.id2 = feedId;
|
||||||
|
return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMResult<MomentProfilePojo> getUserMomentsProfile(String userId) throws Exception {
|
||||||
|
String path = APIPath.Robot_Moments_Fetch_Profiles;
|
||||||
|
PullProfileRequestPojo requestPojo = new PullProfileRequestPojo();
|
||||||
|
requestPojo.u = userId;
|
||||||
|
return robotHttpUtils.httpJsonPost(path, requestPojo, MomentProfilePojo.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMResult<Void> updateMomentsBackgroundUrl(String url) throws Exception {
|
||||||
|
String path = APIPath.Robot_Moments_Update_Profiles_Value;
|
||||||
|
PushProfileValueRequestPojo requestPojo = new PushProfileValueRequestPojo();
|
||||||
|
requestPojo.t = 0;
|
||||||
|
requestPojo.v = url;
|
||||||
|
return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMResult<Void> updateMomentsStrangerVisibleCount(int count) throws Exception {
|
||||||
|
String path = APIPath.Robot_Moments_Update_Profiles_Value;
|
||||||
|
PushProfileValueRequestPojo requestPojo = new PushProfileValueRequestPojo();
|
||||||
|
requestPojo.t = 1;
|
||||||
|
requestPojo.i = count;
|
||||||
|
return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMResult<Void> updateMomentsVisibleScope(int/*MomentsVisibleScope*/ scope) throws Exception {
|
||||||
|
String path = APIPath.Robot_Moments_Update_Profiles_Value;
|
||||||
|
PushProfileValueRequestPojo requestPojo = new PushProfileValueRequestPojo();
|
||||||
|
requestPojo.t = 2;
|
||||||
|
requestPojo.i = scope;
|
||||||
|
return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMResult<Void> updateMomentsBlackList(List<String> addList, List<String> removeList) throws Exception {
|
||||||
|
String path = APIPath.Robot_Moments_Update_Profiles_List_Value;
|
||||||
|
PushProfileListRequestPojo requestPojo = new PushProfileListRequestPojo();
|
||||||
|
requestPojo.b = false;
|
||||||
|
requestPojo.al = addList;
|
||||||
|
requestPojo.rl = removeList;
|
||||||
|
return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMResult<Void> updateMomentsBlockList(List<String> addList, List<String> removeList) throws Exception {
|
||||||
|
String path = APIPath.Robot_Moments_Update_Profiles_List_Value;
|
||||||
|
PushProfileListRequestPojo requestPojo = new PushProfileListRequestPojo();
|
||||||
|
requestPojo.b = true;
|
||||||
|
requestPojo.al = addList;
|
||||||
|
requestPojo.rl = removeList;
|
||||||
|
return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import cn.wildfirechat.pojos.*;
|
|||||||
import cn.wildfirechat.sdk.model.IMResult;
|
import cn.wildfirechat.sdk.model.IMResult;
|
||||||
import cn.wildfirechat.sdk.utilities.AdminHttpUtils;
|
import cn.wildfirechat.sdk.utilities.AdminHttpUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class UserAdmin {
|
public class UserAdmin {
|
||||||
public static IMResult<InputOutputUserInfo> getUserByName(String name) throws Exception {
|
public static IMResult<InputOutputUserInfo> getUserByName(String name) throws Exception {
|
||||||
String path = APIPath.User_Get_Info;
|
String path = APIPath.User_Get_Info;
|
||||||
@@ -37,6 +39,13 @@ public class UserAdmin {
|
|||||||
return AdminHttpUtils.httpJsonPost(path, input, OutputGetUserList.class);
|
return AdminHttpUtils.httpJsonPost(path, input, OutputGetUserList.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IMResult<OutputUserInfoList> getBatchUsers(List<String> userIds) throws Exception {
|
||||||
|
String path = APIPath.User_Batch_Get_Infos;
|
||||||
|
InputStringList input = new InputStringList();
|
||||||
|
input.setList(userIds);
|
||||||
|
return AdminHttpUtils.httpJsonPost(path, input, OutputUserInfoList.class);
|
||||||
|
}
|
||||||
|
|
||||||
public static IMResult<OutputCreateUser> createUser(InputOutputUserInfo user) throws Exception {
|
public static IMResult<OutputCreateUser> createUser(InputOutputUserInfo user) throws Exception {
|
||||||
String path = APIPath.Create_User;
|
String path = APIPath.Create_User;
|
||||||
return AdminHttpUtils.httpJsonPost(path, user, OutputCreateUser.class);
|
return AdminHttpUtils.httpJsonPost(path, user, OutputCreateUser.class);
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ public class AdminHttpUtils extends JsonUtils {
|
|||||||
private static CloseableHttpClient httpClient;
|
private static CloseableHttpClient httpClient;
|
||||||
|
|
||||||
public static void init(String url, String secret) {
|
public static void init(String url, String secret) {
|
||||||
adminUrl = url;
|
adminUrl = url.trim();
|
||||||
adminSecret = secret;
|
adminSecret = secret.trim();
|
||||||
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
|
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
|
||||||
cm.setValidateAfterInactivity(1000);
|
cm.setValidateAfterInactivity(1000);
|
||||||
httpClient = HttpClients.custom()
|
httpClient = HttpClients.custom()
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ public class ChannelHttpUtils extends JsonUtils {
|
|||||||
private final CloseableHttpClient httpClient;
|
private final CloseableHttpClient httpClient;
|
||||||
|
|
||||||
public ChannelHttpUtils(String imurl, String channelId, String secret) {
|
public ChannelHttpUtils(String imurl, String channelId, String secret) {
|
||||||
this.imurl = imurl;
|
this.imurl = imurl.trim();
|
||||||
this.channelId = channelId;
|
this.channelId = channelId.trim();
|
||||||
this.channelSecret = secret;
|
this.channelSecret = secret.trim();
|
||||||
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
|
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
|
||||||
cm.setValidateAfterInactivity(1000);
|
cm.setValidateAfterInactivity(1000);
|
||||||
httpClient = HttpClients.custom()
|
httpClient = HttpClients.custom()
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ public class RobotHttpUtils extends JsonUtils {
|
|||||||
private final CloseableHttpClient httpClient;
|
private final CloseableHttpClient httpClient;
|
||||||
|
|
||||||
public RobotHttpUtils(String url, String robotId, String robotSecret) {
|
public RobotHttpUtils(String url, String robotId, String robotSecret) {
|
||||||
this.url = url;
|
this.url = url.trim();
|
||||||
this.robotId = robotId;
|
this.robotId = robotId.trim();
|
||||||
this.robotSecret = robotSecret;
|
this.robotSecret = robotSecret.trim();
|
||||||
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
|
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
|
||||||
cm.setValidateAfterInactivity(1000);
|
cm.setValidateAfterInactivity(1000);
|
||||||
httpClient = HttpClients.custom()
|
httpClient = HttpClients.custom()
|
||||||
|
|||||||
Reference in New Issue
Block a user