弹出礼包增加是否展示的字段
This commit is contained in:
@@ -108,6 +108,17 @@ 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');
|
||||
|
||||
let rec = await ActivityPopUpShopModel.show(serverId, activityId, roleId, code, id);
|
||||
if (!rec) return resResult(STATUS.ACTIVITY_MISSING);
|
||||
return resResult(STATUS.SUCCESS);
|
||||
}
|
||||
|
||||
async debugPushPopUpShop(msg: { conditionType: number, magicWord: string, param: number, needDelete: boolean }, session: BackendSession) {
|
||||
const roleId = session.get('roleId');
|
||||
let serverId = session.get('serverId');
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user