活动:弹出商店保护
This commit is contained in:
@@ -117,6 +117,7 @@ export class PopUpShopData extends ActivityBase {
|
|||||||
public checkItem(data: ActivityPopUpShopModelType, productID: string) {
|
public checkItem(data: ActivityPopUpShopModelType, productID: string) {
|
||||||
let pkg = this.findPackageById(data.id);
|
let pkg = this.findPackageById(data.id);
|
||||||
let item = pkg.findItemByProductID(productID);
|
let item = pkg.findItemByProductID(productID);
|
||||||
|
if(!item) return false
|
||||||
return item.hasBoughtCnt < item.buyCnt;
|
return item.hasBoughtCnt < item.buyCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,6 +125,7 @@ export class PopUpShopData extends ActivityBase {
|
|||||||
let pkg = this.findPackageById(data.id);
|
let pkg = this.findPackageById(data.id);
|
||||||
let dataItem = data.items.find(cur => cur.productID == productID);
|
let dataItem = data.items.find(cur => cur.productID == productID);
|
||||||
let item = pkg.findItemByProductID(productID);
|
let item = pkg.findItemByProductID(productID);
|
||||||
|
if(!item) return null
|
||||||
return item.updateItem(dataItem);
|
return item.updateItem(dataItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,8 +208,10 @@ export class PopUpShopPackage {
|
|||||||
if(data.beginTime <= now && data.endTime > now) { // 正在进行中
|
if(data.beginTime <= now && data.endTime > now) { // 正在进行中
|
||||||
for(let itemData of data.items) {
|
for(let itemData of data.items) {
|
||||||
let item = this.findItemByProductID(itemData.productID);
|
let item = this.findItemByProductID(itemData.productID);
|
||||||
item.setPlayerRecords(data, itemData);
|
if(item) {
|
||||||
this.isPushing = true;
|
item.setPlayerRecords(data, itemData);
|
||||||
|
this.isPushing = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (data.beginTime < now && data.endTime < now) { // 已经结束了的
|
} else if (data.beginTime < now && data.endTime < now) { // 已经结束了的
|
||||||
if(data.hasBought) { // 是否看到了,但是没有买
|
if(data.hasBought) { // 是否看到了,但是没有买
|
||||||
@@ -219,7 +223,9 @@ export class PopUpShopPackage {
|
|||||||
|
|
||||||
for(let itemData of data.items) {
|
for(let itemData of data.items) {
|
||||||
let item = this.findItemByProductID(itemData.productID);
|
let item = this.findItemByProductID(itemData.productID);
|
||||||
item.addPushCnt();
|
if(item) {
|
||||||
|
item.addPushCnt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,7 +313,7 @@ export class PopUpShopPackage {
|
|||||||
let items: PopUpShopItemShow[] = [];
|
let items: PopUpShopItemShow[] = [];
|
||||||
for(let item of popUpShopRec.items) {
|
for(let item of popUpShopRec.items) {
|
||||||
let itemObj = this.findItemByProductID(item.productID);
|
let itemObj = this.findItemByProductID(item.productID);
|
||||||
if(itemObj.isPushing) {
|
if(itemObj && itemObj.isPushing) {
|
||||||
let obj = new PopUpShopItemShow(itemObj);
|
let obj = new PopUpShopItemShow(itemObj);
|
||||||
items.push(obj);
|
items.push(obj);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user