清除房间不在线用户

This commit is contained in:
2025-09-19 19:22:05 +08:00
parent 3655647b33
commit 4380381a87
2 changed files with 10 additions and 1 deletions

View File

@@ -1723,6 +1723,15 @@ class Room extends Model
'text' => '房间类型已修改type--'.$type
];
model('Chat')->sendMsg(1012,$room_id,$text);
//查询房间里面的用户
$room_user = db::name('vs_room_visitor')->where(['room_id' => $room_id])->select();
if($room_user){
foreach ($room_user as $v){
if(Db::name('user')->where('id', $v['user_id'])->value('is_online') == 0){
model('Room')->quit_room($v['user_id'], $room_id,$v['user_id'],2);
}
}
}
return ['code' => 1, 'msg' => '修改成功', 'data' => null];
}

View File

@@ -924,7 +924,7 @@ class Tencent extends Model
$quit_room = Db::name('vs_room_visitor')->where('user_id', $uid)->select();
if($quit_room) {
foreach ($quit_room as &$v){
foreach ($quit_room as $v){
$room_type = db::name('vs_room')->where(['id' => $v['room_id'],'room_status' => 1])->field('step,type_id')->find();
if(($room_type['type_id'] == 7 && ($room_type['step'] == 2 ||$room_type['step'] == 3)) || $room_type == 2){
$text['text'] = '掉线!';