diff --git a/app/controller/Cloudflare.php b/app/controller/Cloudflare.php index 4f2b8dd..2a2177b 100644 --- a/app/controller/Cloudflare.php +++ b/app/controller/Cloudflare.php @@ -432,7 +432,26 @@ class Cloudflare extends BaseController throw new Exception('解析线路列表为空'); } - return json(['code' => 0, 'data' => ['default_line' => strval($firstKey)]]); + $lines = []; + foreach ($recordLine as $lineValue => $lineLabel) { + if (is_array($lineLabel)) { + $lines[] = [ + 'value' => strval($lineValue), + 'label' => isset($lineLabel['name']) ? strval($lineLabel['name']) : strval($lineValue), + 'parent' => isset($lineLabel['parent']) ? ($lineLabel['parent'] !== null ? strval($lineLabel['parent']) : '') : '', + 'is_default' => ($lineValue === $firstKey) + ]; + } else { + $lines[] = [ + 'value' => strval($lineValue), + 'label' => strval($lineLabel), + 'parent' => '', + 'is_default' => ($lineValue === $firstKey) + ]; + } + } + + return json(['code' => 0, 'data' => ['default_line' => strval($firstKey), 'lines' => $lines]]); } catch (Exception $e) { return json(['code' => -1, 'msg' => $e->getMessage()]); } diff --git a/app/view/cloudflare/hostnames.html b/app/view/cloudflare/hostnames.html index 0f85d19..71bfc5f 100644 --- a/app/view/cloudflare/hostnames.html +++ b/app/view/cloudflare/hostnames.html @@ -59,6 +59,7 @@ + @@ -248,6 +249,55 @@ + +