时间:整理时间方法
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user