添加默认敏感词

This commit is contained in:
heavyrain lee
2019-07-23 08:26:16 +08:00
parent 1fb3c757e2
commit 4aa2f46011
3 changed files with 4042 additions and 2 deletions
+1 -1
View File
@@ -111,7 +111,7 @@ mongodb.data_expire_days 1096
#********************************************************************* #*********************************************************************
# Sensitive configuration # Sensitive configuration
#********************************************************************* #*********************************************************************
##文本敏感词过滤处理方法,0 发送失败;1 发送成功但消息被服务器直接丢弃;2 命中的敏感词被替换成*** ##文本敏感词过滤处理方法,0 发送失败;1 发送成功但消息被服务器直接丢弃;2 命中的敏感词被替换成***;3 记录并继续发送
sensitive.filter.type 0 sensitive.filter.type 0
#********************************************************************* #*********************************************************************
File diff suppressed because it is too large Load Diff
@@ -95,13 +95,15 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
errorCode = ErrorCode.ERROR_CODE_SENSITIVE_MATCHED; errorCode = ErrorCode.ERROR_CODE_SENSITIVE_MATCHED;
} else if(mSensitiveType == 1) { } else if(mSensitiveType == 1) {
ignoreMsg = true; ignoreMsg = true;
} else { } else if(mSensitiveType == 2) {
String text = message.getContent().getSearchableContent(); String text = message.getContent().getSearchableContent();
for (String word : matched) { for (String word : matched) {
text = text.replace(word, "***"); text = text.replace(word, "***");
} }
message = message.toBuilder().setContent(message.getContent().toBuilder().setSearchableContent(text).build()).build(); message = message.toBuilder().setContent(message.getContent().toBuilder().setSearchableContent(text).build()).build();
} else if(mSensitiveType == 3) {
} }
} }
} }