调整弹出礼包展示字段

This commit is contained in:
liangtongchuan
2022-07-28 15:59:22 +08:00
parent 20de6959f0
commit 7774724a7a
3 changed files with 13 additions and 13 deletions
+6 -8
View File
@@ -17,9 +17,6 @@ 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;
@@ -30,7 +27,7 @@ export class PopUpShopItem {
/**
* 活动系统 - 弹出商店
*/
@index({ roleId: 1 })
@index({ roleId: 1, code: 1 })
export default class Activity_Pop_Up_Shop extends BaseModel {
@prop({ required: true })
@@ -69,6 +66,9 @@ export default class Activity_Pop_Up_Shop extends BaseModel {
@prop({ required: true })
isLast: boolean; // 是否是最后一个
@prop({ required: true, default: false})
hasShown: boolean; // 客户端是否已经展示
/**
* 获取自然日内的次数
* @param roleId
@@ -115,10 +115,8 @@ export default class Activity_Pop_Up_Shop extends BaseModel {
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();
public static async show(code: string) {
let rec: ActivityPopUpShopModelType = await ActivityPopUpShopModel.findOneAndUpdate({ code }, { hasShown: true }).lean();
return rec;
}
}