From dfe5fe96eca6bdc07676266ec56b40434712f708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Mon, 8 Dec 2025 16:15:41 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=88=BF=E9=97=B4=E6=8E=92?= =?UTF-8?q?=E8=A1=8C=E5=92=8C=E9=BB=98=E8=AE=A4=E9=80=89=E6=8B=A9=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Index.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php index a78e9ef2..63a1411c 100644 --- a/application/api/controller/Index.php +++ b/application/api/controller/Index.php @@ -29,9 +29,10 @@ class Index extends BaseCom //房间类型列表 public function room_type_list() { - $list = db::name('vs_room_label') + $list = db::name('vs_room_label') ->where(['status' => 1]) ->field('id,label_name,default_index,sort')->order('sort asc')->select(); + $is_default = 1; if($list){ $default_index = 0; $label_name = ''; @@ -61,9 +62,14 @@ class Index extends BaseCom return $a['sort'] - $b['sort']; }); } + foreach ($list as $v){ + if($v['default_index'] == 1){ + $is_default = 0; + } + } //给前面添加一组数据 - array_unshift($list, ['id' => -1, 'label_name' => '热门']); + array_unshift($list, ['id' => -1, 'label_name' => '热门','default_index' => $is_default]); return V(1, '获取成功', $list); }