Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewei
wecloud_im_server
Commits
54743aa0
Commit
54743aa0
authored
May 17, 2022
by
罗长华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加禁止发送图片判断
parent
729f7a1c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
core/src/main/java/com/wecloud/im/action/NormalChatAction.java
+18
-2
framework/src/main/java/io/geekidea/springbootplus/framework/common/api/ApiCode.java
+5
-0
No files found.
core/src/main/java/com/wecloud/im/action/NormalChatAction.java
View file @
54743aa0
...
@@ -45,6 +45,7 @@ import com.wecloud.im.service.ImConversationMembersService;
...
@@ -45,6 +45,7 @@ import com.wecloud.im.service.ImConversationMembersService;
import
com.wecloud.im.service.ImConversationService
;
import
com.wecloud.im.service.ImConversationService
;
import
com.wecloud.im.service.ImInboxService
;
import
com.wecloud.im.service.ImInboxService
;
import
com.wecloud.im.service.ImMessageService
;
import
com.wecloud.im.service.ImMessageService
;
import
com.wecloud.im.ws.enums.MsgTypeEnum
;
import
com.wecloud.im.ws.enums.WsResponseCmdEnum
;
import
com.wecloud.im.ws.enums.WsResponseCmdEnum
;
import
com.wecloud.im.ws.model.WsResponse
;
import
com.wecloud.im.ws.model.WsResponse
;
import
com.wecloud.im.ws.sender.ChannelSender
;
import
com.wecloud.im.ws.sender.ChannelSender
;
...
@@ -143,7 +144,7 @@ public class NormalChatAction {
...
@@ -143,7 +144,7 @@ public class NormalChatAction {
return
;
return
;
}
}
// 消息内容校验
// 消息内容校验
if
(
checkMsg
(
conversation
,
reqId
,
data
.
getText
()
,
request
.
getSenderChannel
()))
{
if
(
checkMsg
(
conversation
,
reqId
,
data
,
request
.
getSenderChannel
()))
{
return
;
return
;
}
}
...
@@ -397,8 +398,23 @@ public class NormalChatAction {
...
@@ -397,8 +398,23 @@ public class NormalChatAction {
* @Return
* @Return
*/
*/
private
boolean
checkMsg
(
ImConversationQueryVo
conversation
,
String
reqId
,
private
boolean
checkMsg
(
ImConversationQueryVo
conversation
,
String
reqId
,
String
msgContent
,
Channel
channel
)
{
ChatContentVo
data
,
Channel
channel
)
{
boolean
result
=
false
;
boolean
result
=
false
;
String
msgContent
=
data
.
getText
();
// 是否图片
if
(
MsgTypeEnum
.
MEDIA_TYPE_IMAGE
.
getUriCode
()
==
data
.
getType
())
{
if
(
conversation
.
getForbidSendPic
())
{
// 响应发送方
WsResponse
<
HashMap
<
String
,
Long
>>
responseModel
=
new
WsResponse
<>();
ApiResult
<
Boolean
>
apiResult
=
ApiResult
.
result
(
ApiCode
.
IS_BE_FORBID_SEND_PIC
);
responseModel
.
setCmd
(
WsResponseCmdEnum
.
RES
.
getCmdCode
());
responseModel
.
setCode
(
apiResult
.
getCode
());
responseModel
.
setMsg
(
"本群已被群主禁止发送图片"
);
responseModel
.
setReqId
(
reqId
);
channelSender
.
sendMsgLocal
((
NioSocketChannel
)
channel
,
responseModel
);
return
false
;
}
}
// 判断是否开启禁止发送链接
// 判断是否开启禁止发送链接
if
(
conversation
.
getForbidSendLink
())
{
if
(
conversation
.
getForbidSendLink
())
{
String
regex
=
"((ht|f)tp(s?)\\:\\/\\/)?[0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*."
+
String
regex
=
"((ht|f)tp(s?)\\:\\/\\/)?[0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*."
+
...
...
framework/src/main/java/io/geekidea/springbootplus/framework/common/api/ApiCode.java
View file @
54743aa0
...
@@ -147,6 +147,11 @@ public enum ApiCode {
...
@@ -147,6 +147,11 @@ public enum ApiCode {
*/
*/
IS_BE_FORBID_SEND_LINK
(
6017
,
"api.response.code.IS_BE_FORBID_SEND_LINK"
),
IS_BE_FORBID_SEND_LINK
(
6017
,
"api.response.code.IS_BE_FORBID_SEND_LINK"
),
/**
* 群已禁止发图片
*/
IS_BE_FORBID_SEND_PIC
(
6018
,
"api.response.code.IS_BE_FORBID_SEND_LINK"
),
;
;
private
final
int
code
;
private
final
int
code
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment