服务器:修改服务器列表

This commit is contained in:
luying
2021-06-11 10:09:35 +08:00
parent f1fa6ae354
commit 51efc2f0dc
5 changed files with 34 additions and 40 deletions

View File

@@ -1,9 +1,10 @@
import { ServerInfo } from '../../db/Game';
import { RoleType } from '../../db/Role';
import { getSeconds } from '../../pubUtils/timeUtil';
import { ServerlistType } from '@db/Serverlist';
export class ServerParam {
id: number; // 区号
serverId: number; // 显示的区号
serverStr: string; // 显示的区号 S1
name: string; // 区名
host: string; // pinus地址
@@ -12,9 +13,10 @@ export class ServerParam {
openTime: number; // 开服时间
serverType: string; // 分区类型 官服 测试服 开发服
constructor(server: ServerInfo) {
constructor(server: ServerlistType) {
this.id = server.id;
this.serverStr = `S${this.id}`;
this.serverId = server.serverId;
this.serverStr = `S${server.serverId}`;
this.name = server.name;
this.host = server.host;
this.port = server.port;
@@ -30,16 +32,18 @@ export class GroupParam {
groupStr: string; // 大区内小区编号 S1-S10
servers: ServerParam[]; // 区
constructor(server: ServerInfo) {
constructor(server: ServerlistType) {
this.groupId = server.groupId;
this.groupName = server.groupName;
this.groupStr = `S${server.id}-S${server.id + 9}`;
this.groupStr = `S${server.serverId}-S${server.serverId + 9}`;
this.servers = new Array<ServerParam>();
}
public pushServer(server: ServerInfo) {
public pushServer(server: ServerlistType) {
let srv = new ServerParam(server);
this.servers.push(srv);
let min = this.servers.reduce((pre, cur) => pre < cur? pre: cur);
this.groupStr = `${min.serverId}-${min.serverId + 9}`
}
}
@@ -55,7 +59,7 @@ export class ServerParamWithRole extends ServerParam {
lv: number; // 等级
updatedAt: Date;
constructor(role: RoleType, server: ServerInfo) {
constructor(role: RoleType, server: ServerlistType) {
super(server);
this.groupId = server.groupId;
this.groupName = server.groupName;