改进 返回

This commit is contained in:
iVampireSP.com 2023-02-04 22:10:38 +08:00
parent 283db6cad9
commit b2d69f38d8
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132
2 changed files with 6 additions and 7 deletions

View File

@ -30,11 +30,6 @@ public function nodes(): JsonResponse
{ {
$nodes = ClusterSupport::nodes(true); $nodes = ClusterSupport::nodes(true);
$current_node_id = ClusterSupport::currentNode()['id']; return $this->success($nodes);
return $this->success([
'nodes' => $nodes,
'current_node_id' => $current_node_id,
]);
} }
} }

View File

@ -129,15 +129,19 @@ public static function nodes($hide_ip = false): array
{ {
$nodes = self::hgetAll('nodes'); $nodes = self::hgetAll('nodes');
$append_nodes = [];
foreach ($nodes as $key => $node) { foreach ($nodes as $key => $node) {
$nodes[$key] = json_decode($node, true); $nodes[$key] = json_decode($node, true);
if ($hide_ip) { if ($hide_ip) {
unset($nodes[$key]['ip']); unset($nodes[$key]['ip']);
} }
$append_nodes[] = $nodes[$key];
} }
return $nodes; return $append_nodes;
} }
public static function hgetAll($hashKey, $default = []): array public static function hgetAll($hashKey, $default = []): array