|
@@ -4,6 +4,7 @@ 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
|
|
@@ -14,9 +15,6 @@ class ClientService implements ClientServiceInterface
|
|
|
*/
|
|
|
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());
|
|
@@ -28,6 +26,11 @@ class ClientService implements ClientServiceInterface
|
|
|
'data' => $data,
|
|
|
]
|
|
|
];
|
|
|
- return ['code' => 200, 'msg' => 'success', '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
|
|
|
}
|