活动:修复今日挑战

This commit is contained in:
luying
2022-08-21 18:12:03 +08:00
parent b0abc4660f
commit ba9945a54e
3 changed files with 21 additions and 7 deletions
+5 -5
View File
@@ -103,7 +103,7 @@ class Time {
*/
private _getDayZeroPoint(time: Date, hour = REFRESH_TIME, minute = 0, seconds = 0) {
let t = this._setHour(time.getTime(), hour, minute, seconds);
if(this.now > t) {
if(time >= t) {
return t;
} else {
return new Date(t.getTime() - this.DAY_TO_MS);
@@ -253,7 +253,7 @@ class Time {
*/
public getWeekZeroPoint(day: number = 1, hour = REFRESH_TIME, minute = 0, seconds = 0) {
let t = this._getTimeWithWeek(this.time, day, hour, minute, seconds);
if(this.now > t) {
if(this.time >= t) {
return this._returnResult(t);
} else {
return this._returnResult(t.getTime() - this.WEEK_TO_MS);
@@ -269,7 +269,7 @@ class Time {
*/
public getMonthZeroPoint(day: number = 1, hour = REFRESH_TIME, minute = 0, seconds = 0) {
let t = this._getTimeWithMonth(this.time, day, hour, minute, seconds);
if(this.now > t) {
if(this.time >= t) {
return this._returnResult(t);
} else {
let tt = this._getBeforeMonthWithDay(this.time, 1, day, hour, minute, seconds);
@@ -286,7 +286,7 @@ class Time {
*/
public getBeforeDayWithHour(day: number = 0, hour = REFRESH_TIME, minute = 0, seconds = 0) {
let t = this._setHour(this.time.getTime(), hour, minute, seconds);
if(this.time > t) {
if(this.time >= t) {
let timestamp = t.getTime() - day * this.DAY_TO_MS;
return this._returnResult(timestamp);
} else {
@@ -305,7 +305,7 @@ class Time {
public getAfterDayWithHour(day: number = 0, hour = REFRESH_TIME, minute = 0, seconds = 0) {
let t = this._setHour(this.time.getTime(), hour, minute, seconds, 0);
// console.log(t.getTime(), this.time.getTime());
if(this.time.getTime() > t.getTime()) {
if(this.time.getTime() >= t.getTime()) {
let timestamp = t.getTime() + (day + 1) * this.DAY_TO_MS;
return this._returnResult(timestamp);
} else {
+4 -2
View File
@@ -8,7 +8,7 @@ const path = require('path');
import { ABI_STAGE, REFRESH_TIME, ROBOT_SYS_TYPE, ITEM_CHANGE_REASON, WAR_TYPE, SHOP_REFRESH_TYPE, GACHA_TYPE, GACHA_FLOOR_TYPE } from '../consts';
import { findIndex } from 'underscore';
import { getZeroPointD } from './timeUtil';
import { getZeroPointD, getZeroPointOfTimeD } from './timeUtil';
import { Floor } from '../domain/activityField/gachaField';
import { RewardInter } from './interface';
import { gameData } from './data';
@@ -119,7 +119,9 @@ export function decodeIdCntArrayStr(str: string, multi: number) {
* @param proTime 之后的时间
*/
export function deltaDays(preTime: Date, proTime: Date): number {
return moment(proTime).diff(moment(preTime), "days");
let beginZeroPoint = getZeroPointOfTimeD(preTime);
let endZeroPoint = getZeroPointOfTimeD(proTime);
return moment(endZeroPoint).diff(moment(beginZeroPoint), "days");
}
/**