开服冲榜活动
parent
ef5c32772d
commit
ef14f61e68
|
@ -50,9 +50,9 @@ public class OpenServerCompeteRankActivity extends AbstractActivity {
|
|||
for (SChongRankInfo rankInfo : rankInfoMap.values()) {
|
||||
int rankType = rankInfo.getRankType();
|
||||
try {
|
||||
long endTime = getEndTime(rankType);
|
||||
ThreadManager.scheduleOne(() -> sendReward(rankType), endTime, TimeUnit.MILLISECONDS);
|
||||
LOGGER.info("===========================冲榜初始化:{}-{}-{}",id,rankType,endTime);
|
||||
long sendTime = getTime(rankType,2) - TimeUtils.now();
|
||||
ThreadManager.scheduleOne(() -> sendReward(rankType), sendTime, TimeUnit.MILLISECONDS);
|
||||
LOGGER.info("===========================冲榜初始化:活动id:{}-排行榜类型:{}-{}毫秒后发送",id,rankType,sendTime);
|
||||
}catch (Exception e){
|
||||
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);
|
||||
SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
if (info == null || activity == null){
|
||||
return 0;
|
||||
}
|
||||
long startTime = ToolsUtil.getTimeLong(activity.getStartTimeLong(),activity.getStartTimeLong(),activity.getTime(),0, 1);
|
||||
return startTime + info.getOpenTime() * 1000L;
|
||||
long activityTime = ToolsUtil.getTimeLong(activity.getStartTimeLong(),activity.getEndTimeLong(),activity.getTime(),0, timeType);
|
||||
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);
|
||||
if (info == null || activity == null){
|
||||
return 0;
|
||||
}
|
||||
long endTime = ToolsUtil.getTimeLong(activity.getStartTimeLong(),activity.getEndTimeLong(),activity.getTime(),0, 2);
|
||||
return endTime + info.getCloseTime() * 1000L - 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
|
||||
|
|
Loading…
Reference in New Issue