活动:添加开服内多少天隐藏某活动
This commit is contained in:
@@ -13,6 +13,7 @@ export abstract class ActivityBase {
|
||||
type: number = 0;
|
||||
todayIndex: number = 0;//从1开始
|
||||
delayDay: number = 0;//延迟多少天开启,0表示按照原计划开启
|
||||
hideDayByServer: number = 0;
|
||||
|
||||
roundIndex: number = 0;//周期活动第几个周期,从1开始
|
||||
nextRefreshTime: number = 0;//周期活动下次刷新时间
|
||||
@@ -50,6 +51,7 @@ export abstract class ActivityBase {
|
||||
this.activityId = activityData.activityId;
|
||||
this.groupId = activityData.groupId;
|
||||
this.delayDay = activityData.delayDay ? activityData.delayDay : 0;
|
||||
this.hideDayByServer = activityData.hideDayByServer||0;
|
||||
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;
|
||||
@@ -97,6 +99,10 @@ export abstract class ActivityBase {
|
||||
this.nextRefreshTime = moment(this.beginTime).add(activityData.interval * this.roundIndex, 'second').valueOf();
|
||||
this.todayIndex = Math.ceil(((moment(new Date).valueOf() - this.beginTime) / (24 * 60 * 60 * 1000)));
|
||||
}
|
||||
if(activityData.hideDayByServer > 0) {
|
||||
let hidOverTime = moment(serverTime * 1000).add(activityData.hideDayByServer, 'd').startOf('d').add(REFRESH_TIME, 'h').valueOf();
|
||||
if(this.beginTime < hidOverTime) this.beginTime = hidOverTime;
|
||||
}
|
||||
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())
|
||||
@@ -118,6 +124,7 @@ export class ActivityInRemote {
|
||||
days: number; // 活动持续天数 timeType=1、2
|
||||
delayDay: number; // 迟几天开启活动,0表示按照规定时间开启
|
||||
interval: number; // 周期性活动时间间隔,秒
|
||||
hideDayByServer: number;
|
||||
name: string;
|
||||
|
||||
constructor(activity?: ActivityModelType) {
|
||||
@@ -131,6 +138,7 @@ export class ActivityInRemote {
|
||||
this.days = activity.days;
|
||||
this.delayDay = activity.delayDay;
|
||||
this.interval = activity.interval;
|
||||
this.hideDayByServer = activity.hideDayByServer;
|
||||
this.name = activity.name;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user