添加天梯排行榜,修复setHour有时差的bug

This commit is contained in:
luying
2020-11-06 17:31:23 +08:00
parent bd93d9dc1c
commit 04ecef03b5
29 changed files with 285 additions and 148 deletions
@@ -4,7 +4,7 @@ import { RoleModel } from '../db/Role';
import { PvpDefenseModel } from '../db/PvpDefense';
import { getWarJsons, getGamedata } from '../pubUtils/gamedata';
import { decodeStr, resResult } from '../pubUtils/util';
import { decodeStr, resResult, setLocalHours } from '../pubUtils/util';
import { WAR_JSON_ATTRIBUTE_TYPE } from '../consts/consts';
@@ -71,7 +71,7 @@ export async function getCEScaleAndRange(roleId: string, curDicExpedition: any)
// 匹配,判断是不是新手期
const role = await RoleModel.findByRoleId(roleId);
let now = new Date();
let today = now.setHours(0,0,0,0);
let today = setLocalHours(0, now);
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;