新增需求变更:---首页新人推荐房间

This commit is contained in:
2025-12-08 18:03:52 +08:00
parent ea03bf88bc
commit dcc373fe2a

View File

@@ -248,12 +248,15 @@ class Room extends Model
->field('a.id as room_id,a.user_id,a.room_name,a.room_cover,count(b.id) as count')
->where($map)
->group('a.id,a.user_id,a.room_name,a.room_cover')
->order('count desc')
->order('count asc')
->find();
if(!$roominfo){
//随机获取一个房间
$roominfo = db::name('vs_room')->field('id as room_id,user_id,room_name,room_cover')
->where(['apply_status'=>2,'room_status'=>1,'room_password' =>''])->orderRaw('rand()')->find();
->where(['apply_status'=>2,'room_status'=>1,'room_password' =>'','is_show_room'=>1,'delete_time'=>0,'is_recommend'=>2])->orderRaw('rand()')->find();
}
if(empty($roominfo)){
return ['code' => 0, 'msg' => '暂无数据', 'data' => null];
}
return ['code' => 1, 'msg' => '获取成功', 'data' => $roominfo];
}