时间:整理时间方法

This commit is contained in:
luying
2021-05-08 19:13:44 +08:00
parent 6f03a96c51
commit 78e3c26a7a
51 changed files with 662 additions and 411 deletions
+2 -2
View File
@@ -1,6 +1,7 @@
import BaseModel from './BaseModel';
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
import { DAILY_CONST } from './../consts';
import { getZeroPoint } from '../pubUtils/timeUtil';
/**
@@ -28,8 +29,7 @@ export default class DailyRecord extends BaseModel {
public static async refreshRecord(roleId: string, type: number, lean = true) {
const dailyRecord: DailyRecordType = await DailyRecordModel.findOne({ roleId, type }).lean(lean);
let {count = 0, refTime = 0, buyCount = 0} = dailyRecord||{};
let now = new Date();
let today = now.setHours(DAILY_CONST.REFRESH_TIME, 0, 0, 0);
let today = getZeroPoint();
if(today > refTime) {
refTime = today; count = 0; buyCount = 0;