first commit
This commit is contained in:
27
app/Rpc/CalculatorService.php
Executable file
27
app/Rpc/CalculatorService.php
Executable file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Rpc;
|
||||
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Hyperf\Rpc\Response;
|
||||
use Hyperf\RpcServer\Annotation\RpcService;
|
||||
|
||||
// #[RpcService(name: "xxx-oo", server: "jsonrpc-http", protocol: "jsonrpc-http", publishTo: 'nacos')]
|
||||
class CalculatorService
|
||||
{
|
||||
public function add(int $a, int $b)
|
||||
{
|
||||
// \Hyperf\Logger\LoggerFactory::get('default')->info("Add called with: $a + $b");
|
||||
// 这里是服务方法的具体实现
|
||||
return ['xxxx' => 888];
|
||||
return $a + $b;
|
||||
}
|
||||
|
||||
public function add2(int $a, int $b)
|
||||
{
|
||||
// \Hyperf\Logger\LoggerFactory::get('default')->info("Add called with: $a + $b");
|
||||
// 这里是服务方法的具体实现
|
||||
return ['xxxx' => 888999];
|
||||
return $a + $b;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user