活动:修改签到时间按照5点计算

This commit is contained in:
qiaoxin
2021-06-03 17:06:59 +08:00
parent fff8ef153d
commit 039360bb97

View File

@@ -1,5 +1,5 @@
import moment = require('moment');
import { ACTIVITY_TYPE, SERVER_OPEN_TIME, SIGNIN_CLOSE, SIGNIN_OPEN } from '../../consts';
import { ACTIVITY_TYPE, REFRESH_TIME, SERVER_OPEN_TIME, SIGNIN_CLOSE, SIGNIN_OPEN } from '../../consts';
import { ActivityModelType } from '../../db/Activity';
import { ActivitySignInModelType } from '../../db/ActivitySignIn';
import { deltaDays } from '../../pubUtils/util';
@@ -63,7 +63,8 @@ export class SignInData extends ActivityBase {
this.beginTime = moment(beginTime).valueOf();
this.endTime = moment(endTime).valueOf();
this.roundIndex = 1;
this.todayIndex = deltaDays(moment(beginTime).startOf('d').toDate(), new Date) + 1;
let date = new Date();
this.todayIndex = Math.ceil((moment(date).valueOf() - this.beginTime) / 24 * 60 * 60 * 1000);
}
public initData(data: string) {
@@ -76,13 +77,13 @@ export class SignInData extends ActivityBase {
this.endDate = dataObj.endDate ? dataObj.endDate : SIGNIN_CLOSE;
let date = new Date();
this.beginTime = moment(date.setDate(this.startDate)).startOf('day').valueOf();
this.endTime = moment(date.setDate(this.endDate)).endOf('day').valueOf();
this.beginTime = moment(date.setDate(this.startDate)).startOf('day').add(REFRESH_TIME, 'h').valueOf();
this.endTime = moment(date.setDate(this.endDate)).endOf('day').add(REFRESH_TIME, 'h').valueOf();
this.roundIndex = moment().diff(moment(SERVER_OPEN_TIME).startOf('months'), 'months') + 1;
if (this.type === ACTIVITY_TYPE.NEW_PLAYER_SIGN_IN) {
this.roundIndex = 1;
}
this.todayIndex = moment(Date.now()).date() - this.startDate + 1;
this.todayIndex = Math.ceil((moment(date).valueOf() - this.beginTime) / 24 * 60 * 60 * 1000);
let arr = dataObj.data
for (let obj of arr) {