【逐胜之巅优化】功能改为在开服指定天数后开启
parent
ad34283f39
commit
a1aaf10802
|
|
@ -1575,6 +1575,17 @@ public class TimeUtils {
|
|||
return mm;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算两个时间相差的天数
|
||||
* @return
|
||||
*/
|
||||
public static long getGapDaysByTwoTime(String startTime,String endTime){
|
||||
DateTimeFormatter form = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
LocalDate start = LocalDate.parse(startTime, form);
|
||||
long mm = ChronoUnit.DAYS.between(start, LocalDate.parse(endTime, form));
|
||||
return mm;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取时间戳字符串yyyy-MM-dd
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.ljsd.jieling.logic;
|
||||
|
||||
import ch.qos.logback.core.util.TimeUtil;
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.IManager;
|
||||
import com.ljsd.jieling.config.json.KTSDKConstans;
|
||||
|
|
@ -116,6 +117,19 @@ public class GlobalDataManaager implements IManager {
|
|||
closeList.add(id);
|
||||
continue;
|
||||
}
|
||||
//开服几天后开启
|
||||
int[]limitDay = sGlobalSystemConfig.getIfOpen();
|
||||
if(limitDay.length>0 && limitDay != null){
|
||||
if( limitDay[0] == 2 ){
|
||||
//此时是开服第几天
|
||||
long day = TimeUtils.getGapDaysByTwoTime(GameApplication.serverConfig.getOpenTime(),TimeUtils.getTimeStamp2(TimeUtils.now()))+1;
|
||||
if(day < limitDay[1]){
|
||||
closeList.add(id);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long endTime = openTimeOfFuntionCache.get(id).getEndTime();
|
||||
if(now > endTime){
|
||||
closeList.add(id);
|
||||
|
|
@ -132,8 +146,19 @@ public class GlobalDataManaager implements IManager {
|
|||
LOGGER.info("the sGlobalSystemConfig info{},{}",sGlobalSystemConfig.getId(),sGlobalSystemConfig.getSeasonInterval());
|
||||
}
|
||||
|
||||
long mod = passTims % (diffTime + seasonInterval);
|
||||
if(mod < diffTime ){//新的周期开启
|
||||
long mod = passTims % (diffTime + seasonInterval); // 每个周期的时间+间隔时间
|
||||
if(mod < diffTime ){//新的周期开启 一轮周期的时间
|
||||
//开服几天后开启
|
||||
int[]limitDay = sGlobalSystemConfig.getIfOpen();
|
||||
if(limitDay.length>0 && limitDay != null){
|
||||
if( limitDay[0] == 2 ){
|
||||
//此时是开服第几天
|
||||
long day = TimeUtils.getGapDaysByTwoTime(GameApplication.serverConfig.getOpenTime(),TimeUtils.getTimeStamp2(TimeUtils.now()))+1;
|
||||
if(day < limitDay[1]){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
openList.add(id);
|
||||
//计算开启时间、关闭时间
|
||||
long turns = passTims / ((diffTime + seasonInterval));
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class SGlobalSystemConfig implements BaseConfig {
|
|||
|
||||
private int guideId;
|
||||
|
||||
private int[] ifOpen;
|
||||
|
||||
public static Map<Integer, List<Integer>> idsByType;
|
||||
private static Map<Integer,SGlobalSystemConfig> configMap;
|
||||
@Override
|
||||
|
|
@ -153,4 +155,12 @@ public class SGlobalSystemConfig implements BaseConfig {
|
|||
public int getIsIDdSame() {
|
||||
return isIDdSame;
|
||||
}
|
||||
|
||||
public int[] getIfOpen() {
|
||||
return ifOpen;
|
||||
}
|
||||
|
||||
public void setIfOpen(int[] ifOpen) {
|
||||
this.ifOpen = ifOpen;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue