开服冲榜活动
parent
ef5c32772d
commit
ef14f61e68
|
@ -50,9 +50,9 @@ 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 endTime = getEndTime(rankType);
|
long sendTime = getTime(rankType,2) - TimeUtils.now();
|
||||||
ThreadManager.scheduleOne(() -> sendReward(rankType), endTime, TimeUnit.MILLISECONDS);
|
ThreadManager.scheduleOne(() -> sendReward(rankType), sendTime, TimeUnit.MILLISECONDS);
|
||||||
LOGGER.info("===========================冲榜初始化:{}-{}-{}",id,rankType,endTime);
|
LOGGER.info("===========================冲榜初始化:活动id:{}-排行榜类型:{}-{}毫秒后发送",id,rankType,sendTime);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
LOGGER.error("冲榜初始化异常,id:{},type:{}",id, rankType);
|
LOGGER.error("冲榜初始化异常,id:{},type:{}",id, rankType);
|
||||||
}
|
}
|
||||||
|
@ -74,26 +74,34 @@ public class OpenServerCompeteRankActivity extends AbstractActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getStartTime(int rankType){
|
/**
|
||||||
|
* 获取时间
|
||||||
|
* @param rankType 排行榜类型
|
||||||
|
* @param timeType 1:开始时间,2:结束时间
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public long getTime(int rankType, int timeType){
|
||||||
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 startTime = ToolsUtil.getTimeLong(activity.getStartTimeLong(),activity.getStartTimeLong(),activity.getTime(),0, 1);
|
long activityTime = ToolsUtil.getTimeLong(activity.getStartTimeLong(),activity.getEndTimeLong(),activity.getTime(),0, timeType);
|
||||||
return startTime + info.getOpenTime() * 1000L;
|
int rankTime = timeType==1 ? info.getOpenTime() : info.getCloseTime();
|
||||||
|
return activityTime + rankTime * 1000L;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getEndTime(int rankType){
|
/**
|
||||||
SChongRankInfo info = SChongRankInfo.getMap().getOrDefault(id,new HashMap<>()).get(rankType);
|
* 排行榜是否开启
|
||||||
SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
* @param rankType
|
||||||
if (info == null || activity == null){
|
* @return
|
||||||
return 0;
|
*/
|
||||||
}
|
public boolean isOpen(int rankType){
|
||||||
long endTime = ToolsUtil.getTimeLong(activity.getStartTimeLong(),activity.getEndTimeLong(),activity.getTime(),0, 2);
|
long start = getTime(rankType, 1);
|
||||||
return endTime + info.getCloseTime() * 1000L - TimeUtils.now();
|
long end = getTime(rankType, 2);
|
||||||
|
long now = TimeUtils.now();
|
||||||
|
return now >= start && now < end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发奖
|
* 发奖
|
||||||
* @param rankType
|
* @param rankType
|
||||||
|
|
Loading…
Reference in New Issue