活动:弹出礼包vip等级

This commit is contained in:
luying
2022-05-17 23:47:32 +08:00
parent e68f8eeb16
commit a36d0ee140

View File

@@ -36,6 +36,7 @@ interface PopUpShopItemInDb {
reward: string; // 任务奖励,格式:1&3&1(类型&id&数量) 类型定义:1.英雄2.物品
rebate: number; // 折扣用于显示
buyCnt: number; // 购买多少次后消失原来的count字段
vipLv: number; // 需要多少级
}
interface PopUpShopKeyItemIbDb {
@@ -47,7 +48,6 @@ interface PopUpShopVipLevelInDb {
lv: number; // 几级
minPayMoney: number; // 最低金额
maxPayMoney: number; // 最高金额5000+的填-1
price: number; // 礼包上限
}
/**
@@ -59,7 +59,6 @@ export class PopUpShopData extends ActivityBase {
private packageMap: Map<number, number> = new Map();
vipLv: number = 0; // 玩家当前等级
maxPrice: number = 0; // 礼包上限
constructor(activityData: ActivityModelType) {
super(activityData, 0, 0);
@@ -95,10 +94,9 @@ export class PopUpShopData extends ActivityBase {
}
private setVipLv(totalPay: number) {
for(let { lv, minPayMoney, maxPayMoney, price } of this.vipLevel) {
for(let { lv, minPayMoney, maxPayMoney } of this.vipLevel) {
if(totalPay >= minPayMoney && (maxPayMoney == -1 || totalPay < maxPayMoney)) {
this.vipLv = lv;
this.maxPrice = price;
break;
}
}
@@ -184,8 +182,8 @@ export class PopUpShopPackage {
}
// vip分档
public getVipMaxPrice() {
return this.parent.maxPrice;
public getVipLv() {
return this.parent.vipLv;
}
public findItemByProductID(productID: string) {
@@ -336,6 +334,7 @@ export class PopShopItem {
buyCnt: number; // 购买多少次后消失原来的count字段
pushCnt: number;
canLvUp: number;
vipLv: number = 0;
rewardInter: RewardInter[] = [];
parent: PopUpShopPackage;
@@ -361,6 +360,7 @@ export class PopShopItem {
this.pushCnt = parent.pushCnt;
this.canLvUp = parent.canLvUp;
this.parent = parent;
this.vipLv = data.vipLv;
}
public setPlayerRecords(data: ActivityPopUpShopModelType, item: ActivityPopUpShopItem) {
@@ -378,8 +378,8 @@ export class PopShopItem {
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;
console.log('##### xyz?2', this.parent.getVipMaxPrice(), this.price, this.parent.getVipMaxPrice() < this.price)
if(this.parent.getVipMaxPrice() < this.price) return false;
console.log('##### xyz?2', this.parent.getVipLv(), this.vipLv, this.parent.getVipLv() < this.vipLv)
if(this.parent.getVipLv() < this.vipLv) 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)
@@ -452,13 +452,11 @@ export class PopUpShopVipLevel {
lv: number; // 几级
minPayMoney: number; // 最低金额
maxPayMoney: number; // 最高金额5000+的填-1
price: number; // 礼包上限
constructor(data: PopUpShopVipLevelInDb) {
this.lv = data.lv;
this.minPayMoney = data.minPayMoney;
this.maxPayMoney = data.maxPayMoney;
this.price = data.price;
}
}