完善插件

This commit is contained in:
啊平 2021-02-27 19:00:58 +08:00
parent 3bb0271d32
commit f760817807
4 changed files with 99 additions and 2 deletions

View File

@ -11,6 +11,6 @@ export default (app: Application) => {
// 模块描述
description: '基础的权限管理功能,包括登录,权限校验',
// 中间件
middlewares: [],
middlewares: ['baseAuthorityMiddleware', 'baseLogMiddleware'],
} as ModuleConfig;
};

View File

@ -0,0 +1,52 @@
import { Body, Get, Inject, Post, Provide, Query } from '@midwayjs/decorator';
import { CoolController, BaseController } from 'midwayjs-cool-core';
import { BasePluginInfoService } from '../../../service/plugin/info';
/**
*
*/
@Provide()
@CoolController()
export class BasePluginInfoController extends BaseController {
@Inject()
basePluginInfoService: BasePluginInfoService;
/**
*
*/
@Post('/list')
async list(@Body() keyWord: string) {
return this.ok(await this.basePluginInfoService.list(keyWord))
}
/**
*
* @param namespace
* @param config
*/
@Post('/config')
async config(@Body() namespace: string, @Body() config: any) {
await this.basePluginInfoService.config(namespace, config);
return this.ok();
}
/**
*
* @param namespace
* @param config
*/
@Get('/getConfig')
async getConfig(@Query() namespace: string) {
return this.ok(await this.basePluginInfoService.getConfig(namespace));
}
/**
*
* @param enable
*/
@Post('/enable')
async enable(@Body() namespace: string, @Body() enable: number) {
await this.basePluginInfoService.enable(namespace, enable);
return this.ok();
}
}

View File

@ -0,0 +1,43 @@
import { Inject, Provide } from '@midwayjs/decorator';
import { BaseService, CoolPlugin } from 'midwayjs-cool-core';
/**
*
*/
@Provide()
export class BasePluginInfoService extends BaseService {
@Inject('cool:coolPlugin')
coolPlugin: CoolPlugin;
/**
*
*/
async list(keyWord) {
return this.coolPlugin.list(keyWord);
}
/**
*
*/
async config(namespace: string, config) {
await this.coolPlugin.setConfig(namespace, config);
}
/**
*
* @param namespace
*/
async getConfig(namespace: string) {
return await this.coolPlugin.getConfig(namespace);
}
/**
*
* @param namespace
* @param enable
*/
async enable(namespace: string, enable: number){
await this.coolPlugin.enable(namespace,enable);
}
}

View File

@ -74,7 +74,9 @@ export class BaseSysUserService extends BaseService {
*
*/
async person() {
return await this.baseSysUserEntity.findOne({ id: this.ctx.admin.userId })
const info = await this.baseSysUserEntity.findOne({ id: this.ctx.admin.userId });
delete info.password;
return info;
}
/**