27 lines
783 B
PHP
Executable File
27 lines
783 B
PHP
Executable File
<?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;
|
|
}
|
|
} |