refactor: 确立独立子工程架构 (backend, admin, mpuniapp) 并同步更新 AGENTS.md 规范

这个提交包含在:
wikiboss
2026-09-20 17:05:22 +08:00
父节点 de3cf8b870
当前提交 9fa1d1fbd0
共有 1679 个文件被更改,包括 204798 次插入 和 16817 次删除

查看文件

@@ -0,0 +1,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();
}
}

查看文件

@@ -0,0 +1,36 @@
import { CoolEvent, Event } from '@cool-midway/core';
import { Inject } from '@midwayjs/core';
import { PluginCenterService } from '../service/center';
// 插件初始化全局事件
export const GLOBAL_EVENT_PLUGIN_INIT = 'globalPluginInit';
// 插件移除全局事件
export const GLOBAL_EVENT_PLUGIN_REMOVE = 'globalPluginRemove';
/**
* 接收事件
*/
@CoolEvent()
export class PluginInitEvent {
@Inject()
pluginCenterService: PluginCenterService;
/**
* 插件初始化事件,某个插件重新初始化
* @param key
*/
@Event(GLOBAL_EVENT_PLUGIN_INIT)
async globalPluginInit(key: string) {
await this.pluginCenterService.initOne(key);
}
/**
* 插件移除或者关闭事件
* @param key
* @param isHook
*/
@Event(GLOBAL_EVENT_PLUGIN_REMOVE)
async globalPluginRemove(key: string, isHook: boolean) {
await this.pluginCenterService.remove(key, isHook);
}
}