活动:招财进宝宝箱5点未领取发放邮箱

This commit is contained in:
luying
2022-05-27 22:41:53 +08:00
parent 1452e8b800
commit 2265c60289
8 changed files with 114 additions and 22 deletions
+29 -5
View File
@@ -73,6 +73,16 @@ export class ExtraRewardItem {
if(count >= this.exchangeCount) this.status = DAILY_COIN_BOX_STATUS.CAN_OPEN;
if(receivedBox.indexOf(this.cellIndex) != -1) this.status = DAILY_COIN_BOX_STATUS.RECEIVED;
}
addExchangeCount(exchangeCount: number) {
if(this.status == DAILY_COIN_BOX_STATUS.CAN_NOT_OPEN && exchangeCount >= this.exchangeCount) {
this.status = DAILY_COIN_BOX_STATUS.CAN_OPEN;
}
}
receiveBox() {
this.status = DAILY_COIN_BOX_STATUS.RECEIVED;
}
}
// 每日兑换铜币活动数据
@@ -122,27 +132,41 @@ export class DailyCoinData extends ActivityBase {
this.exchangeCount = data.exchangeCount||0;
this.coinCount = data.coinCount || 0;
this.recordMsg = data.recordMsg || [];
this.setAllBoxStatus(data);
for(let box of this.extraReward) {
box.setRecord(this.exchangeCount, data.receivedBox||[]);
}
}
public findBoxByCellIndex(cellIndex: number) {
return this.extraReward.find(cur => cur.cellIndex == cellIndex);
}
public setAllBoxStatus(data: ActivityDailyCoinModelType) {
public addExchangeCount(count: number) {
this.exchangeCount += count;
for(let box of this.extraReward) {
box.setRecord(this.exchangeCount, data.receivedBox||[]);
box.addExchangeCount(this.exchangeCount);
}
return this.extraReward;
}
public setBoxStatus(cellIndex: number, data: ActivityDailyCoinModelType) {
public receiveBox(cellIndex: number) {
let item = this.extraReward.find(cur => cur.cellIndex == cellIndex);
if(!item) return null;
item.setRecord(data.exchangeCount, data.receivedBox||[]);
item.receiveBox();
return item
}
public hasNotReceivedBox(): boolean {
for(let box of this.extraReward) {
if(box.status == DAILY_COIN_BOX_STATUS.CAN_OPEN) return true;
}
return false;
}
public getUnReceivedBox() {
return this.extraReward.filter(cur => cur.status == DAILY_COIN_BOX_STATUS.CAN_OPEN);
}
public initData(data: string) {
this.exchangeCount = 0;
this.coinCount = 0;