时间:整理时间方法

This commit is contained in:
luying
2021-05-08 19:13:44 +08:00
parent 6f03a96c51
commit 78e3c26a7a
51 changed files with 662 additions and 411 deletions
+4 -4
View File
@@ -4,12 +4,12 @@ import { RoleType } from '../db/Role';
import { PVP_HERO_POS, REDIS_KEY, PVP_CONST } from '../consts';
import { setPvpDefResult } from '../services/timeTaskService';
import { dicPvpOpponent, DicPvpOpponent } from "../pubUtils/dictionary/DicPvpOpponent";
import { getRandSingleIndex, genCode, shouldRefresh, reduceCe, getChineseName } from '../pubUtils/util';
import { getRandSingleIndex, genCode, shouldRefresh, getChineseName } from '../pubUtils/util';
import { oppPlayersInter, pvpEndParamInter } from '../pubUtils/interface';
import { gameData, getPLvByScore } from "../pubUtils/data";
import { PVP } from '../pubUtils/dicParam';
import { SystemConfigModel } from '../db/SystemConfig'
import { nowSeconds, checkTodayTime } from '../pubUtils/timeUtil';
import { nowSeconds, getTimeFun } from '../pubUtils/timeUtil';
import { HeroesRecord } from '../db/PvpRecord';
import { HeroModel } from '../db/Hero';
import { MainAttrNumber, Attribute, CeAttrData, CeAttrDataRole } from '../domain/roleField/attribute';
@@ -405,7 +405,7 @@ export function refresh(challengeCnt: number, challengeRefTime: number, seasonEn
return {challengeCnt, challengeRefTime};
}
let period = PVP.PVP_CHALLENGE_NORMALTIMES * 60;
if (checkTodayTime(seasonEndTime)) {
if (getTimeFun(seasonEndTime).checkDay()) {
period = PVP.PVP_CHALLENGE_FINALTIMES * 60;
}
let time = nowSeconds();
@@ -452,7 +452,7 @@ export async function findPvpDefByRoleId(roleId: string) {
// 获取刷新对手次数及消耗
export function getRefOppCnt(refOppCnt: number, refOppTime: Date) {
let curTime = new Date();
let shouldRefOpp = shouldRefresh(refOppTime, curTime, PVP_CONST.REFRESH_TIME);
let shouldRefOpp = shouldRefresh(refOppTime, curTime);
if(shouldRefOpp) {
refOppCnt = 0; refOppTime = curTime;
}