敏感字
parent
b8cfc5a572
commit
0f783608d2
|
@ -92,7 +92,7 @@ public class ChatLogic {
|
|||
int uid = iSession.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
FriendManager friendManager = user.getFriendManager();
|
||||
boolean result = ShieldedWordUtils.checkName(message,false);
|
||||
boolean result = ShieldedWordUtils.checkName(user,message,false);
|
||||
if (!result) {
|
||||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "包含敏感字");
|
||||
return ;
|
||||
|
@ -102,19 +102,12 @@ public class ChatLogic {
|
|||
case 1: //世界
|
||||
long messageId = RedisUtil.getInstence().increment(GameApplication.serverId + RedisKey.CHAT_WORD_MSG_ID + GameApplication.serverId);
|
||||
ChatProto.ChatInfo chatInfo = CBean2Proto.getChatInfoBuilder(user,message,nowTime,messageId);
|
||||
if(!Repot37EventUtil.Report37Chat(user, ChatContentType.WORLD_CHAT.getType(),chatInfo.getMsg())){
|
||||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "包含敏感字");
|
||||
return;
|
||||
}
|
||||
|
||||
MessageCache.addWordMsg(chatInfo,messageId);
|
||||
break;
|
||||
case 2: //公会
|
||||
messageId = RedisUtil.getInstence().increment(GameApplication.serverId + RedisKey.CHAT_GUILD_MSG_ID+ GameApplication.serverId);
|
||||
chatInfo = CBean2Proto.getChatInfoBuilder(user,message,nowTime,messageId);
|
||||
if(!Repot37EventUtil.Report37Chat(user, ChatContentType.FAMILY.getType(),chatInfo.getMsg())){
|
||||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "包含敏感字");
|
||||
return;
|
||||
}
|
||||
MessageCache.addGuildMsg(chatInfo,messageId);
|
||||
break;
|
||||
case 3: //好友
|
||||
|
@ -130,10 +123,6 @@ public class ChatLogic {
|
|||
ChatProto.SendChatInfoIndication sendChatInfoIndication = ChatProto.SendChatInfoIndication.newBuilder()
|
||||
.setChatInfo(chatInfo)
|
||||
.build();
|
||||
if(!Repot37EventUtil.Report37Chat(user, ChatContentType.PRIVATE_CHAT.getType(),chatInfo.getMsg())){
|
||||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "包含敏感字");
|
||||
return;
|
||||
}
|
||||
assert sessionByUid != null;
|
||||
MessageUtil.sendIndicationMessage(sessionByUid, 1, MessageTypeProto.MessageType.SEND_CHAT_INFO_INDICATION_VALUE, sendChatInfoIndication, true);
|
||||
}else{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.dataReport.reportBeans_37;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.config.json.SDK37Constans;
|
||||
import com.ljsd.jieling.config.json.ServerProperties;
|
||||
|
@ -12,6 +13,7 @@ import com.ljsd.jieling.util.TimeUtils;
|
|||
import java.util.concurrent.*;
|
||||
|
||||
public class Repot37EventUtil {
|
||||
private static Gson gson = new Gson();
|
||||
|
||||
public static void onKtEvent(User user, Report37EventType eventType, Object... parm) {
|
||||
|
||||
|
@ -66,11 +68,12 @@ public class Repot37EventUtil {
|
|||
report37CheckChat.setContent(parm[1].toString());//内容
|
||||
report37CheckChat.setActor_level(String.valueOf(user.getPlayerInfoManager().getLevel()));
|
||||
report37CheckChat.setActor_recharge_gold(String.valueOf(1));//充值数
|
||||
String signChat =SDK37Constans.appkey+report37CheckChat.getUid()+report37CheckChat.getGid()+report37CheckChat.getDsid()+report37CheckChat.getTime()+report37CheckChat.getType();
|
||||
String signChat =SDK37Constans.chatKey+report37CheckChat.getUid()+report37CheckChat.getGid()+report37CheckChat.getDsid()+report37CheckChat.getTime()+report37CheckChat.getType();
|
||||
report37CheckChat.setSign(MD5Util.encrypByMd5(signChat));
|
||||
System.out.println(gson.toJson(report37CheckChat));
|
||||
JSONObject jsonObject = DataMessageUtils.immediateSendPost(report37CheckChat);
|
||||
T t = jsonObject.toJavaObject(clazz);
|
||||
return t;
|
||||
return t;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -92,7 +95,7 @@ public class Repot37EventUtil {
|
|||
try {
|
||||
Future<Report37Response> future = exec.submit(call);
|
||||
Report37Response response = future.get(1000*2,TimeUnit.MILLISECONDS);
|
||||
if(response.getState()!=0){
|
||||
if(response.getState()==1){
|
||||
return true;
|
||||
}
|
||||
}catch (TimeoutException ex){
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package com.ljsd.jieling.util;
|
||||
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.Repot37EventUtil;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -20,6 +24,13 @@ public class ShieldedWordUtils {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
public static boolean checkName(User user , String name,boolean validateSpecStr){
|
||||
if(!Repot37EventUtil.Report37Chat(user, ChatContentType.WORLD_CHAT.getType(),name)){
|
||||
return false;
|
||||
}
|
||||
return checkName(name,validateSpecStr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 验证用户名,支持中英文(包括全角字符)、数字、下划线和减号 (全角及汉字算两位),长度为4-20位,中文按二位计数
|
||||
|
|
Loading…
Reference in New Issue