时间:整理时间方法
This commit is contained in:
@@ -9,6 +9,7 @@ import { ExpeditionWarRecordModel } from '../db/ExpeditionWarRecord';
|
||||
import { HeroType } from '../db/Hero';
|
||||
import { gameData } from '../pubUtils/data';
|
||||
import { getPlayerAttribute, getRobotAttribute } from './pvpService';
|
||||
import { getTimeFunD } from '../pubUtils/timeUtil';
|
||||
|
||||
/**
|
||||
* 根据存下的战力获取当前远征关卡的对手
|
||||
@@ -167,9 +168,8 @@ export async function matchRobots(scale: number, myCe: number, robotCe: number,
|
||||
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 isNew = today - role.createdAt.getTime() <= 3*24*60*60*1000;
|
||||
let timef = getTimeFunD(role.createdAt)
|
||||
let isNew = timef.getDayGap() <= 3;
|
||||
let scale = isNew?curDicExpedition.CEScaleNew:curDicExpedition.CEScale;
|
||||
let range = isNew?curDicExpedition.CERangeNew:curDicExpedition.CERange;
|
||||
return {scale, range, lv: role.lv}
|
||||
@@ -206,7 +206,7 @@ export async function getResetRemainCnt(curTime: Date, roleId: string, role?: Ro
|
||||
}
|
||||
|
||||
let { expeditionResetCnt, expeditionResetRefTime } = role;
|
||||
let needRefresh = !expeditionResetRefTime || shouldRefresh(expeditionResetRefTime, curTime, EXPEDITION_CONST.REFRESH_TIME);
|
||||
let needRefresh = !expeditionResetRefTime || shouldRefresh(expeditionResetRefTime, curTime);
|
||||
if(needRefresh) {
|
||||
expeditionResetCnt = 0; expeditionResetRefTime = curTime;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user