From fa29542107de700207ac9b452d9191c30fda2661 Mon Sep 17 00:00:00 2001 From: air <30444667+sszdot@users.noreply.github.com> Date: Fri, 20 Jun 2025 18:02:15 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=B1=BB=20=20=E5=9E=8B=E3=80=91?= =?UTF-8?q?=EF=BC=9Afeat=20=E3=80=90=E5=8E=9F=20=20=E5=9B=A0=E3=80=91?= =?UTF-8?q?=EF=BC=9A=E4=BB=8E=E6=95=B0=E6=8D=AE=E5=BA=93=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=20=E5=9C=B0=E5=9B=BE=E6=A0=B7=E5=BC=8F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=E3=80=90=E8=BF=87=20=20=E7=A8=8B=E3=80=91?= =?UTF-8?q?=EF=BC=9A=20=E3=80=90=E5=BD=B1=20=20=E5=93=8D=E3=80=91=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PlaneController.class.php | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/FlyCube/MpApi/Controller/PlaneController.class.php b/FlyCube/MpApi/Controller/PlaneController.class.php index 3e57256..4f63b8f 100644 --- a/FlyCube/MpApi/Controller/PlaneController.class.php +++ b/FlyCube/MpApi/Controller/PlaneController.class.php @@ -1045,4 +1045,32 @@ class PlaneController extends PublicController echo json_encode(array('status' => 0, 'msg' => '参数不完整')); } } + /** + * @description: 获取地图样式列表 + */ + public function getMapStyleList() + { + $where['is_active'] = 1; + $mapStyleDb = D('map_styles'); + $field = array('id', 'name', 'sprite', 'glyphs', 'version', 'source_name', 'source_type', 'tile_size', 'tiles', 'attribution', 'layer_id', 'layer_type', 'layer_source', 'sort_order'); + + $list = $mapStyleDb->where($where)->field($field)->order('sort_order ASC')->select(); + if ($list) { + // 把 tiles 字段从 JSON 字符串解析成数组 + foreach ($list as &$style) { + $style['tiles'] = json_decode($style['tiles'], true); + } + + echo json_encode(array( + 'status' => 1, + 'msg' => '访问成功', + 'mapStyleList' => $list + )); + } else { + echo json_encode(array( + 'status' => 0, + 'msg' => '暂无地图样式数据' + )); + } + } }