登录:防旧包登录
This commit is contained in:
@@ -17,8 +17,10 @@ export const STATUS = {
|
|||||||
FUNCTION_CLOSE: { code: 14, simStr: '抱歉,该功能暂时关闭' },
|
FUNCTION_CLOSE: { code: 14, simStr: '抱歉,该功能暂时关闭' },
|
||||||
TIMESTAMP_ERR: { code: 15, simStr: '请求时间参数错误' },
|
TIMESTAMP_ERR: { code: 15, simStr: '请求时间参数错误' },
|
||||||
DUPLICATE_ACCESS: { code: 16, simStr: '随机请求参数重复' },
|
DUPLICATE_ACCESS: { code: 16, simStr: '随机请求参数重复' },
|
||||||
|
ADDRESS_ERR: { code: 17, simStr: '您的版本已停止支持,请前往应用商店下载最新安装包' },
|
||||||
GLOBAL_ERR: { code: 1003, simStr: '服务器内部错误' },
|
GLOBAL_ERR: { code: 1003, simStr: '服务器内部错误' },
|
||||||
UPDATE_INFO_ERR: {code: 1004, simStr: '热更新配置错误'},
|
UPDATE_INFO_ERR: {code: 1004, simStr: '热更新配置错误'},
|
||||||
|
|
||||||
// http请求
|
// http请求
|
||||||
REQUEST_TIME_OUT: { code: 2000, simStr: '请求超时' },
|
REQUEST_TIME_OUT: { code: 2000, simStr: '请求超时' },
|
||||||
REQUEST_FAIL: { code: 2001, simStr: '请求错误' },
|
REQUEST_FAIL: { code: 2001, simStr: '请求错误' },
|
||||||
|
|||||||
+3
-3
@@ -24,9 +24,6 @@ export default class Region extends BaseModel {
|
|||||||
@prop({ required: true })
|
@prop({ required: true })
|
||||||
env: string; // 环境变量
|
env: string; // 环境变量
|
||||||
|
|
||||||
@prop({ required: true })
|
|
||||||
addressType: number; // 环境变量
|
|
||||||
|
|
||||||
@prop({ required: true })
|
@prop({ required: true })
|
||||||
gmLink: string; // 短链接地址
|
gmLink: string; // 短链接地址
|
||||||
|
|
||||||
@@ -54,6 +51,9 @@ export default class Region extends BaseModel {
|
|||||||
@prop({ required: true })
|
@prop({ required: true })
|
||||||
latestServerUniqId: number; // 最新服唯一id
|
latestServerUniqId: number; // 最新服唯一id
|
||||||
|
|
||||||
|
@prop({ required: true })
|
||||||
|
addressType: number; // 参数表的那个addressType
|
||||||
|
|
||||||
@prop({ required: true })
|
@prop({ required: true })
|
||||||
serverCount: number; // 总数
|
serverCount: number; // 总数
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ 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 { RegionModel } from '@db/Region';
|
||||||
import { getRandEelmWithWeight, resResult } from 'app/pubUtils/util';
|
import { getRandEelmWithWeight } from 'app/pubUtils/util';
|
||||||
import { ChannelInfoModel } from '@db/ChannelInfo';
|
import { ChannelInfoModel } from '@db/ChannelInfo';
|
||||||
|
|
||||||
export default class GameController extends Controller {
|
export default class GameController extends Controller {
|
||||||
@@ -20,7 +20,9 @@ export default class GameController extends Controller {
|
|||||||
const { version } = ctx.request.body;
|
const { version } = ctx.request.body;
|
||||||
|
|
||||||
let curRegion = await RegionModel.findRegionByEnv(this.app.config.realEnv);
|
let curRegion = await RegionModel.findRegionByEnv(this.app.config.realEnv);
|
||||||
if(!curRegion) return resResult(STATUS.VERSION_ERR);
|
if(!curRegion) {
|
||||||
|
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.versionCode);
|
||||||
if (versionFlag >= 0) {
|
if (versionFlag >= 0) {
|
||||||
@@ -34,10 +36,16 @@ export default class GameController extends Controller {
|
|||||||
|
|
||||||
public async checkReview() {
|
public async checkReview() {
|
||||||
const { ctx } = this;
|
const { ctx } = this;
|
||||||
const { version, platformAppid, platformAppId } = ctx.request.body;
|
const { version, platformAppid, platformAppId, addressType } = ctx.request.body;
|
||||||
|
|
||||||
let curRegion = await RegionModel.findRegionByEnv(this.app.config.realEnv);
|
let curRegion = await RegionModel.findRegionByEnv(this.app.config.realEnv);
|
||||||
if(!curRegion) return resResult(STATUS.VERSION_ERR);
|
if(!curRegion) {
|
||||||
|
return ctx.body = ctx.service.utils.resResult(STATUS.VERSION_ERR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(curRegion.addressType != addressType) {
|
||||||
|
return ctx.body = ctx.service.utils.resResult(STATUS.ADDRESS_ERR);
|
||||||
|
}
|
||||||
|
|
||||||
let hasPolicy = false, userPolicyLink = '', privacyPolicyLink = ''; // 是否需要替换协议,有就是用下面两个字段替换
|
let hasPolicy = false, userPolicyLink = '', privacyPolicyLink = ''; // 是否需要替换协议,有就是用下面两个字段替换
|
||||||
let platform = platformAppid ?? platformAppId;
|
let platform = platformAppid ?? platformAppId;
|
||||||
@@ -65,12 +73,18 @@ export default class GameController extends Controller {
|
|||||||
try {
|
try {
|
||||||
const { ctx } = this;
|
const { ctx } = this;
|
||||||
let { uid } = ctx;
|
let { uid } = ctx;
|
||||||
const { version } = ctx.request.body;
|
const { version, addressType } = ctx.request.body;
|
||||||
let serverList = new Array<GroupParam>();
|
let serverList = new Array<GroupParam>();
|
||||||
let loginServerList = new Array<ServerParamWithRole>();
|
let loginServerList = new Array<ServerParamWithRole>();
|
||||||
|
|
||||||
let curRegion = await RegionModel.findRegionByEnv(this.app.config.realEnv);
|
let curRegion = await RegionModel.findRegionByEnv(this.app.config.realEnv);
|
||||||
if(!curRegion) return resResult(STATUS.VERSION_ERR);
|
if(!curRegion) {
|
||||||
|
return ctx.body = ctx.service.utils.resResult(STATUS.VERSION_ERR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(curRegion.addressType != addressType) {
|
||||||
|
return ctx.body = ctx.service.utils.resResult(STATUS.ADDRESS_ERR);
|
||||||
|
}
|
||||||
|
|
||||||
let isReview = await ctx.service.update.checkReview(curRegion, version);
|
let isReview = await ctx.service.update.checkReview(curRegion, version);
|
||||||
let env = isReview? curRegion.reviewEnv: ctx.app.config.realEnv;
|
let env = isReview? curRegion.reviewEnv: ctx.app.config.realEnv;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Controller } from 'egg';
|
import { Controller } from 'egg';
|
||||||
import { RegionModel } from '@db/Region';
|
import { RegionModel } from '@db/Region';
|
||||||
|
import { STATUS } from '@consts';
|
||||||
|
|
||||||
export default class UpdateController extends Controller {
|
export default class UpdateController extends Controller {
|
||||||
public async getversion() {
|
public async getversion() {
|
||||||
@@ -10,9 +11,16 @@ export default class UpdateController extends Controller {
|
|||||||
|
|
||||||
public async getUpdateUrl() {
|
public async getUpdateUrl() {
|
||||||
const { ctx } = this;
|
const { ctx } = this;
|
||||||
|
const { addressType } = ctx.request.body;
|
||||||
|
|
||||||
const env = this.app.config.realEnv;
|
const env = this.app.config.realEnv;
|
||||||
const curRegion = await RegionModel.findRegionByEnv(env);
|
const curRegion = await RegionModel.findRegionByEnv(env);
|
||||||
const { curVersion, updateResUrl } = curRegion;
|
const { curVersion, updateResUrl, addressType: originAddressType } = curRegion;
|
||||||
|
|
||||||
|
if(originAddressType != addressType) {
|
||||||
|
return ctx.body = ctx.service.utils.resResult(STATUS.ADDRESS_ERR);
|
||||||
|
}
|
||||||
|
|
||||||
ctx.body = await ctx.service.update.getUpdateUrl(env, curVersion, updateResUrl);
|
ctx.body = await ctx.service.update.getUpdateUrl(env, curVersion, updateResUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user