首页房间排行和默认选择类型
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user