活动:弹出商店显示

This commit is contained in:
luying
2022-05-07 11:28:45 +08:00
parent 77bcfb28e6
commit 5f9beb0664

View File

@@ -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});
}
}
}
}
}