活动:限时排行榜
This commit is contained in:
@@ -6,6 +6,7 @@ import { deltaDays } from '../../pubUtils/util';
|
||||
// 活动数据
|
||||
export abstract class ActivityBase {
|
||||
activityId: number = 0;
|
||||
name: string = '';
|
||||
beginTime: number = 0;
|
||||
endTime: number = 0;
|
||||
type: number = 0;
|
||||
@@ -23,9 +24,27 @@ export abstract class ActivityBase {
|
||||
}
|
||||
|
||||
public canShow() {
|
||||
console.log('#### canShow', this.beginTime <= Date.now(), this.endTime >= Date.now())
|
||||
return this.beginTime <= Date.now() && this.endTime >= Date.now()
|
||||
}
|
||||
|
||||
/**
|
||||
* getBaseKeys
|
||||
*/
|
||||
public getBaseKeys() {
|
||||
return {
|
||||
activityId: this.activityId,
|
||||
name: this.name,
|
||||
beginTime: this.beginTime,
|
||||
endTime: this.endTime,
|
||||
type: this.type,
|
||||
todayIndex: this.todayIndex,
|
||||
delayDay: this.delayDay,
|
||||
roundIndex: this.roundIndex,
|
||||
nextRefreshTime: this.nextRefreshTime,
|
||||
}
|
||||
}
|
||||
|
||||
constructor(activityData: ActivityModelType, createTime: number) {
|
||||
this.activityId = activityData.activityId;
|
||||
this.delayDay = activityData.delayDay ? activityData.delayDay : 0;
|
||||
@@ -34,6 +53,7 @@ export abstract class ActivityBase {
|
||||
this.todayIndex = deltaDays(moment(this.beginTime).toDate(), new Date) + 1;
|
||||
this.roundIndex = 1;
|
||||
this.nextRefreshTime = this.endTime;
|
||||
this.name = activityData.name;
|
||||
|
||||
this.type = activityData.type;
|
||||
console.log('今天是活动第几天', activityData.beginTime, new Date, this.todayIndex)
|
||||
|
||||
Reference in New Issue
Block a user