chore: src/modules/demo/controller/open/rpc.ts

This commit is contained in:
2026-07-01 17:56:28 +08:00
parent 535db676a0
commit 9ec1f49ede
+29
View File
@@ -0,0 +1,29 @@
import { Inject, Provide, Get } from '@midwayjs/core';
import { CoolController, BaseController } from '@cool-midway/core';
import { DemoRpcService } from '../../service/rpc';
/**
* 远程RPC调用
*/
@CoolController()
export class OpenDemoRpcController extends BaseController {
@Inject()
demoRpcService: DemoRpcService;
@Get('/call', { summary: '远程调用' })
async call() {
return this.ok(await this.demoRpcService.call());
}
@Get('/event', { summary: '集群事件' })
async event() {
await this.demoRpcService.event();
return this.ok();
}
@Get('/transaction', { summary: '分布式事务' })
async transaction() {
await this.demoRpcService.transaction({ a: 1 });
return this.ok();
}
}