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); }