mail reward
parent
a1c4640fcf
commit
7c537afd21
|
@ -191,10 +191,6 @@ public class CombatLogic {
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
long nowMs = TimeUtils.now();
|
long nowMs = TimeUtils.now();
|
||||||
AdventureManager adventureManager = user.getAdventureManager();
|
AdventureManager adventureManager = user.getAdventureManager();
|
||||||
if(adventureManager.getFlushBossTime()>nowMs){
|
|
||||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_FLUSH_BOSS_RESPONSE_VALUE,"cold time");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int now = (int)(nowMs/1000);
|
int now = (int)(nowMs/1000);
|
||||||
int flushBossNextTime = -1;
|
int flushBossNextTime = -1;
|
||||||
FightInfoProto.AdventureBossFlushResponse.Builder builder = FightInfoProto.AdventureBossFlushResponse.newBuilder();
|
FightInfoProto.AdventureBossFlushResponse.Builder builder = FightInfoProto.AdventureBossFlushResponse.newBuilder();
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
package com.ljsd.jieling.thread;
|
package com.ljsd.jieling.thread;
|
||||||
|
|
||||||
import com.ljsd.jieling.thread.task.DailyOfZeroTask;
|
|
||||||
import com.ljsd.jieling.thread.task.MinuteTask;
|
import com.ljsd.jieling.thread.task.MinuteTask;
|
||||||
import com.ljsd.jieling.thread.task.PlatConfigureTask;
|
import com.ljsd.jieling.thread.task.PlatConfigureTask;
|
||||||
import com.ljsd.jieling.util.TimeUtils;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -68,27 +65,10 @@ public class ThreadManager {
|
||||||
|
|
||||||
// testTask 已秒为单位 延迟10s, 间隔30s为周期执行
|
// testTask 已秒为单位 延迟10s, 间隔30s为周期执行
|
||||||
int delayForMinute = 60 - (now%60);
|
int delayForMinute = 60 - (now%60);
|
||||||
int delayForDay = getDiffZeroTimeSecond(now);
|
|
||||||
LOGGER.info("delayForMinute---->>>>{}" ,delayForMinute);
|
LOGGER.info("delayForMinute---->>>>{}" ,delayForMinute);
|
||||||
LOGGER.info("delayForDay---->>>>{}" ,delayForMinute);
|
|
||||||
scheduledExecutor.scheduleAtFixedRate(platConfigureTask, 10, PlatConfigureTask.SLEEP_INTEVAL_TIME, TimeUnit.SECONDS);
|
scheduledExecutor.scheduleAtFixedRate(platConfigureTask, 10, PlatConfigureTask.SLEEP_INTEVAL_TIME, TimeUnit.SECONDS);
|
||||||
scheduledExecutor.scheduleAtFixedRate(new MinuteTask(), delayForMinute, 60, TimeUnit.SECONDS);
|
scheduledExecutor.scheduleAtFixedRate(new MinuteTask(), delayForMinute, 60, TimeUnit.SECONDS);
|
||||||
scheduledExecutor.scheduleAtFixedRate(new DailyOfZeroTask(), delayForDay, 3600*24, TimeUnit.SECONDS);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScheduledThreadPoolExecutor getScheduledExecutor() {
|
|
||||||
return scheduledExecutor;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getDiffZeroTimeSecond(int now){
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.set(Calendar.DAY_OF_YEAR,calendar.get(Calendar.DAY_OF_YEAR) + 1);
|
|
||||||
calendar.set(Calendar.MINUTE,0);
|
|
||||||
calendar.set(Calendar.MILLISECOND,0);
|
|
||||||
calendar.set(Calendar.HOUR,0);
|
|
||||||
calendar.set(Calendar.SECOND,0);
|
|
||||||
long time = calendar.getTime().getTime();
|
|
||||||
return (int)(time / 1000) - now;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
package com.ljsd.jieling.thread.task;
|
|
||||||
|
|
||||||
import com.ljsd.jieling.core.GlobalsDef;
|
|
||||||
import com.ljsd.jieling.logic.arena.ArenaLogic;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
public class DailyOfZeroTask extends Thread {
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(DailyOfZeroTask.class);
|
|
||||||
|
|
||||||
public DailyOfZeroTask() {
|
|
||||||
this.setName("DailyOfZeroTask");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
LOGGER.info("DailyOfZeroTask start ...");
|
|
||||||
ArenaLogic.getInstance().sendReward(GlobalsDef.ARENA_DAILY_REWARD);
|
|
||||||
LOGGER.info("DailyOfZeroTask end ...");
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.info("e",e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,11 +1,16 @@
|
||||||
package com.ljsd.jieling.thread.task;
|
package com.ljsd.jieling.thread.task;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.core.GlobalsDef;
|
||||||
import com.ljsd.jieling.handler.map.MapLogic;
|
import com.ljsd.jieling.handler.map.MapLogic;
|
||||||
import com.ljsd.jieling.logic.GlobalDataManaager;
|
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||||
|
import com.ljsd.jieling.logic.arena.ArenaLogic;
|
||||||
|
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
public class MinuteTask extends Thread {
|
public class MinuteTask extends Thread {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(MinuteTask.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(MinuteTask.class);
|
||||||
|
|
||||||
|
@ -21,9 +26,35 @@ public class MinuteTask extends Thread {
|
||||||
ActivityLogic.getInstance().checkSecretBoxSeason();
|
ActivityLogic.getInstance().checkSecretBoxSeason();
|
||||||
MapLogic.getInstance().minuteCheckAndRemoveMapRank();
|
MapLogic.getInstance().minuteCheckAndRemoveMapRank();
|
||||||
GlobalDataManaager.getInstance().checkSystemFunctioIsOpen();
|
GlobalDataManaager.getInstance().checkSystemFunctioIsOpen();
|
||||||
|
everyZeroTask();
|
||||||
|
everyMondyFiveClockTask();
|
||||||
LOGGER.info("MinuteTask end...");
|
LOGGER.info("MinuteTask end...");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("e",e);
|
LOGGER.error("e",e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//每日凌晨执行
|
||||||
|
public void everyZeroTask() throws Exception {
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
int hour = calendar.get(Calendar.HOUR_OF_DAY);
|
||||||
|
int minute = calendar.get(Calendar.MINUTE);
|
||||||
|
if(hour == 0 && minute ==0){
|
||||||
|
LOGGER.info("DailyOfZeroTask start ...");
|
||||||
|
ArenaLogic.getInstance().sendReward(GlobalsDef.ARENA_DAILY_REWARD);
|
||||||
|
LOGGER.info("DailyOfZeroTask end ...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//每周一凌晨五点执行
|
||||||
|
public void everyMondyFiveClockTask() throws Exception {
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
int hour = calendar.get(Calendar.HOUR_OF_DAY);
|
||||||
|
int minute = calendar.get(Calendar.MINUTE);
|
||||||
|
if(hour == 5 && minute ==0){
|
||||||
|
LOGGER.info("everyMondyFiveClockTask start ...");
|
||||||
|
CombatLogic.getInstance().sendReward();
|
||||||
|
LOGGER.info("everyMondyFiveClockTask end ...");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue