活动:弹出礼包错误

This commit is contained in:
luying
2022-05-06 20:47:25 +08:00
parent dcba6a847f
commit a161fbd239

View File

@@ -202,6 +202,11 @@ export class PopUpShopPackage {
for(let key of this.keyItem) {
key.addHasBoughtCnt(data.items);
}
for(let itemData of data.items) {
let item = this.findItemByProductID(itemData.productID);
item.addPushCnt();
}
if(data.beginTime <= now && data.endTime > now) { // 正在进行中
for(let itemData of data.items) {
let item = this.findItemByProductID(itemData.productID);
@@ -231,9 +236,9 @@ export class PopUpShopPackage {
// 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.3', this.pushCnt, this.hasPushCnt, this.pushCnt != -1, this.hasPushCnt >= this.pushCnt)
if(this.pushCnt != -1 && this.hasPushCnt >= this.pushCnt) 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. 连续无视次数
console.log('######### 3.5.4', this.hasPassCnt, this.passCnt, this.passCnt > 0 && this.hasPassCnt >= this.passCnt)
if(this.passCnt > 0 && this.hasPassCnt >= this.passCnt) return false;
@@ -323,11 +328,14 @@ export class PopShopItem {
reward: string; // 任务奖励,格式:1&3&1(类型&id&数量) 类型定义:1.英雄2.物品
rebate: number; // 折扣用于显示
buyCnt: number; // 购买多少次后消失原来的count字段
pushCnt: number;
canLvUp: number;
rewardInter: RewardInter[] = [];
parent: PopUpShopPackage;
hasBoughtCnt: number = 0;
isPushing: boolean = false; // 是否有推送
hasPushCnt: number = 0;
code: string = ''; // 推送唯一code
beginTime: number = 0; // 推送开始时间
endTime: number = 0; // 推送结束时间
@@ -344,6 +352,8 @@ export class PopShopItem {
this.rewardInter = stringWithTypeToRewardInter(data.reward);
this.rebate = data.rebate;
this.buyCnt = data.buyCnt;
this.pushCnt = parent.pushCnt;
this.canLvUp = parent.canLvUp;
this.parent = parent;
}
@@ -355,6 +365,10 @@ export class PopShopItem {
this.isPushing = true;
}
public addPushCnt() {
this.hasPushCnt++;
}
public checkItemCanPush(conditionType: POP_UP_SHOP_CONDITION_TYPE, param: PopUpConditionParamInter) {
console.log('##### xyz?1', this.hasBoughtCnt >= this.buyCnt)
if(this.hasBoughtCnt >= this.buyCnt) return false;
@@ -362,8 +376,10 @@ export class PopShopItem {
if(this.parent.getVipMaxPrice() < this.price) return false;
console.log('##### xyz?3', this.checkKeyTime())
if(!this.checkKeyTime()) return false
console.log('##### xyz?4', this.canLvUp, this.hasPushCnt, this.pushCnt, this.pushCnt != -1, this.hasPushCnt >= this.pushCnt)
if(this.canLvUp == 0 && this.pushCnt != -1 && this.hasPushCnt >= this.pushCnt) return false
console.log('##### xyz?4', conditionType, this.conditionParam, param)
console.log('##### xyz?5', conditionType, this.conditionParam, param)
switch(conditionType) {
case POP_UP_SHOP_CONDITION_TYPE.LV_TO:
return param.oldLv < this.conditionParam[0] && param.newLv >= this.conditionParam[0];
@@ -473,7 +489,7 @@ class PopUpShopShow {
for(let item of pkg.items) {
if(item.isPushing && item.hasBoughtCnt < item.buyCnt) {
let obj = new PopUpShopItemShow(item);
this.items.push(obj);
this.items.push({...obj});
}
}
}