开服冲榜活动,时间修正
parent
0f18feb57b
commit
3f4ad6acde
|
@ -50,7 +50,7 @@ public class OpenServerCompeteRankActivity extends AbstractActivity {
|
||||||
for (SChongRankInfo rankInfo : rankInfoMap.values()) {
|
for (SChongRankInfo rankInfo : rankInfoMap.values()) {
|
||||||
int rankType = rankInfo.getRankType();
|
int rankType = rankInfo.getRankType();
|
||||||
try {
|
try {
|
||||||
long sendTime = getTime(rankType,2) - TimeUtils.now();
|
long sendTime = getSendTime(rankType);
|
||||||
ThreadManager.scheduleOne(() -> sendReward(rankType), sendTime, TimeUnit.MILLISECONDS);
|
ThreadManager.scheduleOne(() -> sendReward(rankType), sendTime, TimeUnit.MILLISECONDS);
|
||||||
LOGGER.info("===========================冲榜初始化:活动id:{}-排行榜类型:{}-{}毫秒后发送",id,rankType,sendTime);
|
LOGGER.info("===========================冲榜初始化:活动id:{}-排行榜类型:{}-{}毫秒后发送",id,rankType,sendTime);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
@ -75,33 +75,21 @@ public class OpenServerCompeteRankActivity extends AbstractActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取时间
|
* 获取发送时间
|
||||||
* @param rankType 排行榜类型
|
* @param rankType 排行榜类型
|
||||||
* @param timeType 1:开始时间,2:结束时间
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public long getTime(int rankType, int timeType){
|
public long getSendTime(int rankType){
|
||||||
SChongRankInfo info = SChongRankInfo.getMap().getOrDefault(id,new HashMap<>()).get(rankType);
|
SChongRankInfo info = SChongRankInfo.getMap().getOrDefault(id,new HashMap<>()).get(rankType);
|
||||||
SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||||
if (info == null || activity == null){
|
if (info == null || activity == null){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
long activityTime = ToolsUtil.getTimeLong(activity.getStartTimeLong(),activity.getEndTimeLong(),activity.getTime(),0, timeType);
|
long startTime = ToolsUtil.getTimeLong(activity.getStartTimeLong(),activity.getEndTimeLong(),activity.getTime(),0, 1);
|
||||||
int rankTime = timeType==1 ? info.getOpenTime() : info.getCloseTime();
|
long rankEndTime = startTime + info.getCloseTime()*1000L;
|
||||||
return activityTime + rankTime * 1000L;
|
return rankEndTime-TimeUtils.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 排行榜是否开启
|
|
||||||
* @param rankType
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isOpen(int rankType){
|
|
||||||
long start = getTime(rankType, 1);
|
|
||||||
long end = getTime(rankType, 2);
|
|
||||||
long now = TimeUtils.now();
|
|
||||||
return now >= start && now < end;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* 发奖
|
* 发奖
|
||||||
* @param rankType
|
* @param rankType
|
||||||
|
|
Loading…
Reference in New Issue