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