时间:整理时间方法
This commit is contained in:
@@ -2,7 +2,7 @@ import * as taskUtil from '../pubUtils/taskUtil';
|
||||
import { RoleType } from '../db/Role';
|
||||
import { pinus, FrontendOrBackendSession } from 'pinus';
|
||||
import { resResult, shouldRefresh } from '../pubUtils/util';
|
||||
import { STATUS, TASK_TYPE, TASK_FUN_TYPE } from '../consts';
|
||||
import { STATUS, TASK_TYPE, TASK_FUN_TYPE, SHOP_REFRESH_TYPE } from '../consts';
|
||||
import { TaskParam, TaskListReturn } from '../domain/roleField/task';
|
||||
import { HeroType } from '../db/Hero';
|
||||
import { EquipType } from '../db/Equip';
|
||||
@@ -13,7 +13,7 @@ import { UserTaskModel, UserTaskType } from '../db/UserTask';
|
||||
import { UserTaskRecModel } from '../db/UserTaskRec';
|
||||
import { UserTaskHistoryModel } from '../db/UserTaskHistory';
|
||||
import { gameData, getGoodById } from '../pubUtils/data';
|
||||
import { getCurWeekDate, getSeconds } from '../pubUtils/timeUtil';
|
||||
import { getSeconds, getZeroPointD } from '../pubUtils/timeUtil';
|
||||
import { RoleStatus } from '../db/ComBattleTeam';
|
||||
|
||||
export async function checkTaskWithRoles(roleId: string, sid: string, funcs: number[], taskType: number, roles: RoleType[]) {
|
||||
@@ -125,14 +125,14 @@ export async function getCurTask(roleId: string, session: FrontendOrBackendSessi
|
||||
let userTask = await UserTaskModel.findByRole(roleId);
|
||||
|
||||
let { dailyTaskRefWeekly, dailyTaskRef } = userTask;
|
||||
let curWeekStart = getCurWeekDate(1, 5);
|
||||
let curWeekStart = getZeroPointD(SHOP_REFRESH_TYPE.WEEKLY);
|
||||
if (dailyTaskRefWeekly < curWeekStart) { // 刷新周宝箱
|
||||
dailyTaskRefWeekly = curWeekStart;
|
||||
}
|
||||
session.set('refWeekly', getSeconds(dailyTaskRefWeekly));
|
||||
session.push('refWeekly', () => { });
|
||||
|
||||
if (shouldRefresh(dailyTaskRef, new Date(), 5)) {
|
||||
if (shouldRefresh(dailyTaskRef, new Date())) {
|
||||
dailyTaskRef = new Date();
|
||||
userTask = await UserTaskModel.updateInfo(roleId, { dailyTaskRef });
|
||||
await removeHistoryTask(roleId, TASK_FUN_TYPE.DAILY);
|
||||
@@ -168,7 +168,7 @@ export async function getMainTask(roleId: string, userTask: UserTaskType) {
|
||||
export async function getDailyTask(roleId: string, userTask: UserTaskType) {
|
||||
let type = TASK_FUN_TYPE.DAILY;
|
||||
let { dailyTaskPoint: point, dailyTaskRefWeekly, dailyTaskPointWeekly: weeklyPoint, dailyTaskBox: box } = userTask;
|
||||
let curWeekStart = getCurWeekDate(1, 5);
|
||||
let curWeekStart = getZeroPointD(SHOP_REFRESH_TYPE.WEEKLY);
|
||||
if (dailyTaskRefWeekly < curWeekStart) { // 刷新
|
||||
dailyTaskRefWeekly = curWeekStart;
|
||||
weeklyPoint = 0;
|
||||
|
||||
Reference in New Issue
Block a user