123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace App\JsonRpc;
- use Hyperf\RpcServer\Annotation\RpcService;
- use App\Tools\Result;
- #[RpcService(name: "ClientService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
- class ClientService implements ClientServiceInterface
- {
- /**
- * @param array $data
- * @return array
- */
- public function test(array $data): array
- {
- \Hyperf\Utils\ApplicationContext::getContainer()
- ->get(\Hyperf\Logger\LoggerFactory::class)
- ->get('log')->info('RPC调用到达', $data);
- var_dump($data, '---------------');
- $time = date('Y-m-d H:i:s', time());
- $data = [
- 'code' => 200,
- 'msg' => 'success',
- 'data' => [
- 'time' => $time,
- 'data' => $data,
- ]
- ];
- return ['code' => 200, 'msg' => 'success', 'data' => $data];
- }
- }
|