活动:寻宝骑兵-每日物资

This commit is contained in:
qiaoxin
2021-05-25 22:05:28 +08:00
parent ebeb22f630
commit f8f9d9d120
4 changed files with 98 additions and 17 deletions

View File

@@ -10,14 +10,21 @@ import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoos
@index({ roleId: 1 })
export default class Activity_Treasure_Hunt_Shop extends ActivityShop {
@prop({ required: true })
dayIndex: number; // 第几天
@prop({ required: true })
dayIndex: number; // 第几天
//根据活动id查询活动数据
public static async findTreasureData(serverId: number, activityId: number, roleId: string, roundIndex: number, dayIndex: number) {
let result: ActivityTreasureHuntShopModelType = await ActivityTreasureHuntShopModel.findOne({ roleId, activityId, roundIndex, dayIndex }).lean(true);
return result;
}
//根据活动id查询活动数据
public static async findTreasureData(serverId: number, activityId: number, roleId: string, roundIndex: number, dayIndex: number) {
let result: ActivityTreasureHuntShopModelType = await ActivityTreasureHuntShopModel.findOne({ roleId, activityId, roundIndex, dayIndex }).lean(true);
return result;
}
//购买领取奖励的记录
public static async buyShopRecord(activityId: number, roleId: string, roundIndex: number, dayIndex: number, id: number) {
let result: ActivityTreasureHuntShopModelType = await ActivityTreasureHuntShopModel.findOneAndUpdate({ roleId, activityId, roundIndex, dayIndex },
{ $push: { records: { id, time: new Date() } } }, { upsert: true, new: true }).lean(true);
return result;
}
}
export const ActivityTreasureHuntShopModel = getModelForClass(Activity_Treasure_Hunt_Shop);