diff --git a/serverlogic/src/main/java/com/ljsd/GameApplication.java b/serverlogic/src/main/java/com/ljsd/GameApplication.java index 350f93b8f..62a00b825 100644 --- a/serverlogic/src/main/java/com/ljsd/GameApplication.java +++ b/serverlogic/src/main/java/com/ljsd/GameApplication.java @@ -11,6 +11,7 @@ import com.ljsd.jieling.logic.dao.ServerConfig; import com.ljsd.jieling.logic.rank.CrossRankManager; import com.ljsd.jieling.network.NetManager; import com.ljsd.jieling.util.ConfigurableApplicationContextManager; +import com.ljsd.jieling.util.TaskKit; import config.SGameSetting; import manager.STableManager; import org.slf4j.Logger; @@ -23,6 +24,7 @@ import util.TimeUtils; import java.io.File; import java.util.Scanner; +import java.util.concurrent.TimeUnit; @Configuration @@ -81,7 +83,7 @@ public class GameApplication { } } - private static void setRegisterTime() throws Exception { + public static void setRegisterTime() throws Exception { ServerConfig serverConfigTmp = MongoUtil.getInstence().getMyMongoTemplate().findById(1, ServerConfig.class); if(serverConfigTmp == null){ serverConfigTmp = new ServerConfig(); @@ -112,15 +114,23 @@ public class GameApplication { serverConfigTmp.setRestartTime(TimeUtils.getTimeStamp2(TimeUtils.now())); MongoUtil.getInstence().getMyMongoTemplate().saveWithoutMongoRoot(serverConfigTmp); serverConfig = serverConfigTmp; + LOGGER.info("============================读取数据库serverConfig信息完成"); } + public static void test() { + try { + TaskKit.scheduleWithFixedDelay(()->{ + LOGGER.info("**************当前开服时间:{},缓存:{}",serverConfig.getOpenTime(),TimeUtils.getTimeStamp2(serverConfig.getCacheOpenTime())); + },30,5, TimeUnit.SECONDS); + }catch (Exception e){ + LOGGER.error(e.getMessage()); + } + } public static void close() throws Exception{ start = false; NetManager.getInstance().exit(); ConfigurableApplicationContextManager.getInstance().exit(); - - } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/chat/ChatRedisEntity.java b/serverlogic/src/main/java/com/ljsd/jieling/chat/ChatRedisEntity.java index 1a7e4256e..25ae0ceed 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/chat/ChatRedisEntity.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/chat/ChatRedisEntity.java @@ -19,15 +19,18 @@ public class ChatRedisEntity { private int status; + private String openId; + public ChatRedisEntity(){}; - public ChatRedisEntity(int uid, String name, int type, String message, Long time, int status) { + public ChatRedisEntity(int uid, String name, int type, String message, Long time, int status, String openId) { this.uid = uid; this.name = name; this.type = type; this.message = message; this.time = time; this.status = status; + this.openId = openId; } public int getUid() { @@ -77,4 +80,12 @@ public class ChatRedisEntity { public void setStatus(int status) { this.status = status; } + + public String getOpenId() { + return openId; + } + + public void setOpenId(String openId) { + this.openId = openId; + } } 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 54d5f5744..acf736a31 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 @@ -92,7 +92,7 @@ public class ChatLogic { } break; - case 4: + case 4: //跨服 int group = GlobleSystemLogic.getInstence().getCrossGroup(); if(group==-1){ MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_CHAT_MESSAGE_REPONSE_VALUE, null, true); @@ -263,7 +263,7 @@ public class ChatLogic { if(user.getPlayerInfoManager().getSilence() == 1 || user.getPlayerInfoManager().getSkyEyeBanTime()>System.currentTimeMillis()){ silence = 1; } - ChatRedisEntity chatRedisEntity = new ChatRedisEntity(user.getId(), user.getPlayerInfoManager().getNickName(), chatType, message, TimeUtils.now(), silence); + ChatRedisEntity chatRedisEntity = new ChatRedisEntity(user.getId(), user.getPlayerInfoManager().getNickName(), chatType, message, TimeUtils.now(), silence, user.getPlayerInfoManager().getOpenId()); String chatInfo = gson.toJson(chatRedisEntity); long l = redisUtil.lGetListSize(key); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/kefu/Cmd_reloadserverconfig.java b/serverlogic/src/main/java/com/ljsd/jieling/kefu/Cmd_reloadserverconfig.java new file mode 100644 index 000000000..1a91b2aa6 --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/kefu/Cmd_reloadserverconfig.java @@ -0,0 +1,25 @@ +package com.ljsd.jieling.kefu; + +import com.ljsd.GameApplication; +import com.ljsd.jieling.db.mongo.MongoUtil; +import com.ljsd.jieling.logic.dao.GuilidManager; +import com.ljsd.jieling.logic.dao.PlayerManager; +import com.ljsd.jieling.logic.dao.root.GuildInfo; +import com.ljsd.jieling.logic.dao.root.User; +import com.ljsd.jieling.logic.family.CrossDeathPathLogic; +import config.SGuildSetting; +import util.TimeUtils; + +public class Cmd_reloadserverconfig extends GmAbstract { + + @Override + public boolean exec(String[] args) throws Exception { + return false; + } + + @Override + public String exec2(String[] args) throws Exception { + GameApplication.setRegisterTime(); + return "true"; + } +}