时间:整理时间方法
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop, DocumentType, modelOptions } from '@typegoose/typegoose';
|
||||
import { getCurWeekDate } from '../pubUtils/timeUtil';
|
||||
import { getZeroPointD } from '../pubUtils/timeUtil';
|
||||
import { SHOP_REFRESH_TYPE } from '../consts';
|
||||
|
||||
/**
|
||||
* 玩家购买商店记录表,每个商品一条,每次刷新新建一条
|
||||
@@ -39,7 +40,7 @@ export default class UserTask extends BaseModel {
|
||||
|
||||
|
||||
public static async findByRole(roleId: string) {
|
||||
let curWeek = getCurWeekDate(1, 5);
|
||||
let curWeek = getZeroPointD(SHOP_REFRESH_TYPE.WEEKLY);
|
||||
let rec: UserTaskType = await UserTaskModel.findOneAndUpdate({ roleId }, { $setOnInsert: {
|
||||
mainTaskStage: 1, dailyTaskPoint: 0, dailyTaskRefWeekly: curWeek, dailyTaskPointWeekly: 0, dailyTaskBox: [], achievementPoint: 0, achievementBox: []
|
||||
} }, { new: true, upsert: true }).lean();
|
||||
@@ -86,7 +87,7 @@ export default class UserTask extends BaseModel {
|
||||
}
|
||||
|
||||
public static async refreshWeekly(roleId: string, debug = false) {
|
||||
let curWeek = getCurWeekDate(1, 5);
|
||||
let curWeek = getZeroPointD(SHOP_REFRESH_TYPE.WEEKLY);
|
||||
let condition = { roleId };
|
||||
if(!debug) {
|
||||
condition['dailyTaskRefWeekly'] = { $lt: curWeek }
|
||||
|
||||
Reference in New Issue
Block a user