后台:更新开服邮件

This commit is contained in:
luying
2021-12-07 10:34:52 +08:00
parent d33eb67429
commit 103314a8bf
18 changed files with 5902 additions and 218 deletions

View File

@@ -2,6 +2,7 @@ import { GM_MAIL_TYPE, MAIL_TIME_TYPE, SERVER_TIMER } from "../../consts";
import { isArray } from 'underscore';
import GMMail from "../../db/GMMail";
import ServerStategy from "../../db/ServerStategy";
import { RegionType } from "../../db/Region";
export class UpdateMailParams {
hasGoods: boolean = false; // 是否有道具
@@ -79,6 +80,9 @@ export class UpdateRegionParams {
circleMail?: GMMail;
stopRegisterTime: number = 0;
hasOpenMail: boolean = false;
hasCircleMail: boolean = false;
constructor(obj: UpdateRegionParams) {
for(let key in obj) {
this[key] = obj[key];
@@ -92,13 +96,45 @@ export class UpdateRegionParams {
return true;
}
getUpdateParam() {
let stategy = new ServerStategy(this);
return {
name: this.name,
prefix: this.prefix,
remark: this.remark,
stategy
getUpdateParam(oldRegion?: RegionType) {
if(!oldRegion) {
let stategy = new ServerStategy(this);
return {
name: this.name,
prefix: this.prefix,
remark: this.remark,
stategy
}
} else {
let stategy = new ServerStategy(this);
return {
name: this.name||oldRegion.name,
prefix: this.prefix||oldRegion.prefix,
remark: this.remark||oldRegion.remark,
stategy: { ...(oldRegion.stategy||{}), ...stategy }
}
}
}
}
export class CreateServerParam {
env: string = '';
openTime: number = 0;
activityGroupId: number[] = [];
openMail?: GMMail;
circleMail?: GMMail;
stopRegisterTime: number = 0;
constructor(obj: CreateServerParam) {
for(let key in obj) {
this[key] = obj[key];
}
}
checkParams() {
if(!this.env || !this.openTime || !this.stopRegisterTime || !isArray(this.activityGroupId) || this.activityGroupId.length <= 0 ) {
return false
}
return true;
}
}