增加赛季开启类型
parent
5bc5543ce5
commit
4f57f75d6d
|
@ -86,7 +86,8 @@ public class GameApplication {
|
|||
|
||||
//http线程池初始化
|
||||
// HttpPool.init();
|
||||
|
||||
//todo 设置开服时间
|
||||
setRegisterTime();
|
||||
STableManager.initialize("com.ljsd.jieling.config");
|
||||
//mongo异步数据处理线程
|
||||
MongoDataHandlerTask.init(configurableApplicationContext);
|
||||
|
@ -104,25 +105,7 @@ public class GameApplication {
|
|||
|
||||
final NettyServerAutoConfiguration netServerConfig = configurableApplicationContext.getBean(NettyServerAutoConfiguration.class);
|
||||
NettyProperties properties = netServerConfig.getNettyProperties();
|
||||
//todo 设置开服时间
|
||||
ServerConfig serverConfigTmp = MongoUtil.getInstence().getMyMongoTemplate().findById(1, ServerConfig.class);
|
||||
if( null == serverConfigTmp ){
|
||||
serverConfigTmp = new ServerConfig();
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
long serverOenTime = TimeUtils.getAppointTime(0);
|
||||
String format = simpleDateFormat.format(serverOenTime);
|
||||
serverConfigTmp.setOpenTime(format);
|
||||
serverConfigTmp.setCacheOpenTime(serverOenTime);
|
||||
serverConfigTmp.setId(1);
|
||||
serverConfigTmp.setWorldLevel(1);
|
||||
MongoUtil.getInstence().getMyMongoTemplate().saveWithoutMongoRoot(serverConfigTmp);
|
||||
}else{
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String openTime = serverConfigTmp.getOpenTime();
|
||||
Date date = simpleDateFormat.parse(openTime);
|
||||
serverConfigTmp.setCacheOpenTime(date.getTime());
|
||||
}
|
||||
serverConfig = serverConfigTmp;
|
||||
|
||||
KeyGenUtils.setMachineNum(serverConfiguration.getServerProperties().getNum());
|
||||
ActivityLogic.getInstance().checkActiviyStatus();
|
||||
ThriftPoolUtils.getInstance().initContext(configurableApplicationContext);
|
||||
|
@ -148,6 +131,27 @@ public class GameApplication {
|
|||
}
|
||||
}
|
||||
|
||||
private static void setRegisterTime() throws Exception {
|
||||
ServerConfig serverConfigTmp = MongoUtil.getInstence().getMyMongoTemplate().findById(1, ServerConfig.class);
|
||||
if( null == serverConfigTmp ){
|
||||
serverConfigTmp = new ServerConfig();
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
long serverOenTime = TimeUtils.getAppointTime(0);
|
||||
String format = simpleDateFormat.format(serverOenTime);
|
||||
serverConfigTmp.setOpenTime(format);
|
||||
serverConfigTmp.setCacheOpenTime(serverOenTime);
|
||||
serverConfigTmp.setId(1);
|
||||
serverConfigTmp.setWorldLevel(1);
|
||||
MongoUtil.getInstence().getMyMongoTemplate().saveWithoutMongoRoot(serverConfigTmp);
|
||||
}else{
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String openTime = serverConfigTmp.getOpenTime();
|
||||
Date date = simpleDateFormat.parse(openTime);
|
||||
serverConfigTmp.setCacheOpenTime(date.getTime());
|
||||
}
|
||||
serverConfig = serverConfigTmp;
|
||||
}
|
||||
|
||||
private static void close() {
|
||||
|
||||
start = false;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
@ -37,6 +38,8 @@ public class SGlobalSystemConfig implements BaseConfig {
|
|||
|
||||
private int isOpen;
|
||||
|
||||
private int type;
|
||||
|
||||
|
||||
private static Map<Integer,SGlobalSystemConfig> sGlobalSystemConfigMap;
|
||||
|
||||
|
@ -53,8 +56,15 @@ public class SGlobalSystemConfig implements BaseConfig {
|
|||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
sGlobalSystemConfig.setSeasonOpenLong(TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSeasonOpen(), TimeUtils.Stand_CeHua_Data_format));
|
||||
sGlobalSystemConfig.setSeasonEndLong(TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSeasonEnd(), TimeUtils.Stand_CeHua_Data_format));
|
||||
if(2 == sGlobalSystemConfig.getType()){
|
||||
long cacheOpenTime = GameApplication.serverConfig.getCacheOpenTime();
|
||||
sGlobalSystemConfig.setSeasonOpenLong(cacheOpenTime +Integer.parseInt(sGlobalSystemConfig.getSeasonOpen()));
|
||||
sGlobalSystemConfig.setSeasonEndLong(cacheOpenTime +Integer.parseInt(sGlobalSystemConfig.getSeasonEnd()));
|
||||
}else{
|
||||
sGlobalSystemConfig.setSeasonOpenLong(TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSeasonOpen(), TimeUtils.Stand_CeHua_Data_format));
|
||||
sGlobalSystemConfig.setSeasonEndLong(TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSeasonEnd(), TimeUtils.Stand_CeHua_Data_format));
|
||||
}
|
||||
|
||||
sGlobalSystemConfig.setSystemOpenLong(TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSystemOpen(), TimeUtils.Stand_CeHua_Data_format));
|
||||
sGlobalSystemConfig.setSystemEndLong(TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSystemEnd(), TimeUtils.Stand_CeHua_Data_format));
|
||||
}
|
||||
|
@ -135,4 +145,8 @@ public class SGlobalSystemConfig implements BaseConfig {
|
|||
public int getIsOpen() {
|
||||
return isOpen;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue