活动:寻宝骑兵活动固定关卡id
This commit is contained in:
36
shared/db/ActivityTreasureHuntChallenge.ts
Normal file
36
shared/db/ActivityTreasureHuntChallenge.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
|
||||
|
||||
/**
|
||||
* 活动系统 - 寻宝骑兵-挑战
|
||||
*/
|
||||
@index({ roleId: 1 })
|
||||
|
||||
export default class Activity_Treasure_Hunt_Challenge {
|
||||
@prop({ required: true })
|
||||
serverId: number; // 区Id
|
||||
@prop({ required: true })
|
||||
activityId: number; // 活动Id
|
||||
@prop({ required: true })
|
||||
roleId: string; // 用户Id
|
||||
@prop({ required: true })
|
||||
roundIndex: number; // 回合数
|
||||
@prop({ required: true })
|
||||
warId: number; // 挑战关卡
|
||||
|
||||
//根据活动id查询活动数据
|
||||
public static async findData(serverId: number, activityId: number, roleId: string, roundIndex: number) {
|
||||
let result: ActivityTreasureHuntChallengeModelType = await ActivityTreasureHuntChallengeModel.findOne({ serverId, roleId, activityId, roundIndex }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async setWarId(serverId: number, activityId: number, roleId: string, roundIndex: number, warId: number) {
|
||||
let result: ActivityTreasureHuntChallengeModelType = await ActivityTreasureHuntChallengeModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex },
|
||||
{ $set: { warId }}, { new: true, upsert: true }).lean();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
export const ActivityTreasureHuntChallengeModel = getModelForClass(Activity_Treasure_Hunt_Challenge);
|
||||
|
||||
export interface ActivityTreasureHuntChallengeModelType extends Pick<DocumentType<Activity_Treasure_Hunt_Challenge>, keyof Activity_Treasure_Hunt_Challenge> { }
|
||||
export type ActivityTreasureHuntChallengeModelTypeParam = Partial<ActivityTreasureHuntChallengeModelType>; // 将所有字段变成可选项
|
||||
Reference in New Issue
Block a user