mirror of
https://github.com/cool-team-official/cool-admin-midway-packages.git
synced 2025-12-12 14:22:49 +00:00
优化Eps
This commit is contained in:
parent
fb67148f43
commit
619d7ca0af
@ -22,6 +22,8 @@ export class CoolEps {
|
|||||||
|
|
||||||
app = {};
|
app = {};
|
||||||
|
|
||||||
|
module = {};
|
||||||
|
|
||||||
@Inject()
|
@Inject()
|
||||||
midwayWebRouterService: MidwayWebRouterService;
|
midwayWebRouterService: MidwayWebRouterService;
|
||||||
|
|
||||||
@ -43,18 +45,15 @@ export class CoolEps {
|
|||||||
const entitys = await this.entity();
|
const entitys = await this.entity();
|
||||||
const controllers = await this.controller();
|
const controllers = await this.controller();
|
||||||
const routers = await this.router();
|
const routers = await this.router();
|
||||||
|
await this.modules();
|
||||||
const adminArr = [];
|
const adminArr = [];
|
||||||
const appArr = [];
|
const appArr = [];
|
||||||
for (const controller of controllers) {
|
for (const controller of controllers) {
|
||||||
const { prefix, module, moduleConfig, curdOption, routerOptions } = controller;
|
const { prefix, module, curdOption, routerOptions } = controller;
|
||||||
const name = curdOption?.entity?.name;
|
const name = curdOption?.entity?.name;
|
||||||
(_.startsWith(prefix, "/admin/") ? adminArr : appArr).push({
|
(_.startsWith(prefix, "/admin/") ? adminArr : appArr).push({
|
||||||
module,
|
module,
|
||||||
info: {
|
info: {
|
||||||
module: {
|
|
||||||
name: moduleConfig?.name,
|
|
||||||
description: moduleConfig?.description,
|
|
||||||
},
|
|
||||||
type: {
|
type: {
|
||||||
name: prefix.split("/").pop(),
|
name: prefix.split("/").pop(),
|
||||||
description: routerOptions?.description || "" ,
|
description: routerOptions?.description || "" ,
|
||||||
@ -70,6 +69,21 @@ export class CoolEps {
|
|||||||
this.app = _.groupBy(appArr, "module");
|
this.app = _.groupBy(appArr, "module");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块信息
|
||||||
|
* @param module
|
||||||
|
*/
|
||||||
|
async modules(module?: string) {
|
||||||
|
for(const key in this.moduleConfig){
|
||||||
|
const config = this.moduleConfig[key];
|
||||||
|
this.module[key] = {
|
||||||
|
name: config.name,
|
||||||
|
description: config.description,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return module? this.module[module]: this.module;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所有controller
|
* 所有controller
|
||||||
* @returns
|
* @returns
|
||||||
@ -78,9 +92,7 @@ export class CoolEps {
|
|||||||
const result = [];
|
const result = [];
|
||||||
const controllers = listModule(CONTROLLER_KEY);
|
const controllers = listModule(CONTROLLER_KEY);
|
||||||
for (const controller of controllers) {
|
for (const controller of controllers) {
|
||||||
const data = getClassMetadata(CONTROLLER_KEY, controller);
|
result.push(getClassMetadata(CONTROLLER_KEY, controller));
|
||||||
data.moduleConfig = this.moduleConfig[data.module];
|
|
||||||
result.push(data);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user