活动:弹出商店显示
This commit is contained in:
@@ -485,16 +485,29 @@ class PopUpShopShow {
|
||||
this[key] = baseData[key];
|
||||
}
|
||||
|
||||
let itemsByCode = new Map<string, PopShopItem[]>();
|
||||
for(let pkg of data.packages) {
|
||||
for(let item of pkg.items) {
|
||||
let { id, isPushing, hasBoughtCnt, buyCnt, hasPushCnt, pushCnt } = item;
|
||||
console.log('**** PopUpShopShow', { id, isPushing, hasBoughtCnt, buyCnt, hasPushCnt, pushCnt })
|
||||
if(item.isPushing && item.hasBoughtCnt < item.buyCnt) {
|
||||
if(item.isPushing && item.code) {
|
||||
if(!itemsByCode.has(item.code)) {
|
||||
itemsByCode.set(item.code, []);
|
||||
}
|
||||
itemsByCode.get(item.code).push(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(let [_, items] of itemsByCode) {
|
||||
let hasItemsNotAllBought = items.filter(item => item.hasBoughtCnt < item.buyCnt).length > 0;
|
||||
if(hasItemsNotAllBought) {
|
||||
for(let item of items) {
|
||||
let obj = new PopUpShopItemShow(item);
|
||||
this.items.push({...obj});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user