插件调用示例

This commit is contained in:
cool 2024-01-26 19:05:07 +08:00
parent 56a5b7a620
commit 487848d398

View File

@ -0,0 +1,18 @@
import { CoolController, BaseController } from '@cool-midway/core';
import { PluginService } from '../../../plugin/service/info';
import { Get, Inject } from '@midwayjs/core';
/**
*
*/
@CoolController()
export class OpenDemoPluginController extends BaseController {
@Inject()
pluginService: PluginService;
@Get('/invoke', { summary: '调用插件' })
async invoke() {
const result = await this.pluginService.invoke('test', 'show', 1, 2);
return this.ok(result);
}
}