最低版本号
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { CLIENT_VERSION, STATUS } from '@consts';
|
||||
import { STATUS } from '@consts';
|
||||
import { GameModel } from '@db/Game';
|
||||
import { Controller } from 'egg';
|
||||
import { RoleModel } from '@db/Role';
|
||||
@@ -9,18 +9,24 @@ import { ServerlistModel } from '@db/Serverlist';
|
||||
import { dispatch } from 'app/pubUtils/dispatcher';
|
||||
import { RedisClient } from 'redis';
|
||||
import { REDIS_KEY } from '@consts';
|
||||
import { RegionModel } from '@db/Region';
|
||||
import { resResult } from 'app/pubUtils/util';
|
||||
|
||||
export default class GameController extends Controller {
|
||||
|
||||
public async checkVersion() {
|
||||
const { ctx } = this;
|
||||
const { version } = ctx.request.body;
|
||||
if (version >= CLIENT_VERSION) {
|
||||
|
||||
let curRegion = await RegionModel.findRegionByEnv(this.app.config.realEnv);
|
||||
if(!curRegion) return resResult(STATUS.VERSION_ERR);
|
||||
|
||||
if (version >= curRegion.versionCode) {
|
||||
ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS);
|
||||
return;
|
||||
}
|
||||
//版本号太低
|
||||
ctx.body = ctx.service.utils.resResult(STATUS.VERSION_ERR, { version: CLIENT_VERSION });
|
||||
ctx.body = ctx.service.utils.resResult(STATUS.VERSION_ERR, { version: curRegion.versionCode });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user