diff --git a/shared/domain/activityField/popUpShopField.ts b/shared/domain/activityField/popUpShopField.ts index 565f88784..7c70e650e 100644 --- a/shared/domain/activityField/popUpShopField.ts +++ b/shared/domain/activityField/popUpShopField.ts @@ -117,6 +117,7 @@ export class PopUpShopData extends ActivityBase { public checkItem(data: ActivityPopUpShopModelType, productID: string) { let pkg = this.findPackageById(data.id); let item = pkg.findItemByProductID(productID); + if(!item) return false return item.hasBoughtCnt < item.buyCnt; } @@ -124,6 +125,7 @@ export class PopUpShopData extends ActivityBase { let pkg = this.findPackageById(data.id); let dataItem = data.items.find(cur => cur.productID == productID); let item = pkg.findItemByProductID(productID); + if(!item) return null return item.updateItem(dataItem); } @@ -206,8 +208,10 @@ export class PopUpShopPackage { if(data.beginTime <= now && data.endTime > now) { // 正在进行中 for(let itemData of data.items) { let item = this.findItemByProductID(itemData.productID); - item.setPlayerRecords(data, itemData); - this.isPushing = true; + if(item) { + item.setPlayerRecords(data, itemData); + this.isPushing = true; + } } } else if (data.beginTime < now && data.endTime < now) { // 已经结束了的 if(data.hasBought) { // 是否看到了,但是没有买 @@ -219,7 +223,9 @@ export class PopUpShopPackage { for(let itemData of data.items) { let item = this.findItemByProductID(itemData.productID); - item.addPushCnt(); + if(item) { + item.addPushCnt(); + } } } @@ -307,7 +313,7 @@ export class PopUpShopPackage { let items: PopUpShopItemShow[] = []; for(let item of popUpShopRec.items) { let itemObj = this.findItemByProductID(item.productID); - if(itemObj.isPushing) { + if(itemObj && itemObj.isPushing) { let obj = new PopUpShopItemShow(itemObj); items.push(obj); }