123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace App\JsonRpc;
- use Hyperf\RpcServer\Annotation\RpcService;
- use App\Tools\Result;
- use Hyperf\DbConnection\Db;
- #[RpcService(name: "ClientService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
- class ClientService implements ClientServiceInterface
- {
- /**
- * @param array $data
- * @return array
- */
- public function test(array $data): array
- {
- var_dump($data, '---------------');
- $time = date('Y-m-d H:i:s', time());
- $data = [
- 'code' => 200,
- 'msg' => 'success',
- 'data' => [
- 'time' => $time,
- 'data' => $data,
- ]
- ];
- //mysql直接查询连接数
- $activeConnections = Db::select("SHOW STATUS LIKE 'Threads_connected'");
- // $activeConnectionsCount = $activeConnections[0]->Value ?? 0;
- $users = Db::select('SELECT * FROM article;');
- return ['code' => 200, 'msg' => 'success', 'data' => $activeConnections];
- }
- //test git
- }
|