feat(活动): 鹊桥活动添加接口

This commit is contained in:
luying
2023-07-21 14:12:55 +08:00
parent 8d9322fed4
commit d57e38dc6c
4 changed files with 48 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ interface QixiDataInDb {
freeCnt: number; // 每天可以免费划船的次数
maxProgress: number; // 最大进度
rewards: string; // 奖励
countdown: number;
}
export class QixiData extends ActivityBase {
@@ -19,6 +20,7 @@ export class QixiData extends ActivityBase {
freeCntDaily: number; // 每天可以免费的次数
maxProgress: number; // 最大进度
rewards: string; // 奖励
countdown: number; // 倒计时
freeCnt: number = 0; // 累积到现在可以免费的次数
maxBuyCnt: number = 0; // 累积到现在可以购买的次数
@@ -39,6 +41,7 @@ export class QixiData extends ActivityBase {
let dataObj: QixiDataInDb = JSON.parse(data);
if (!dataObj) return;
this.countdown = dataObj.countdown;
this.buyCost = dataObj.buyCost || '&';
this.dailyBuyCnt = dataObj.dailyBuyCnt || 0;
this.freeCntDaily = dataObj.freeCnt || 0;
@@ -63,10 +66,10 @@ export class QixiData extends ActivityBase {
if(playerData.record) {
playerData.record.sort((a, b) => a.time.getTime() - b.time.getTime());
for(let data of playerData.record) {
let { todayIndex, afterProgress, progress, hasPass } = data;
let { todayIndex, afterProgress, progress, hasPass, isSkip } = data;
if(todayIndex == this.todayIndex && hasPass) this.todayPlayCnt ++;
if(hasPass) this.playCnt ++;
this.progress = afterProgress||progress;
if(!isSkip) this.progress = afterProgress||progress;
this.records.push(data);
}
if(this.todayPlayCnt >= this.freeCntDaily && this.playCnt < this.freeCnt) {
@@ -93,6 +96,7 @@ export class QixiData extends ActivityBase {
maxProgress: this.maxProgress,
progress: this.progress,
rewards: this.rewards,
countdown: this.countdown,
}
}
}