弹出礼包:添加同类型拦截参数

This commit is contained in:
luying
2022-07-22 11:33:03 +08:00
parent a3af186161
commit 45a02653f2
2 changed files with 22 additions and 16 deletions

View File

@@ -22,6 +22,7 @@ interface PopUpShopPackageInDb {
items: PopUpShopItemInDb[]; // 礼包
duration: number; // 礼包弹出之后,持续时间,单位小时
keyItem: PopUpShopKeyItemIbDb[]; // 关键资源限制refreshDay内可以获得Y个
checkPushingItem: number; // 是否在有同类型礼包的时候弹新礼包
refreshTimeType: number; // 刷新时间类型0-不复现 1-自然日 2-自然周 3-自然月 4-从beginTime开始固定天 5-按pvp赛季
refreshDay: number; // 上面刷新时间的具体天数refreshTimeType=0-3都不会使用这个参数refreshTimeType=4时这个表示固定几天
pushCnt: number; // 在自然日cd之内总推送次数不复现的填0不限制这个使用其他限制的填-1如passCnt填次数的时候这里填-1
@@ -149,6 +150,7 @@ export class PopUpShopPackage {
id: number; // 弹出礼包id
conditionType: number; // 条件类型
canLvUp: number; // 是否可升降
checkPushingItem: number; // 是否在同类型礼包
duration: number; // 礼包弹出之后,持续时间,单位小时
refreshTimeType: number; // 刷新时间类型0-不复现 1-自然日 2-自然周 3-自然月 4-从beginTime开始固定天
refreshDay: number; // 复现自然日cd不复现的填0从弹出礼包那一天的凌晨5点开始计数
@@ -175,6 +177,7 @@ export class PopUpShopPackage {
this.conditionType = data.conditionType;
this.canLvUp = data.canLvUp;
this.duration = data.duration;
this.checkPushingItem = data.checkPushingItem;
this.refreshTimeType = data.refreshTimeType;
this.refreshDay = data.refreshDay;
this.pushCnt = data.pushCnt;
@@ -221,7 +224,8 @@ export class PopUpShopPackage {
let item = this.findItemByProductID(itemData.productID);
if(item) {
item.setPlayerRecords(data, itemData);
this.isPushing = true;
console.log('#### item.isPushing', item.isPushing)
if(item.isPushing) this.isPushing = true;
}
}
} else if (data.beginTime < now && data.endTime < now) { // 已经结束了的
@@ -251,9 +255,9 @@ export class PopUpShopPackage {
console.log('######### 3.5.1', this.conditionType, conditionType, this.conditionType != conditionType)
if(this.conditionType != conditionType) return false;
// 2. 判断同类型是否是已经有在持续中的
console.log('######### 3.5.2', this.refreshTimeType, this.isPushing, this.refreshTimeType != 0 && this.isPushing)
if(this.refreshTimeType != 0 && this.isPushing) return false;
// // 3. 自然日内推送次数
console.log('######### 3.5.2', this.checkPushingItem, this.isPushing);
if(this.checkPushingItem && this.isPushing) return false;
// 3. 自然日内推送次数
console.log('######### 3.5.3', this.canLvUp, this.pushCnt, this.hasPushCnt, this.pushCnt != -1, this.hasPushCnt >= this.pushCnt)
if(this.canLvUp == 1 && this.pushCnt != -1 && this.hasPushCnt >= this.pushCnt) return false;
// 4. 连续无视次数
@@ -388,7 +392,9 @@ export class PopShopItem {
this.beginTime = data.beginTime.getTime();
this.endTime = data.endTime.getTime();
this.hasBoughtCnt = item.hasBoughtCnt;
this.isPushing = true;
if(this.hasBoughtCnt < this.buyCnt) {
this.isPushing = true;
}
}
public addPushCnt() {