登录:防旧包登录

This commit is contained in:
luying
2022-09-15 11:12:38 +08:00
parent b05adc0188
commit cd533906c1
4 changed files with 34 additions and 10 deletions

View File

@@ -10,7 +10,7 @@ import { dispatch } from 'app/pubUtils/dispatcher';
import { RedisClient } from 'redis';
import { REDIS_KEY } from '@consts';
import { RegionModel } from '@db/Region';
import { getRandEelmWithWeight, resResult } from 'app/pubUtils/util';
import { getRandEelmWithWeight } from 'app/pubUtils/util';
import { ChannelInfoModel } from '@db/ChannelInfo';
export default class GameController extends Controller {
@@ -20,7 +20,9 @@ export default class GameController extends Controller {
const { version } = ctx.request.body;
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);
if (versionFlag >= 0) {
@@ -34,10 +36,16 @@ export default class GameController extends Controller {
public async checkReview() {
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);
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 platform = platformAppid ?? platformAppId;
@@ -65,12 +73,18 @@ export default class GameController extends Controller {
try {
const { ctx } = this;
let { uid } = ctx;
const { version } = ctx.request.body;
const { version, addressType } = ctx.request.body;
let serverList = new Array<GroupParam>();
let loginServerList = new Array<ServerParamWithRole>();
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 env = isReview? curRegion.reviewEnv: ctx.app.config.realEnv;