弹出礼包增加是否展示的字段

This commit is contained in:
liangtongchuan
2022-07-28 15:21:45 +08:00
parent 4b051aec48
commit 784e374e90
2 changed files with 21 additions and 0 deletions
+10
View File
@@ -17,6 +17,9 @@ export class PopUpShopItem {
@prop({ required: true, _id: false, type: Reward })
rewards: Reward[] = []; // 已购买次数
@prop({ required: true, default: false})
hasShown: boolean; // 客户端是否已经展示
constructor(item: PopShopItem) {
this.id = item.id;
this.productID = item.productID;
@@ -111,6 +114,13 @@ export default class Activity_Pop_Up_Shop extends BaseModel {
{ new: true} ).lean();
return rec;
}
public static async show(serverId: number, activityId: number, roleId: string, code: string, itemId: number) {
let rec: ActivityPopUpShopModelType = await ActivityPopUpShopModel.findOneAndUpdate(
{ serverId, activityId, roleId, code, 'items.id': itemId },
{ 'items.hasShown': true }).lean();
return rec;
}
}
export const ActivityPopUpShopModel = getModelForClass(Activity_Pop_Up_Shop);