feat(web-server): 修改审核服判断逻辑为:指定版本进入审核服

This commit is contained in:
liangtongchuan
2023-05-05 20:47:19 +08:00
parent 2427e2f7f1
commit a651254821
2 changed files with 15 additions and 6 deletions

View File

@@ -6,8 +6,10 @@ import { checkWhiteList } from 'app/pubUtils/sysUtil';
export default class UpdateController extends Controller {
public async getversion() {
const { ctx } = this;
const { version } = ctx.request.body;
ctx.body = await ctx.service.update.getVersion(version);
// const { version } = ctx.request.body;
// ctx.body = await ctx.service.update.getVersion(version);
// ! 接口已废弃
ctx.body = ctx.service.utils.resResult(STATUS.REQUEST_FAIL);
}
public async getUpdateUrl() {

View File

@@ -37,11 +37,18 @@ export default class Update extends Service {
}
public async checkReview(curRegion: RegionType, version: string) {
const ctx = this.ctx;
try {
const ctx = this.ctx;
if(!curRegion || !curRegion.reviewVersion || !version) return false;
let reviewVersionFlag = ctx.service.utils.compareVersion(version, curRegion.reviewVersion);
return `${ctx.clientIp}`.startsWith('17.') || reviewVersionFlag > 0;
if(!curRegion || !curRegion.reviewVersion || !version) return false;
const versionsInReview = curRegion.reviewVersion.split(',');
if (!versionsInReview || versionsInReview.length <= 0) return false;
let reviewVersionFlag = versionsInReview.includes(version) ? true : false;
return `${ctx.clientIp}`.startsWith('17.') || reviewVersionFlag;
} catch(e) {
console.log('checkReview error: ', e);
return false;
}
}
}