wangzhibo
4 天以前 c19f1f7e21c93d1f13b4f44a8a615f65af577559
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { CoolEvent, Event } from '@cool-midway/core';
import { CachingFactory, MidwayCache } from '@midwayjs/cache-manager';
import {
  App,
  Config,
  ILogger,
  Inject,
  InjectClient,
  Logger,
} from '@midwayjs/core';
import { IMidwayKoaApplication } from '@midwayjs/koa';
import { PLUGIN_CACHE_KEY, PluginCenterService } from '../service/center';
import { PluginTypesService } from '../service/types';
 
/**
 * 插件事件
 */
@CoolEvent()
export class PluginAppEvent {
  @Logger()
  coreLogger: ILogger;
 
  @Config('module')
  config;
 
  @App()
  app: IMidwayKoaApplication;
 
  @InjectClient(CachingFactory, 'default')
  midwayCache: MidwayCache;
 
  @Inject()
  pluginCenterService: PluginCenterService;
 
  @Inject()
  pluginTypesService: PluginTypesService;
 
  @Event('onServerReady')
  async onServerReady() {
    await this.midwayCache.set(PLUGIN_CACHE_KEY, []);
    this.pluginCenterService.init();
    // this.pluginTypesService.reGenerate();
  }
}