diff --git a/shared/domain/activityField/activityField.ts b/shared/domain/activityField/activityField.ts index 979ea60c3..f4efc38ce 100644 --- a/shared/domain/activityField/activityField.ts +++ b/shared/domain/activityField/activityField.ts @@ -98,10 +98,12 @@ export abstract class ActivityBase { case ACTIVITY_TIME_TYPE.MULT_DATE_TIME: { let now = new Date(); let multiTime = activityData.multiTime||[]; + for(let { id, beginTime, endTime } of multiTime) { if(beginTime <= now && endTime > now) { this.beginTime = beginTime.valueOf(); this.endTime = endTime.valueOf(); + this.nextRefreshTime = this.endTime; this.roundIndex = id; let startOfBeginDay = moment(this.beginTime).startOf('d').add(REFRESH_TIME, 'h'); this.todayIndex = deltaDays(startOfBeginDay.toDate(), new Date) + 1; @@ -114,12 +116,14 @@ export abstract class ActivityBase { break; } } - if (activityData.interval > 0) { - this.roundIndex = Math.ceil((moment(new Date).valueOf() - this.beginTime) / (activityData.interval * 86400000)); - this.nextRefreshTime = moment(this.beginTime).add(activityData.interval * (this.roundIndex - 1), 'day').add(activityData.effectDay, 'd').valueOf(); - this.todayIndex = Math.ceil(((moment(new Date).valueOf() - this.beginTime) / (24 * 60 * 60 * 1000))); - } else { - this.nextRefreshTime = this.endTime; + if(activityData.timeType != ACTIVITY_TIME_TYPE.MULT_DATE_TIME) { + if (activityData.interval > 0) { + this.roundIndex = Math.ceil((moment(new Date).valueOf() - this.beginTime) / (activityData.interval * 86400000)); + this.nextRefreshTime = moment(this.beginTime).add(activityData.interval * (this.roundIndex - 1), 'day').add(activityData.effectDay, 'd').valueOf(); + this.todayIndex = Math.ceil(((moment(new Date).valueOf() - this.beginTime) / (24 * 60 * 60 * 1000))); + } else { + this.nextRefreshTime = this.endTime; + } } if(activityData.hideDayByServer > 0) { let hidOverTime = moment(serverTime * 1000).add(activityData.hideDayByServer, 'd').startOf('d').add(REFRESH_TIME, 'h').valueOf(); @@ -128,6 +132,7 @@ export abstract class ActivityBase { // console.log('活动时间数据...', '活动id:', activityData.activityId, '类型:', activityData.timeType, '开始时间:', this.beginTime, moment(this.beginTime).toDate(), // '结束:', this.endTime, moment(this.endTime).toDate(), // '今天第几天:', this.todayIndex, '回合:', this.roundIndex, '下次刷新:', this.nextRefreshTime, moment(this.nextRefreshTime).toDate()) + console.log('###### roundIndex 1', this.roundIndex) } }