app参数配置控制

This commit is contained in:
cool 2023-10-18 13:43:56 +08:00
parent 32a261700b
commit 9a5d42c5bf
2 changed files with 9 additions and 0 deletions

View File

@ -15,6 +15,8 @@ export default () => {
globalMiddlewares: [BaseAuthorityMiddleware, BaseLogMiddleware],
// 模块加载顺序默认为0值越大越优先加载
order: 10,
// app参数配置允许读取的key
allowKeys: [],
// jwt 生成解密token的
jwt: {
// 单点登录

View File

@ -24,14 +24,21 @@ export class BaseAppCommController extends BaseController {
@Inject()
ctx: Context;
@Inject('module.base.allowKeys')
allowKeys: string[];
@Inject()
eps: CoolEps;
@Inject()
baseSysParamService: BaseSysParamService;
@CoolTag(TagTypes.IGNORE_TOKEN)
@Get('/param', { summary: '参数配置' })
async param(@Query('key') key: string) {
if (!this.allowKeys.indexOf(key)) {
return this.fail('非法操作');
}
return this.ok(await this.baseSysParamService.dataByKey(key));
}