35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
import { prop, DocumentType, } from '@typegoose/typegoose';
|
|
import GMMail from './GMMail';
|
|
|
|
export default class ServerStategy {
|
|
|
|
@prop({ required: true, default: 0 })
|
|
maxPlayerCnt: number; // 人数上限
|
|
|
|
@prop({ required: true, default: 0, type: Number })
|
|
timers: number[]; // 开服时间点
|
|
|
|
@prop({ required: true, type: Number })
|
|
activityGroupId: number[]; // 选择活动组
|
|
|
|
@prop({ required: true, type: GMMail, _id: false })
|
|
openMail: GMMail;
|
|
|
|
@prop({ required: true, type: GMMail, _id: false })
|
|
circleMail: GMMail;
|
|
|
|
@prop({ required: true, default: 0 })
|
|
stopRegisterTime: number; // 关闭注册时间
|
|
|
|
constructor(stategy: ServerStategyUpdate & { hasOpenMail: boolean, hasCircleMail: boolean}) {
|
|
this.maxPlayerCnt = stategy.maxPlayerCnt;
|
|
this.timers = stategy.timers;
|
|
this.activityGroupId = stategy.activityGroupId;
|
|
this.stopRegisterTime = stategy.stopRegisterTime;
|
|
if(stategy.hasCircleMail) this.circleMail = stategy.circleMail;
|
|
if(stategy.hasOpenMail) this.openMail = stategy.openMail;
|
|
}
|
|
}
|
|
export interface ServerStategyType extends Pick<DocumentType<ServerStategy>, keyof ServerStategy> { };
|
|
export type ServerStategyUpdate = Partial<ServerStategyType>; // 将所有字段变成可选项
|