活动:弹出礼包vip等级

This commit is contained in:
luying
2022-05-17 23:47:32 +08:00
parent e68f8eeb16
commit a36d0ee140
+8 -10
View File
@@ -36,6 +36,7 @@ interface PopUpShopItemInDb {
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字段
vipLv: number; // 需要多少级
} }
interface PopUpShopKeyItemIbDb { interface PopUpShopKeyItemIbDb {
@@ -47,7 +48,6 @@ interface PopUpShopVipLevelInDb {
lv: number; // 几级 lv: number; // 几级
minPayMoney: number; // 最低金额 minPayMoney: number; // 最低金额
maxPayMoney: number; // 最高金额,5000+的填-1 maxPayMoney: number; // 最高金额,5000+的填-1
price: number; // 礼包上限
} }
/** /**
@@ -59,7 +59,6 @@ export class PopUpShopData extends ActivityBase {
private packageMap: Map<number, number> = new Map(); private packageMap: Map<number, number> = new Map();
vipLv: number = 0; // 玩家当前等级 vipLv: number = 0; // 玩家当前等级
maxPrice: number = 0; // 礼包上限
constructor(activityData: ActivityModelType) { constructor(activityData: ActivityModelType) {
super(activityData, 0, 0); super(activityData, 0, 0);
@@ -95,10 +94,9 @@ export class PopUpShopData extends ActivityBase {
} }
private setVipLv(totalPay: number) { 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)) { if(totalPay >= minPayMoney && (maxPayMoney == -1 || totalPay < maxPayMoney)) {
this.vipLv = lv; this.vipLv = lv;
this.maxPrice = price;
break; break;
} }
} }
@@ -184,8 +182,8 @@ export class PopUpShopPackage {
} }
// vip分档 // vip分档
public getVipMaxPrice() { public getVipLv() {
return this.parent.maxPrice; return this.parent.vipLv;
} }
public findItemByProductID(productID: string) { public findItemByProductID(productID: string) {
@@ -336,6 +334,7 @@ export class PopShopItem {
buyCnt: number; // 购买多少次后消失,原来的count字段 buyCnt: number; // 购买多少次后消失,原来的count字段
pushCnt: number; pushCnt: number;
canLvUp: number; canLvUp: number;
vipLv: number = 0;
rewardInter: RewardInter[] = []; rewardInter: RewardInter[] = [];
parent: PopUpShopPackage; parent: PopUpShopPackage;
@@ -361,6 +360,7 @@ export class PopShopItem {
this.pushCnt = parent.pushCnt; this.pushCnt = parent.pushCnt;
this.canLvUp = parent.canLvUp; this.canLvUp = parent.canLvUp;
this.parent = parent; this.parent = parent;
this.vipLv = data.vipLv;
} }
public setPlayerRecords(data: ActivityPopUpShopModelType, item: ActivityPopUpShopItem) { public setPlayerRecords(data: ActivityPopUpShopModelType, item: ActivityPopUpShopItem) {
@@ -378,8 +378,8 @@ export class PopShopItem {
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;
console.log('##### xyz?2', this.parent.getVipMaxPrice(), this.price, this.parent.getVipMaxPrice() < this.price) console.log('##### xyz?2', this.parent.getVipLv(), this.vipLv, this.parent.getVipLv() < this.vipLv)
if(this.parent.getVipMaxPrice() < this.price) return false; if(this.parent.getVipLv() < this.vipLv) 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) 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; // 几级 lv: number; // 几级
minPayMoney: number; // 最低金额 minPayMoney: number; // 最低金额
maxPayMoney: number; // 最高金额,5000+的填-1 maxPayMoney: number; // 最高金额,5000+的填-1
price: number; // 礼包上限
constructor(data: PopUpShopVipLevelInDb) { constructor(data: PopUpShopVipLevelInDb) {
this.lv = data.lv; this.lv = data.lv;
this.minPayMoney = data.minPayMoney; this.minPayMoney = data.minPayMoney;
this.maxPayMoney = data.maxPayMoney; this.maxPayMoney = data.maxPayMoney;
this.price = data.price;
} }
} }