活动:随机商店不需要随机的情况判断

This commit is contained in:
qiaoxin
2021-06-30 20:46:15 +08:00
parent 5532d53419
commit 1c330fea03
2 changed files with 8 additions and 5 deletions

View File

@@ -28,6 +28,8 @@ export abstract class ActivityBase {
this.beginTime = moment(activityData.beginTime).add(this.delayDay, 'd').valueOf();
this.endTime = moment(activityData.endTime).add(this.delayDay, 'd').valueOf();
this.todayIndex = deltaDays(moment(this.beginTime).toDate(), new Date) + 1;
this.roundIndex = 1;
this.nextRefreshTime = this.endTime;
this.type = activityData.type;
// console.log('今天是活动第几天', activityData.beginTime, new Date, this.todayIndex)
@@ -66,7 +68,7 @@ export abstract class ActivityBase {
if (activityData.interval > 0) {
this.roundIndex = Math.ceil((moment(new Date).valueOf() - this.beginTime) / (activityData.interval * 1000));
this.nextRefreshTime = moment(this.beginTime).add(activityData.interval * this.roundIndex, 'second').valueOf();
this.todayIndex = Math.ceil(((moment(new Date).valueOf() - this.beginTime) % (activityData.interval * 1000)) / 24 * 60 * 60 * 1000);
this.todayIndex = Math.ceil(((moment(new Date).valueOf() - this.beginTime) % (activityData.interval * 1000)) / (24 * 60 * 60 * 1000));
}
console.log('活动时间数据...', '活动id:', activityData.activityId, '类型:', activityData.timeType, '开始时间:', this.beginTime, moment(this.beginTime).toDate(),
'结束:', this.endTime, moment(this.endTime).toDate(),