优化菜单导入

This commit is contained in:
cool 2024-04-24 08:52:50 +08:00
parent 3599c8c253
commit 63e71716f9
3 changed files with 9 additions and 5 deletions

View File

@ -25,8 +25,8 @@ export class BaseAppEvent {
@App() @App()
app: IMidwayKoaApplication; app: IMidwayKoaApplication;
@Event('onDBInit') @Event('onMenuInit')
async onDBInit() { async onMenuInit() {
this.checkConfig(); this.checkConfig();
this.checkKeys(); this.checkKeys();
} }

View File

@ -1,4 +1,4 @@
import { CoolEvent, Event } from '@cool-midway/core'; import { CoolEvent, CoolEventManager, Event } from '@cool-midway/core';
import { BaseSysMenuService } from '../service/sys/menu'; import { BaseSysMenuService } from '../service/sys/menu';
import { import {
App, App,
@ -22,6 +22,9 @@ export class BaseMenuEvent {
@App() @App()
app: IMidwayApplication; app: IMidwayApplication;
@Inject()
coolEventManager: CoolEventManager;
@Event('onMenuImport') @Event('onMenuImport')
async onMenuImport(datas) { async onMenuImport(datas) {
for (const module in datas) { for (const module in datas) {
@ -32,5 +35,6 @@ export class BaseMenuEvent {
'] module menu success \x1B[0m' '] module menu success \x1B[0m'
); );
} }
this.coolEventManager.emit('onMenuInit', {});
} }
} }

View File

@ -19,8 +19,8 @@ export class UserAppEvent {
@App() @App()
app: IMidwayKoaApplication; app: IMidwayKoaApplication;
@Event('onDBInit') @Event('onMenuInit')
async onDBInit() { async onMenuInit() {
this.checkConfig(); this.checkConfig();
} }