移除 setLocalHours

This commit is contained in:
luying
2021-01-12 20:23:25 +08:00
parent 94ce1fc5dc
commit 08d31ffb8d
4 changed files with 10 additions and 18 deletions
+3 -3
View File
@@ -2,7 +2,7 @@ import { FrontendOrBackendSession, pinus } from 'pinus';
import { getGamedata } from '../pubUtils/gamedata';
import EventRecord, { EventRecordModel } from '../db/EventRecord';
import { RoleModel } from '../db/Role';
import { genCode, decodeStrSingle, decodeStr, getRandomWithWeight, resResult, setLocalHours } from '../pubUtils/util';
import { genCode, decodeStrSingle, decodeStr, getRandomWithWeight, resResult } from '../pubUtils/util';
import { EVENT_STATUS, EVENT_RECORD_STATUS, EVENT_TYPE, EVENT_RANDOM_TYPE_ONE_OPEN, EVENT_QUIZ_NUM, EVENT_ANSWER_STATUS, FUNCS_ID } from '../consts';
import { EVENT_REFRESH_NUM } from '../consts';
import { STATUS } from '../consts/statusCode';
@@ -61,8 +61,8 @@ export async function setBattleStatus(session: FrontendOrBackendSession, roleId:
*/
export function getEventTime(now: Date) {
let curTime = Number(now);
let todayA = setLocalHours(12, now); // 每天12点
let todayB = setLocalHours(18, now); // 每天18点
let todayA = now.setHours(12, 0, 0, 0); // 每天12点
let todayB = now.setHours(18, 0, 0, 0); // 每天18点
let yesterdayB = todayB - 86400000; // 前一天12点
let t = 0;
if(curTime < todayA) {
@@ -4,7 +4,7 @@ import Role, { RoleModel, RoleType } from '../db/Role';
import { PvpDefenseModel } from '../db/PvpDefense';
import { getWarJsons, getGamedata, getExpeditionById } from '../pubUtils/gamedata';
import { decodeStr, resResult, setLocalHours, shouldRefresh } from '../pubUtils/util';
import { decodeStr, resResult, shouldRefresh } from '../pubUtils/util';
import { EXPEDITION_CONST, HERO_CE_RATIO, getAttrCeRatio } from '../consts';
import { getAtrrNameById} from '../consts';
import { ExpeditionWarRecordModel } from '../db/ExpeditionWarRecord';
@@ -149,7 +149,7 @@ export async function getCEScaleAndRange(roleId: string, curDicExpedition: any)
// 匹配,判断是不是新手期
const role = await RoleModel.findByRoleId(roleId);
let now = new Date();
let today = setLocalHours(0, now);
let today = now.setHours(0, 0, 0, 0);;
let isNew = today - role.createdAt.getTime() <= 3*24*60*60*1000;
let scale = isNew?curDicExpedition.CEScaleNew:curDicExpedition.CEScale;
let range = isNew?curDicExpedition.CERangeNew:curDicExpedition.CERange;