弹出礼包:购买
This commit is contained in:
@@ -91,6 +91,11 @@ export default class Activity_Pop_Up_Shop extends BaseModel {
|
||||
return rec;
|
||||
}
|
||||
|
||||
public static async findByCode(serverId: number, activityId: number, roleId: string, code: string) {
|
||||
let rec: ActivityPopUpShopModelType = await ActivityPopUpShopModel.findOne({ serverId, activityId, roleId, code }).lean();
|
||||
return rec;
|
||||
}
|
||||
|
||||
public static async addRecord(serverId: number, activityId: number, roleId: string, code: string, productID: string) {
|
||||
let rec: ActivityPopUpShopModelType = await ActivityPopUpShopModel.findOneAndUpdate(
|
||||
{ serverId, activityId, roleId, code, 'items.productID': productID },
|
||||
@@ -98,6 +103,14 @@ export default class Activity_Pop_Up_Shop extends BaseModel {
|
||||
{ new: true} ).lean();
|
||||
return rec;
|
||||
}
|
||||
|
||||
public static async addRecordById(serverId: number, activityId: number, roleId: string, code: string, itemid: number) {
|
||||
let rec: ActivityPopUpShopModelType = await ActivityPopUpShopModel.findOneAndUpdate(
|
||||
{ serverId, activityId, roleId, code, 'items.id': itemid },
|
||||
{ $set: { hasBought: true }, $inc: { 'items.$.hasBoughtCnt': 1 } },
|
||||
{ new: true} ).lean();
|
||||
return rec;
|
||||
}
|
||||
}
|
||||
|
||||
export const ActivityPopUpShopModel = getModelForClass(Activity_Pop_Up_Shop);
|
||||
|
||||
Reference in New Issue
Block a user