活动:修复七天乐任务

This commit is contained in:
luying
2021-12-24 15:01:09 +08:00
parent f686046822
commit dc00431010
5 changed files with 68 additions and 18 deletions

View File

@@ -76,3 +76,47 @@ export abstract class ActivityBase {
'今天第几天:', this.todayIndex, '回合:', this.roundIndex, '下次刷新:', this.nextRefreshTime, moment(this.nextRefreshTime).toDate())
}
}
/**
* 存在内存内的活动
*/
export class ActivityInRemote {
groupId: number; // 组Id
activityId: number; // 活动Id
beginTime: number; // 开启时间 timeType=3
endTime: number; // 结束时间 timeType=3
type: number; // 活动类型
data: string; // 活动表中的数据
timeType: number; // 活动时间类型 ACTIVITY_TIME_TYPE 1.服务器开启时间 2.角色创建时间 3.指定开启时间(beginTime,endTime)
days: number; // 活动持续天数 timeType=1、2
delayDay: number; // 迟几天开启活动0表示按照规定时间开启
interval: number; // 周期性活动时间间隔,秒
constructor(activity?: ActivityModelType) {
this.groupId = activity.groupId;
this.activityId = activity.activityId;
this.beginTime = activity.beginTime.getTime();
this.endTime = activity.endTime.getTime();
this.type = activity.type;
this.data = activity.data;
this.timeType = activity.timeType;
this.days = activity.days;
this.delayDay = activity.delayDay;
this.interval = activity.interval;
}
}
export function transActivityInRemoteToModelType(activity: ActivityInRemote) {
if(!activity) return null;
return {
...activity,
beginTime: new Date(activity.beginTime),
endTime: new Date(activity.endTime),
_id: '',
createdAt: new Date(),
updatedAt: new Date(),
createdBy: 0,
updatedBy: 0
}
}