如何使用
/**
* Class RpcController
*
* @since 2.0
*
* @Controller()
*/
class RpcController
{
/**
* @Reference(pool="user.pool")
*
* @var UserInterface
*/
private $userService;
/**
* @Reference(pool="user.pool", version="1.2")
*
* @var UserInterface
*/
private $userService2;
/**
* @RequestMapping("getList")
*
* @return array
*/
public function getList(): array
{
$result = $this->userService->getList(12, 'type');
$result2 = $this->userService2->getList(12, 'type');
return [$result, $result2];
}
/**
* @RequestMapping("returnBool")
*
* @return array
*/
public function returnBool(): array
{
$result = $this->userService->delete(12);
if (is_bool($result)) {
return ['bool'];
}
return ['notBool'];
}
/**
* @RequestMapping()
*
* @return array
*/
public function bigString(): array
{
$string = $this->userService->getBigContent();
return ['string'];
}
}
@Reference
- pool 指定使用那个服务的连接池(使用那个服务)
- version 指定服务的版本