定时器

This commit is contained in:
luying
2022-09-30 20:15:23 +08:00
parent 2d3a1c7c30
commit e9170e61e1
6 changed files with 101 additions and 11 deletions

View File

@@ -32,12 +32,12 @@ interface GroupShopInDb {
// 数据
class GroupShopTimer {
time: number; // 活动开始之后的时间
time: number; // 时间
itemId: number; // items唯一id
sum: number; // 如果次数不足sum次则强行设成sum次
constructor(id: number, data: GroupShopTimerInDb) {
this.time = data.time;
constructor(beginTime: number, id: number, data: GroupShopTimerInDb) {
this.time = beginTime + data.time * 60 * 1000;
this.sum = data.sum;
this.itemId = id;
}
@@ -130,7 +130,7 @@ export class GroupShopData extends ActivityBase {
this.itemMap.set(item.id, this.items.length - 1);
if(item.timers && item.timers.length > 0) {
for(let timer of item.timers) {
this.timer.push(new GroupShopTimer(item.id, timer));
this.timer.push(new GroupShopTimer(this.beginTime, item.id, timer));
}
}
}