Commit a4bd3996 by Shadow

群聊天时,增加对群封禁的判断

parent 1c565855
......@@ -79,5 +79,6 @@ api.response.code.REPETITION_CONVERSATION=已有会话,不能重复创建会话
api.response.code.CLIENT_NOT_FOUNT=成员不存在,不能创建会话
api.response.code.IS_BE_BLACK=被对方拉黑
api.response.code.IS_TO_BLACK=你把对方拉黑
api.response.code.IS_BE_FORBID_SEND_LINK=????????
api.response.code.IS_BE_FORBID_SEND_PIC=????????
api.response.code.IS_BE_FORBID_SEND_LINK=禁止发送链接
api.response.code.IS_BE_FORBID_SEND_PIC=禁止发送图片
api.response.code.IS_BE_BANED=该群已被封禁
......@@ -140,6 +140,8 @@ public class NormalChatAction {
channelSender.sendMsgLocal((NioSocketChannel) request.getSenderChannel(), responseModel);
return;
}
// 判断为单聊
if (membersList.size() == 2) {
// 判断是否被拉黑逻辑
......@@ -151,12 +153,18 @@ public class NormalChatAction {
return;
}
}
if (beKickOut(reqId, imClientSender, membersList, request.getSenderChannel())) {
return;
}
if (muted(conversation, reqId, imClientSender, membersList, request.getSenderChannel())) {
return;
}
if (baned(conversation, reqId, imClientSender, membersList, request.getSenderChannel())) {
return;
}
// 消息内容校验
if (!checkMsg(imClientSender, conversation, reqId, data, request.getSenderChannel())) {
return;
......@@ -493,6 +501,40 @@ public class NormalChatAction {
}
/**
* 是否封禁
* @Author Shadow
* @Date 2022年06月06日 01:42:33
* @param
* @Return
*/
private boolean baned(ImConversationQueryVo conversation, String reqId, ImClient imClientSender, List<ImConversationMembers> membersList, Channel channel) {
// 会话是否被封禁
String attributes = imClientSender.getAttributes();
if (StringUtils.isNotBlank(attributes)) {
JSONObject jsonObject = JSONObject.parseObject(attributes);
if (jsonObject == null || jsonObject.isEmpty() || !jsonObject.containsKey("baned")) {
return false;
}
boolean baned = jsonObject.getBoolean("baned");
if (baned) {
// 响应发送方
WsResponse<HashMap<String, Long>> responseModel = new WsResponse<>();
ApiResult<Boolean> apiResult = ApiResult.result(ApiCode.IS_BE_MUTED);
responseModel.setCmd(WsResponseCmdEnum.RES.getCmdCode());
responseModel.setCode(apiResult.getCode());
responseModel.setMsg(apiResult.getMessage());
responseModel.setReqId(reqId);
channelSender.sendMsgLocal((NioSocketChannel) channel, responseModel);
return true;
}
return false;
} else {
return false;
}
}
/**
* 是否禁止发送链接
* @Author luozh
* @Date 2022年04月27日 04:39:04
......
......@@ -162,6 +162,11 @@ public enum ApiCode {
*/
EXCEED_VIP_QUANTITY_LIMIT(6020, "api.response.code.IS_BE_FORBID_SEND_PIC"),
/**
* 已被禁言
*/
IS_BE_BANED(6021, "api.response.code.IS_BE_BANED"),
;
private final int code;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment