pvp:修改接口
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
|
||||
import { scheduleJob, Job, } from 'node-schedule';
|
||||
import { PVPConfigModel, PVPConfigType } from '../db/SystemConfig';
|
||||
import { nowSeconds, getTimeFun, getZeroPoint } from '../pubUtils/timeUtil';
|
||||
import { nowSeconds, getTimeFun } from '../pubUtils/timeUtil';
|
||||
import { getTodayGuildActivity, gameData } from '../pubUtils/data';
|
||||
import { pvpSeasonEnd } from './pvpService';
|
||||
import { getAllOnlineRoles, getAllServers, delGuildActivityRank } from './redisService';
|
||||
@@ -83,7 +83,7 @@ function getSeasonContinueDay(seasonNum: number) {
|
||||
async function setPvpSeason() {
|
||||
let pvpConfig = await PVPConfigModel.findCurPVPConfig();
|
||||
if(!pvpConfig || pvpConfig.seasonEndTime <= nowSeconds() ) {
|
||||
if(!pvpConfig.hasSettleReward) {
|
||||
if(pvpConfig && !pvpConfig.hasSettleReward) {
|
||||
await pvpSeasonEnd(pvpConfig);
|
||||
}
|
||||
|
||||
@@ -94,9 +94,10 @@ async function setPvpSeason() {
|
||||
let during = getSeasonContinueDay(lastSeasonNum + 1) * PER_DAY;
|
||||
let rewardTime = SETTLE_DIFF_SECONDS;
|
||||
if(nowSeconds() - lastSeasonEndTime > during) {
|
||||
newSeasonStartTime = getZeroPoint();
|
||||
newSeasonStartTime = <number>getTimeFun().getDayZeroPoint(0);
|
||||
}
|
||||
pvpConfig = await PVPConfigModel.createPVPConfig(lastSeasonNum + 1, newSeasonStartTime, newSeasonStartTime + during - rewardTime, newSeasonStartTime + during - PER_MINUTE);
|
||||
let newSeasonNum = await CounterModel.getNewCounter(COUNTER.PVP_SEASON_NUM);
|
||||
pvpConfig = await PVPConfigModel.createPVPConfig(newSeasonNum, newSeasonStartTime, newSeasonStartTime + during - rewardTime, newSeasonStartTime + during - PER_MINUTE);
|
||||
}
|
||||
await setPvpSeasonMakeRewardJob(pvpConfig);
|
||||
await setNextSeasonJob(pvpConfig);
|
||||
@@ -128,7 +129,7 @@ async function setNextSeasonJob(pvpConfig: PVPConfigType) {
|
||||
* @param hour
|
||||
*/
|
||||
export async function resetPvpSeasonTime(hour: number) {
|
||||
await PVPConfigModel.setCurPvpConfig({ seasonEndTime: getZeroPoint() });
|
||||
await PVPConfigModel.setCurPvpConfig({ seasonEndTime: <number>getTimeFun().getDayZeroPoint(0) });
|
||||
return await setPvpSeason();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user