mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2024-11-01 14:10:29 +08:00
插件调用示例
This commit is contained in:
parent
56a5b7a620
commit
487848d398
18
src/modules/demo/controller/open/plugin.ts
Normal file
18
src/modules/demo/controller/open/plugin.ts
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user