时间:整理时间方法

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
+5 -5
View File
@@ -1,5 +1,5 @@
import { BossInstanceType, BossInstanceModel } from '../db/BossInstance';
import { getTodayZeroPoint } from '../pubUtils/timeUtil';
import { getZeroPoint } from '../pubUtils/timeUtil';
import { lockData } from '../services/redLockService';
import { findIndex } from 'underscore';
import { MailModel, MailType } from '../db/Mail';
@@ -25,14 +25,14 @@ export async function getBossInstanceInfo(bossInstance: BossInstanceType, roleId
return b.score - a.score + a.time - b.time;
});
let result:any = {};
if (!!winWarId && winTime > getTodayZeroPoint() && roleIdRecords.indexOf(roleId) == -1) {
if (!!winWarId && winTime > getZeroPoint() && roleIdRecords.indexOf(roleId) == -1) {
//今日通关过,且首次点开boss界面,提示某某boss已通关
result = { showParam: { winWarId, winBossLv } };
await BossInstanceModel.recordRoleIdWhenCheck(guildCode, roleId);
}
if ( bossHp <= 0 ) {
result = { warId };
if (startTime < getTodayZeroPoint()) {
if (startTime < getZeroPoint()) {
//今日未开启过boss,等待开启
result.status = GUILD_BOSS_STATUS.WAIT_OPEN;
return result;
@@ -47,7 +47,7 @@ export async function getBossInstanceInfo(bossInstance: BossInstanceType, roleId
let lastRanks = ranks.map(({roleId: battleRoleId, score, time}, index) => {
if (roleId == battleRoleId) {
myRank = { roleId, score, rankLv: index + 1 };
if (time >= getTodayZeroPoint())
if (time >= getZeroPoint())
isBattled = true;
}
return {roleId, score, rankLv: index + 1};
@@ -80,7 +80,7 @@ export async function getBossInstanceWhenEnd(bossInstance: BossInstanceType, rol
pushRanks.forEach(({roleId: battleRoleId, score, time}, index) => {
if (roleId == battleRoleId) {
myRank = {roleId, score, rankLv: index + 1};
if (time >= getTodayZeroPoint())
if (time >= getZeroPoint())
isBattled = true;
}
return {roleId, score, rankLv: index + 1};