发送邮件,踢下线
parent
6baf3711b1
commit
0b211bbed1
|
|
@ -67,8 +67,11 @@ public class GameApplication {
|
|||
serverId = serverProperties.getId();
|
||||
areaId = serverProperties.getId();
|
||||
LOGGER.info("ServerProperties ->{},coreIp=>{}", serverProperties.toString());
|
||||
RedisUtil.getInstence().init(configurableApplicationContext);
|
||||
MongoUtil.getInstence().init(configurableApplicationContext);
|
||||
//注册消息处理方法
|
||||
ProtocolsManager protocolsManager = ProtocolsManager.getInstance();
|
||||
protocolsManager.initCheck();
|
||||
// protocolsManager.initContext();
|
||||
|
||||
// 追加ProtocolsManager消息处理器
|
||||
|
|
@ -77,9 +80,7 @@ public class GameApplication {
|
|||
protocolsManager.addHandler(handler);
|
||||
}
|
||||
|
||||
RedisUtil.getInstence().init(configurableApplicationContext);
|
||||
|
||||
MongoUtil.getInstence().init(configurableApplicationContext);
|
||||
//http线程池初始化
|
||||
// HttpPool.init();
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public class ChatLogic {
|
|||
result= ShieldedWordUtils.checkName(user,message,false,ChatContentType.FAMILY);
|
||||
break;
|
||||
case 3:
|
||||
result = ShieldedWordUtils.checkName(user,message,false,ChatContentType.PRIVATE_CHAT);
|
||||
result = ShieldedWordUtils.checkName(user,message,false,ChatContentType.PRIVATE_CHAT,UserManager.getUser(friendId));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -60,20 +60,27 @@ public class Repot37EventUtil {
|
|||
Report37CheckChat report37CheckChat = new Report37CheckChat();
|
||||
report37CheckChat.setTime((int)(TimeUtils.now()/1000));
|
||||
report37CheckChat.setChat_time(String.valueOf(TimeUtils.now()/1000));
|
||||
report37CheckChat.setUid(String.valueOf(user.getId()));//uid
|
||||
report37CheckChat.setUid(String.valueOf(user.getPlayerInfoManager().getOpenId()));//uid
|
||||
report37CheckChat.setActor_name(user.getPlayerInfoManager().getNickName());
|
||||
report37CheckChat.setGid(SDK37Constans.gid);
|
||||
report37CheckChat.setPid(SDK37Constans.pid);
|
||||
report37CheckChat.setDsid(String.valueOf(GameApplication.serverId));
|
||||
report37CheckChat.setType(parm[0].toString());//类型
|
||||
report37CheckChat.setContent(parm[1].toString());//内容
|
||||
report37CheckChat.setActor_level(String.valueOf(user.getPlayerInfoManager().getLevel()));
|
||||
report37CheckChat.setActor_recharge_gold(String.valueOf(1));//充值数
|
||||
report37CheckChat.setActor_recharge_gold(String.valueOf(0));//充值数
|
||||
if(parm.length>2){
|
||||
report37CheckChat.setTo_uid(String.valueOf(parm[2]));
|
||||
}
|
||||
if(parm.length>3){
|
||||
report37CheckChat.setTo_actor_name(String.valueOf(parm[3]));
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ public class RedisKey {
|
|||
public static final String FAMILY_ID = "FAMILY_ID";
|
||||
|
||||
public static final String FAMILY_FIGHT = "FAMILY_FIGHT" ;
|
||||
public static final String FAMILY_ATTACK_RECORD = "FAMILY_ATTACK_RECORD";
|
||||
public static final String FAMILY_FIGHT_RANK = "FAMILY_FIGHT_RANK";
|
||||
public static final String FAMILY_FIGHT_MATCHING_RANK ="FAMILY_FIGHT_MATCHING_RANK";
|
||||
//公会战进攻获得星数排行榜
|
||||
|
|
@ -126,8 +127,11 @@ public class RedisKey {
|
|||
public static final String FAMILY_FIGHT_BUFF = "FAMILY_FIGHT_BUFF";
|
||||
//公会战进攻次数缓存
|
||||
public static final String FAMILY_FIGHT_ATTACK_COUNT = "FAMILY_FIGHT_ATTACK_COUNT";
|
||||
|
||||
//给用户发送邮件
|
||||
public static final String READY_TO_USER_MAIL = "READY_TO_USER_MAIL";
|
||||
//把用户踢下线
|
||||
public static final String FORBID_LOGIN = "FORBID_LOGIN";
|
||||
|
||||
|
||||
public static final String OPERATE_FAMILY = "OPERATE_FAMILY";
|
||||
public static final String OPERATE_FAMILY_APPLY = "OPERATE_FAMILY_APPLY";
|
||||
|
|
|
|||
|
|
@ -806,5 +806,6 @@ public class GuildLogic {
|
|||
public static void changeFamilyIcon(ISession session, int iconId, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
PlayerManager playerInfoManager = UserManager.getUser(session.getUid()).getPlayerInfoManager();
|
||||
GuilidManager.guildInfoMap.get(playerInfoManager.getGuildId()).updateIcon(iconId);
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
public static Map<MessageTypeProto.MessageType, String> gameMessageForLogin = new ConcurrentHashMap<>();
|
||||
private Map<Integer, BaseHandler> handlers = new HashMap<>();
|
||||
|
||||
private static Set<Integer> forbidLogin = new HashSet<>();
|
||||
public final int HANDLER_THREAD_NUM = 50;
|
||||
public HandlerLogicThread[] handlerThreads = new HandlerLogicThread[HANDLER_THREAD_NUM];
|
||||
|
||||
|
|
@ -81,6 +82,10 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
}
|
||||
}
|
||||
|
||||
public void initCheck(){
|
||||
minuteCheckForbidUser();
|
||||
}
|
||||
|
||||
public static ProtocolsManager getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
|
@ -177,6 +182,7 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
dealRepeatLogin(session.getUid());
|
||||
//刷新token
|
||||
refreshToken(session);
|
||||
//踢下线
|
||||
//在线列表加入session
|
||||
OnlineUserManager.userOnline(session.getUid(),session);
|
||||
}
|
||||
|
|
@ -197,6 +203,10 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
if (checkIndex(session,packetNetData) != 0){
|
||||
return;
|
||||
}
|
||||
boolean b = checkForbidUser(session);
|
||||
if(b){
|
||||
return;
|
||||
}
|
||||
//LOGGER.info("process the uid={},the msg={},the index={}",packetNetData.getUserId(), MessageTypeProto.MessageType.valueOf(packetNetData.getMsgId()),packetNetData.getIndex());
|
||||
BaseHandler baseHandler = handlers.get(packetNetData.getMsgId());
|
||||
if (baseHandler == null) {
|
||||
|
|
@ -411,5 +421,30 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
}
|
||||
|
||||
|
||||
public boolean checkForbidUser(ISession iSession){
|
||||
if(forbidLogin.size()<1){
|
||||
return false;
|
||||
}
|
||||
if(iSession!=null) {
|
||||
if(forbidLogin.contains(iSession.getUid())){
|
||||
MessageUtil.sendErrorCode(iSession, ErrorCode.reloginCode, "您已被踢下线!");
|
||||
iSession.setOfflineType(ErrorCode.reloginCode);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void minuteCheckForbidUser(){
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
String key = RedisKey.getKey(RedisKey.FORBID_LOGIN, "", false);
|
||||
if(!redisUtil.hasKey(key)){
|
||||
return;
|
||||
}
|
||||
Map<Integer, Integer> forbidMap = redisUtil.getMapValues(RedisKey.FORBID_LOGIN, "", Integer.class, Integer.class);
|
||||
if(forbidMap==null||forbidMap.size()<1){
|
||||
return;
|
||||
}
|
||||
forbidLogin = forbidMap.keySet();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import com.ljsd.jieling.logic.fight.CheckFight;
|
|||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
@ -53,6 +54,7 @@ public class MinuteTask extends Thread {
|
|||
MongoUtil.getInstence().lastUpdate();
|
||||
GuildFightLogic.familyFightStatus();
|
||||
MailLogic.getInstance().checkReadyToMail();
|
||||
ProtocolsManager.getInstance().minuteCheckForbidUser();
|
||||
LOGGER.info("MinuteTask end...");
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("e",e);
|
||||
|
|
|
|||
|
|
@ -9,11 +9,29 @@ import java.util.regex.Pattern;
|
|||
|
||||
public class ShieldedWordUtils {
|
||||
|
||||
// public static boolean checkName(String name,boolean validateSpecStr){
|
||||
//
|
||||
// }
|
||||
public static boolean checkName(User user , String name,boolean validateSpecStr,ChatContentType chatContentType,User friend) {
|
||||
if(friend!=null){
|
||||
if(!Repot37EventUtil.Report37Chat(user, chatContentType.getType(),name,friend.getPlayerInfoManager().getOpenId(),friend.getPlayerInfoManager().getNickName())){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
boolean result = true;
|
||||
if(validateSpecStr){
|
||||
result = validateUserName(name);
|
||||
if(!result){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
result = isContaintSensitiveWord(name);
|
||||
if(result){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
public static boolean checkName(User user , String name,boolean validateSpecStr,ChatContentType chatContentType){
|
||||
if(!Repot37EventUtil.Report37Chat(user, ChatContentType.WORLD_CHAT.getType(),name)){
|
||||
if(!Repot37EventUtil.Report37Chat(user, chatContentType.getType(),name)){
|
||||
return false;
|
||||
}
|
||||
boolean result = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue