最低版本号
This commit is contained in:
@@ -10,8 +10,6 @@ export const TEL_ENCRYPT_KEY = 'fiqaxijabbantusm';
|
|||||||
|
|
||||||
export const DEBUG_MAGIC_WORD = 'zyz666server518';
|
export const DEBUG_MAGIC_WORD = 'zyz666server518';
|
||||||
|
|
||||||
export const CLIENT_VERSION = 1;//客户端最低版本号
|
|
||||||
|
|
||||||
export const AUTH_SMS_CNT_PER_DAY = 8;
|
export const AUTH_SMS_CNT_PER_DAY = 8;
|
||||||
|
|
||||||
export const ADULT_AGE = 18;
|
export const ADULT_AGE = 18;
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ export default class Region extends BaseModel {
|
|||||||
@prop({ required: true })
|
@prop({ required: true })
|
||||||
latestServer: number; // 最新服
|
latestServer: number; // 最新服
|
||||||
|
|
||||||
|
@prop({ required: true })
|
||||||
|
versionCode: number; // 版本号
|
||||||
|
|
||||||
@prop({ required: true })
|
@prop({ required: true })
|
||||||
latestServerUniqId: number; // 最新服唯一id
|
latestServerUniqId: number; // 最新服唯一id
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ export class UpdateRegionParams {
|
|||||||
name: string = ''; // 大区名
|
name: string = ''; // 大区名
|
||||||
prefix: string = ''; // 区名前缀
|
prefix: string = ''; // 区名前缀
|
||||||
remark: string = '';
|
remark: string = '';
|
||||||
|
versionCode: number = 1;
|
||||||
|
|
||||||
maxPlayerCnt: number = 0;
|
maxPlayerCnt: number = 0;
|
||||||
timers: SERVER_TIMER[] = [];
|
timers: SERVER_TIMER[] = [];
|
||||||
@@ -92,7 +93,7 @@ export class UpdateRegionParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkParams() {
|
checkParams() {
|
||||||
if(!this.id || !this.name || !this.prefix || !this.maxPlayerCnt || !isArray(this.timers) || this.timers.length <= 0 || !isArray(this.activityGroupId) || this.activityGroupId.length <= 0 ) {
|
if(!this.id || !this.name || !this.prefix || !this.maxPlayerCnt || !isArray(this.timers) || this.timers.length <= 0 || !isArray(this.activityGroupId) || this.activityGroupId.length <= 0 || !isNumber(this.versionCode)) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -105,6 +106,7 @@ export class UpdateRegionParams {
|
|||||||
name: this.name,
|
name: this.name,
|
||||||
prefix: this.prefix,
|
prefix: this.prefix,
|
||||||
remark: this.remark,
|
remark: this.remark,
|
||||||
|
versionCode: this.versionCode,
|
||||||
stategy
|
stategy
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -113,6 +115,7 @@ export class UpdateRegionParams {
|
|||||||
name: this.name||oldRegion.name,
|
name: this.name||oldRegion.name,
|
||||||
prefix: this.prefix||oldRegion.prefix,
|
prefix: this.prefix||oldRegion.prefix,
|
||||||
remark: this.remark||oldRegion.remark,
|
remark: this.remark||oldRegion.remark,
|
||||||
|
versionCode: this.versionCode||oldRegion.versionCode,
|
||||||
stategy: { ...(oldRegion.stategy||{}), ...stategy }
|
stategy: { ...(oldRegion.stategy||{}), ...stategy }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,6 +126,7 @@ export class CreateRegionParam {
|
|||||||
name: string = ''; // 大区名
|
name: string = ''; // 大区名
|
||||||
prefix: string = ''; // 区名前缀
|
prefix: string = ''; // 区名前缀
|
||||||
remark: string = '';
|
remark: string = '';
|
||||||
|
versionCode: number = 1;
|
||||||
env: string = ''; // 环境变量
|
env: string = ''; // 环境变量
|
||||||
gmLink: string; // 对应后台链接
|
gmLink: string; // 对应后台链接
|
||||||
gameHost: string; // 长链接
|
gameHost: string; // 长链接
|
||||||
@@ -136,7 +140,7 @@ export class CreateRegionParam {
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkParams() {
|
checkParams() {
|
||||||
if(!this.name || !this.prefix || !this.env || !this.gmLink || !this.gameHost || !this.gmPort || !this.webHost || !isNumber(this.gmPort) ) {
|
if(!this.name || !this.prefix || !this.env || !this.gmLink || !this.gameHost || !this.gmPort || !this.webHost || !isNumber(this.gmPort) || !isNumber(this.versionCode)) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1425,7 +1425,7 @@
|
|||||||
"good_id": 11319,
|
"good_id": 11319,
|
||||||
"name": "第一赛季亚军头像框",
|
"name": "第一赛季亚军头像框",
|
||||||
"quality": 1,
|
"quality": 1,
|
||||||
"image_id": "sa3",
|
"image_id": "sai3",
|
||||||
"itid": 51,
|
"itid": 51,
|
||||||
"goodType": 10,
|
"goodType": 10,
|
||||||
"redPoint": 0,
|
"redPoint": 0,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { CLIENT_VERSION, STATUS } from '@consts';
|
import { STATUS } from '@consts';
|
||||||
import { GameModel } from '@db/Game';
|
import { GameModel } from '@db/Game';
|
||||||
import { Controller } from 'egg';
|
import { Controller } from 'egg';
|
||||||
import { RoleModel } from '@db/Role';
|
import { RoleModel } from '@db/Role';
|
||||||
@@ -9,18 +9,24 @@ import { ServerlistModel } from '@db/Serverlist';
|
|||||||
import { dispatch } from 'app/pubUtils/dispatcher';
|
import { dispatch } from 'app/pubUtils/dispatcher';
|
||||||
import { RedisClient } from 'redis';
|
import { RedisClient } from 'redis';
|
||||||
import { REDIS_KEY } from '@consts';
|
import { REDIS_KEY } from '@consts';
|
||||||
|
import { RegionModel } from '@db/Region';
|
||||||
|
import { resResult } from 'app/pubUtils/util';
|
||||||
|
|
||||||
export default class GameController extends Controller {
|
export default class GameController extends Controller {
|
||||||
|
|
||||||
public async checkVersion() {
|
public async checkVersion() {
|
||||||
const { ctx } = this;
|
const { ctx } = this;
|
||||||
const { version } = ctx.request.body;
|
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);
|
ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS);
|
||||||
return;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user