时间:整理时间方法

This commit is contained in:
luying
2021-05-08 19:09:51 +08:00
parent 6f03a96c51
commit 78e3c26a7a
51 changed files with 662 additions and 411 deletions

View File

@@ -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
}