时间:整理时间方法
This commit is contained in:
@@ -2,7 +2,7 @@ import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop, DocumentType, modelOptions } from '@typegoose/typegoose';
|
||||
import { TASK_FUN_TYPE } from '../consts';
|
||||
import { genCode } from '../pubUtils/util';
|
||||
import { getTodayZeroDate } from '../pubUtils/timeUtil';
|
||||
import { getZeroPointD } from '../pubUtils/timeUtil';
|
||||
|
||||
/**
|
||||
* 玩家任务记录表
|
||||
@@ -34,7 +34,7 @@ export default class UserTaskRec extends BaseModel {
|
||||
received: number[]; // 是否已领取
|
||||
|
||||
private static getRefreshCondition(type: number) {
|
||||
let today = getTodayZeroDate(5);
|
||||
let today = getZeroPointD();
|
||||
|
||||
if(type == TASK_FUN_TYPE.DAILY) {
|
||||
return { type, createdAt: { $gte: today } };
|
||||
@@ -100,7 +100,7 @@ export default class UserTaskRec extends BaseModel {
|
||||
}
|
||||
|
||||
public static async getHistoryRec(roleId: string, type: number, today?: Date) {
|
||||
if(!today) today = getTodayZeroDate(5);
|
||||
if(!today) today = getZeroPointD();
|
||||
let rec: UserTaskRecType[] = await UserTaskRecModel.find({ roleId, type, createdAt: { $lt: today } }).lean();
|
||||
return rec
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user