From b877931a0e36b577dbbd6b8d26e9db1be7004ff8 Mon Sep 17 00:00:00 2001 From: luying Date: Mon, 16 May 2022 21:42:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=EF=BC=9A=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E5=95=86=E5=BA=97=E4=BF=9D=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shared/domain/activityField/popUpShopField.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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); }