调整弹出礼包展示字段

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
@@ -109,12 +109,10 @@ export class PopUpShopHandler {
} }
// 客户端展示弹出礼包的通知 // 客户端展示弹出礼包的通知
async showGift(msg: { activityId: number, code: string, id: number }, session: BackendSession) { async showGift(msg: { code: string }, session: BackendSession) {
const { activityId, code, id } = msg; const { code } = msg;
const roleId = session.get('roleId');
const serverId = session.get('serverId');
let rec = await ActivityPopUpShopModel.show(serverId, activityId, roleId, code, id); let rec = await ActivityPopUpShopModel.show(code);
if (!rec) return resResult(STATUS.ACTIVITY_MISSING); if (!rec) return resResult(STATUS.ACTIVITY_MISSING);
return resResult(STATUS.SUCCESS); return resResult(STATUS.SUCCESS);
} }
+6 -8
View File
@@ -17,9 +17,6 @@ export class PopUpShopItem {
@prop({ required: true, _id: false, type: Reward }) @prop({ required: true, _id: false, type: Reward })
rewards: Reward[] = []; // 已购买次数 rewards: Reward[] = []; // 已购买次数
@prop({ required: true, default: false})
hasShown: boolean; // 客户端是否已经展示
constructor(item: PopShopItem) { constructor(item: PopShopItem) {
this.id = item.id; this.id = item.id;
this.productID = item.productID; 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 { export default class Activity_Pop_Up_Shop extends BaseModel {
@prop({ required: true }) @prop({ required: true })
@@ -69,6 +66,9 @@ export default class Activity_Pop_Up_Shop extends BaseModel {
@prop({ required: true }) @prop({ required: true })
isLast: boolean; // 是否是最后一个 isLast: boolean; // 是否是最后一个
@prop({ required: true, default: false})
hasShown: boolean; // 客户端是否已经展示
/** /**
* 获取自然日内的次数 * 获取自然日内的次数
* @param roleId * @param roleId
@@ -115,10 +115,8 @@ export default class Activity_Pop_Up_Shop extends BaseModel {
return rec; return rec;
} }
public static async show(serverId: number, activityId: number, roleId: string, code: string, itemId: number) { public static async show(code: string) {
let rec: ActivityPopUpShopModelType = await ActivityPopUpShopModel.findOneAndUpdate( let rec: ActivityPopUpShopModelType = await ActivityPopUpShopModel.findOneAndUpdate({ code }, { hasShown: true }).lean();
{ serverId, activityId, roleId, code, 'items.id': itemId },
{ 'items.hasShown': true }).lean();
return rec; return rec;
} }
} }
@@ -365,6 +365,7 @@ export class PopShopItem {
isPushing: boolean = false; // 是否有推送 isPushing: boolean = false; // 是否有推送
hasPushCnt: number = 0; hasPushCnt: number = 0;
code: string = ''; // 推送唯一code code: string = ''; // 推送唯一code
hasShown: boolean = false; // 客户端是否已经展示
beginTime: number = 0; // 推送开始时间 beginTime: number = 0; // 推送开始时间
endTime: number = 0; // 推送结束时间 endTime: number = 0; // 推送结束时间
@@ -389,6 +390,7 @@ export class PopShopItem {
public setPlayerRecords(data: ActivityPopUpShopModelType, item: ActivityPopUpShopItem) { public setPlayerRecords(data: ActivityPopUpShopModelType, item: ActivityPopUpShopItem) {
this.code = data.code; this.code = data.code;
this.hasShown = data.hasShown;
this.beginTime = data.beginTime.getTime(); this.beginTime = data.beginTime.getTime();
this.endTime = data.endTime.getTime(); this.endTime = data.endTime.getTime();
this.hasBoughtCnt = item.hasBoughtCnt; this.hasBoughtCnt = item.hasBoughtCnt;
@@ -547,6 +549,7 @@ export class PopUpShopItemShow {
code: string; // 本次推送的code,用于购买中传给param code: string; // 本次推送的code,用于购买中传给param
packageId: number; // 礼包类型id packageId: number; // 礼包类型id
endTime: number; // 礼包消失时间 endTime: number; // 礼包消失时间
hasShown: boolean; // 礼包是否已经在客户端展示
id: number; // 档位唯一id,升降档的时候按照id顺序排,升档id+,降档id- id: number; // 档位唯一id,升降档的时候按照id顺序排,升档id+,降档id-
name: string; // 礼包 name: string; // 礼包
@@ -560,6 +563,7 @@ export class PopUpShopItemShow {
constructor(data: PopShopItem) { constructor(data: PopShopItem) {
this.code = data.code; this.code = data.code;
this.hasShown = data.hasShown;
this.packageId = data.parent.id; this.packageId = data.parent.id;
this.endTime = data.endTime; this.endTime = data.endTime;
this.id = data.id; this.id = data.id;