🎈 perf(热更新): 添加白名单热更新地址

This commit is contained in:
luying
2022-11-23 11:38:22 +08:00
parent 6981b4c3e3
commit f1c6a658da
11 changed files with 33 additions and 209 deletions

View File

@@ -1,5 +1,4 @@
import { STATUS } from '@consts';
import { GameModel } from '@db/Game';
import { Controller } from 'egg';
import { RoleModel } from '@db/Role';
import { NoticeModel } from '@db/Notice';
@@ -24,13 +23,13 @@ export default class GameController extends Controller {
return ctx.body = ctx.service.utils.resResult(STATUS.VERSION_ERR);
}
const versionFlag = ctx.service.utils.compareVersion(version, curRegion.versionCode);
const versionFlag = ctx.service.utils.compareVersion(version, curRegion.minVersion);
if (versionFlag >= 0) {
ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS);
return;
}
//版本号太低
ctx.body = ctx.service.utils.resResult(STATUS.VERSION_ERR, { version: curRegion.versionCode });
ctx.body = ctx.service.utils.resResult(STATUS.VERSION_ERR, { version: curRegion.minVersion });
return;
}
@@ -120,26 +119,6 @@ export default class GameController extends Controller {
}
}
public async newServer() {
const { ctx } = this;
const { serverId, serverType, name, host, port, status } = ctx.request.body;
const serverList = await GameModel.getAllServerList();
for (let { id, host: preHost, port: prePort } of serverList) {
if (preHost === host && prePort === port && id === serverId) {
ctx.body = ctx.service.utils.resResult(STATUS.SERVER_EXISTS);
return;
}
}
const gameInfo = await GameModel.newServer(serverId, serverType, name, host, port, status);
if (gameInfo) {
ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS, { gameInfo });
} else {
ctx.body = ctx.service.utils.resResult(STATUS.NEW_SERVER_ERR);
}
return
}
public async getnotice() {
const { ctx } = this;