调整弹出礼包展示字段

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

View File

@@ -109,12 +109,10 @@ export class PopUpShopHandler {
}
// 客户端展示弹出礼包的通知
async showGift(msg: { activityId: number, code: string, id: number }, session: BackendSession) {
const { activityId, code, id } = msg;
const roleId = session.get('roleId');
const serverId = session.get('serverId');
async showGift(msg: { code: string }, session: BackendSession) {
const { code } = msg;
let rec = await ActivityPopUpShopModel.show(serverId, activityId, roleId, code, id);
let rec = await ActivityPopUpShopModel.show(code);
if (!rec) return resResult(STATUS.ACTIVITY_MISSING);
return resResult(STATUS.SUCCESS);
}

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;
}
}

View File

@@ -365,6 +365,7 @@ export class PopShopItem {
isPushing: boolean = false; // 是否有推送
hasPushCnt: number = 0;
code: string = ''; // 推送唯一code
hasShown: boolean = false; // 客户端是否已经展示
beginTime: number = 0; // 推送开始时间
endTime: number = 0; // 推送结束时间
@@ -389,6 +390,7 @@ export class PopShopItem {
public setPlayerRecords(data: ActivityPopUpShopModelType, item: ActivityPopUpShopItem) {
this.code = data.code;
this.hasShown = data.hasShown;
this.beginTime = data.beginTime.getTime();
this.endTime = data.endTime.getTime();
this.hasBoughtCnt = item.hasBoughtCnt;
@@ -547,6 +549,7 @@ export class PopUpShopItemShow {
code: string; // 本次推送的code用于购买中传给param
packageId: number; // 礼包类型id
endTime: number; // 礼包消失时间
hasShown: boolean; // 礼包是否已经在客户端展示
id: number; // 档位唯一id升降档的时候按照id顺序排升档id+降档id-
name: string; // 礼包
@@ -560,6 +563,7 @@ export class PopUpShopItemShow {
constructor(data: PopShopItem) {
this.code = data.code;
this.hasShown = data.hasShown;
this.packageId = data.parent.id;
this.endTime = data.endTime;
this.id = data.id;