import ActivityGrowth from './ActivityGrowth'; import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose'; /** * 活动系统 - 寻宝骑兵-备战任务 */ @index({ roleId: 1 }) export default class Activity_Treasure_Hunt_Task extends ActivityGrowth { @prop({ required: true }) roundIndex: number; // 周期 //任务领取记录 public static async receiveReward(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number, count: number,) { let result: ActivityTreasureHuntTaskModelType = await ActivityTreasureHuntTaskModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex, cellIndex }, { $inc: { receiveRewardCount: count } }, { upsert: true, new: true }).lean(true); return result; } //查询第几天的活动数据 public static async findDataByRoundIndex(serverId: number, activityId: number, roleId: string, roundIndex: number) { let result: ActivityTreasureHuntTaskModelType[] = await ActivityTreasureHuntTaskModel.find({ serverId, roleId, activityId, roundIndex }).lean(true); return result; } //删除活动领取记录 public static async deleteActivity(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number) { await ActivityTreasureHuntTaskModel.deleteMany({ serverId, roleId, activityId, roundIndex, cellIndex }); } } export const ActivityTreasureHuntTaskModel = getModelForClass(Activity_Treasure_Hunt_Task); export interface ActivityTreasureHuntTaskModelType extends Pick, keyof Activity_Treasure_Hunt_Task> { } export type ActivityTreasureHuntTaskModelTypeParam = Partial; // 将所有字段变成可选项