From dcc373fe2aac276b8bf98896a5582d54ceb4dbe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=92=8A?= Date: Mon, 8 Dec 2025 18:03:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=9C=80=E6=B1=82=E5=8F=98?= =?UTF-8?q?=E6=9B=B4=EF=BC=9A---=E9=A6=96=E9=A1=B5=E6=96=B0=E4=BA=BA?= =?UTF-8?q?=E6=8E=A8=E8=8D=90=E6=88=BF=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/Room.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/application/api/model/Room.php b/application/api/model/Room.php index 42029114..81433b57 100644 --- a/application/api/model/Room.php +++ b/application/api/model/Room.php @@ -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]; }