back_recharge
zhangshanxue 2019-09-16 11:39:17 +08:00
commit e1de5c8050
4 changed files with 25 additions and 55 deletions

View File

@ -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);

View File

@ -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<PlayerInfoProto.LoginReques
KTEnvironmentUtil.addUserSimpleEnviromentInfo(userId,paramEnvironmentSimpleBean);
KTEnvironmentUtil.addUserEnviromentInfo(userId,paramEnvironmentBean);
int pid = Integer.valueOf(loginRequest.getChannelS());
int pid = 0;
if(!StringUtil.isEmpty(loginRequest.getChannelS())){
pid = Integer.valueOf(loginRequest.getChannelS());
}
//登陆注册入内存
String openIdFront = loginRequest.getOpenId();

View File

@ -1,42 +0,0 @@
package com.ljsd.jieling.logic.item;
import java.util.Map;
public class ItemDetail {
private int type;
private String time;
private int season;
private Map<Integer,Integer> 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<Integer, Integer> getItems() {
return items;
}
public void setItems(Map<Integer, Integer> items) {
this.items = items;
}
}

View File

@ -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<Integer, ISession.IndicationMsg> 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<Integer, ISession.IndicationMsg> 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)) {