diff --git a/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java index f228f1347..cb235ddab 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java @@ -117,9 +117,9 @@ public class ChatLogic { String s = message; String[] strs = message.split("|",3); if(strs.length==3){ - message = strs[2]; + s = strs[2]; } - result = ShieldedWordUtils.checkName(user,message,false,ChatContentType.WORLD_CHAT); + result = ShieldedWordUtils.checkName(user,s,false,ChatContentType.WORLD_CHAT); break; case 2: result = ShieldedWordUtils.checkName(user,message,false,ChatContentType.FAMILY); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/LoginRequestHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/LoginRequestHandler.java index 1f1c9dc49..974372b53 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/LoginRequestHandler.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/LoginRequestHandler.java @@ -17,6 +17,7 @@ import com.ljsd.jieling.network.session.ISession; import com.ljsd.jieling.protocols.MessageTypeProto; import com.ljsd.jieling.protocols.PlayerInfoProto; import com.ljsd.jieling.util.MessageUtil; +import com.ljsd.jieling.util.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -76,7 +77,11 @@ public class LoginRequestHandler extends BaseHandler items; - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - public String getTime() { - return time; - } - - public void setTime(String time) { - this.time = time; - } - - public int getSeason() { - return season; - } - - public void setSeason(int season) { - this.season = season; - } - - public Map getItems() { - return items; - } - - public void setItems(Map items) { - this.items = items; - } -} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/network/server/ProtocolsManager.java b/serverlogic/src/main/java/com/ljsd/jieling/network/server/ProtocolsManager.java index 7ec7b1e82..ee442af83 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/network/server/ProtocolsManager.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/network/server/ProtocolsManager.java @@ -297,6 +297,8 @@ public class ProtocolsManager implements ProtocolsAbstract { ISession iSession = OnlineUserManager.getSessionByUid(uid); MessageUtil.sendErrorCode(iSession, ErrorCode.reloginCode,"您的账号已经在其他设备上登陆,请确认账号安全!"); iSession.setOfflineType(ErrorCode.reloginCode); + backUpMsgToRedis(iSession); + offLine(iSession); return 1; } return 0; @@ -311,7 +313,7 @@ public class ProtocolsManager implements ProtocolsAbstract { byte[] message = iSession.getCacheMessage(index); if (message==null){ //TODO error - LOGGER.info("the uid={},the msg={} is processing",iSession.getUid(), MessageTypeProto.MessageType.valueOf(packetNetData.getMsgId())); + LOGGER.info("the uid={},the msg={} is processing,the index={},the sessionIndex={}",iSession.getUid(), MessageTypeProto.MessageType.valueOf(packetNetData.getMsgId()),index,iSession.getIndex()); return 1; }else { LOGGER.info("the uid={},the msg={} reback",iSession.getUid(), MessageTypeProto.MessageType.valueOf(packetNetData.getMsgId())); @@ -349,7 +351,6 @@ public class ProtocolsManager implements ProtocolsAbstract { LOGGER.info("player offLine ..."); ISession session = (ISession) gameSession; synchronized (session) { - OnlineUserManager.userOffline(session.getUid()); User user = UserManager.getUserInMem(session.getUid()); if(user == null){ return; @@ -360,6 +361,7 @@ public class ProtocolsManager implements ProtocolsAbstract { if(session.getOfflineType() == ErrorCode.reloginCode){ return; } + OnlineUserManager.userOffline(session.getUid()); if (session.getCtx() != null) { GameMessageHandler.allChannels.remove(session.getCtx().channel()); } @@ -380,14 +382,7 @@ public class ProtocolsManager implements ProtocolsAbstract { ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.OnlineReward,(int)(onlineTime/TimeUtils.ONE_SECOND)); GuildLogic.updateMyPos(user); MongoUtil.getInstence().lastUpdate(); - ConcurrentHashMap indexToIndication = session.getIndexToIndication(); - if(!indexToIndication.isEmpty() ){ - String key = RedisUtil.getInstence().getKey(RedisKey.INDICATION_OFFLINE, Integer.toString(session.getUid())); - RedisUtil.getInstence().set(key,gson.toJson(indexToIndication)); - } - - String key = RedisUtil.getInstence().getKey(RedisKey.RESPONSE_OFFLINE, Integer.toString(session.getUid())); - RedisUtil.getInstence().set(key,gson.toJson(session.getIndexToMessage())); + backUpMsgToRedis(session); // 下线处理的逻辑需要添加在这里 } catch (Exception e) { e.printStackTrace(); @@ -397,6 +392,18 @@ public class ProtocolsManager implements ProtocolsAbstract { } } + private void backUpMsgToRedis(ISession session){ + ConcurrentHashMap indexToIndication = session.getIndexToIndication(); + if(!indexToIndication.isEmpty() ){ + String key = RedisUtil.getInstence().getKey(RedisKey.INDICATION_OFFLINE, Integer.toString(session.getUid())); + RedisUtil.getInstence().set(key,gson.toJson(indexToIndication)); + } + + String key = RedisUtil.getInstence().getKey(RedisKey.RESPONSE_OFFLINE, Integer.toString(session.getUid())); + LOGGER.info("the uid={},the offlineIndex={},",session.getUid(),session.getIndexToMessage().keySet().iterator().next()); + RedisUtil.getInstence().set(key,gson.toJson(session.getIndexToMessage())); + } + public boolean kickOldUser(int uid, String uToken, int errorCode, String errorMsg, long requestTime) { if (GameMessageHandler.currentSessions.size() != 0 && GameMessageHandler.currentSessions.keySet().contains(uid)) {