登录:防旧包登录

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

@@ -1,5 +1,6 @@
import { Controller } from 'egg';
import { RegionModel } from '@db/Region';
import { STATUS } from '@consts';
export default class UpdateController extends Controller {
public async getversion() {
@@ -10,9 +11,16 @@ export default class UpdateController extends Controller {
public async getUpdateUrl() {
const { ctx } = this;
const { addressType } = ctx.request.body;
const env = this.app.config.realEnv;
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);
}
}