酒吧房相关

This commit is contained in:
2026-01-05 15:16:42 +08:00
parent c0a175092f
commit c2765a0260
5 changed files with 243 additions and 216 deletions

View File

@@ -560,9 +560,7 @@ class Room extends Model
//进入房间前的判断
public function before_join_room_check($user_id, $room_id) {
$room = db::name('vs_room')->where(['id' => $room_id,'apply_status' => ['in',[1,2]]])->find();
if (!isset($room)) {
return ['code' => 0, 'msg' => '房间不存在', 'data' => ''];
}
if($room['apply_status'] == 1){
return ['code' => 0, 'msg' => '房间正在审核中……', 'data' => ''];
}
@@ -1054,6 +1052,9 @@ class Room extends Model
if($room_info['type_id'] == 10){
return 10;//签约房
}
if($room_info['type_id'] == 11){
return 11;//酒吧房
}
return 0;
}
@@ -1688,9 +1689,6 @@ class Room extends Model
public function quit_room($uid, $room_id,$user_id,$type = 0)
{
//拍卖位交友过程中1-6号麦位签约过程中签约麦位不能退出房间
if(!$room_id){
return ['code' => 0, 'msg' => '请选择房间', 'data' => null];
}
if($user_id == 0){
$nickname = db::name('user')->where('id', $uid)->value('nickname');
}else{
@@ -1727,6 +1725,8 @@ class Room extends Model
$apply_type = 5;
}elseif ($room_type == 2){
$apply_type = 6;
}else{
$apply_type = 1;
}
if($apply_type == 1){
@@ -2266,9 +2266,6 @@ class Room extends Model
//房间在线列表
public function room_online_list($room_id, $page = 1, $limit = 15)
{
if (!$room_id) {
return ['code' => 0, 'msg' => '参数错误', 'data' => null];
}
$room_type = $this->get_room_type($room_id);
$lists['on_pit'] = [];
$lists['off_pit'] = [];
@@ -2713,7 +2710,7 @@ class Room extends Model
//修改房间类型
// $type 1-交友,2-拍卖7-互娱8-交友不要了9-点唱10-签约
// $type 1-交友,2-拍卖7-互娱8-交友不要了9-点唱10-签约11-酒吧房
public function change_room_type($uid,$room_id,$type)
{
if(!$uid || !$room_id || !$type){
@@ -2815,6 +2812,15 @@ class Room extends Model
'room_up_pit_type' => 1,
];
}
//酒吧房
if($type == 11){
$data = [
'label_id' => 8,
'type_id' => $type,
'room_up_pit_type' => 1,
];
}
$res = db::name('vs_room')->where(['id' => $room_id])->update($data);
if(!$res){
@@ -2835,7 +2841,7 @@ class Room extends Model
//申请上麦的全部下麦
model('RoomPit')->clear_apply_pit_list($uid, $room_id);
if($type == 1 || $type == 3 || $type == 4 || $type == 7 || $type == 8 || $type == 9 || $type == 10){
if($type == 1 || $type == 3 || $type == 4 || $type == 7 || $type == 8 || $type == 9 || $type == 10 || $type == 11){
//查询拍卖房的状态
$room_auction = db::name('vs_room_auction')->where(['room_id' => $room_id,'status' => 2])->select();
if($room_auction){
@@ -3920,87 +3926,11 @@ class Room extends Model
}
//用户重连
public function user_reconnect($user_id,$room_id)
{
if(!$room_id){
// $room_id = Db::name('user_data')->where('user_id', $user_id)->value('room_id');
}
if(!$room_id){
return ['code' => 0, 'msg' => '参数错误', 'data' => null];
}
//查询用户在几个房间
$room = db::name('vs_room_visitor')->where('user_id', $user_id)->select();
if($room){
$userinroom = 0;
foreach ($room as $v){
if($v['room_id'] == $room_id){
$userinroom = $room_id;
break;
}
}
if($userinroom == $room_id){
$room_info = db::name('vs_room_visitor')->where(['id' => $room_id])->update(['room_id' => $room_id, 'user_id' => $user_id, 'updatetime' => time(),'remarks' =>'断线后重连']);
if(!$room_info){
return ['code' => 0, 'msg' => '更新加入房间失败', 'data' => null];
}
}else
{
$room_info = db::name('vs_room_visitor')->insert(['room_id' => $room_id, 'user_id' => $user_id, 'createtime' => time(),'remarks' =>'断线后重连']);
if(!$room_info){
return ['code' => 0, 'msg' => '加入房间失败', 'data' => null];
}
}
}else{
$room_info = db::name('vs_room_visitor')->insert(['room_id' => $room_id, 'user_id' => $user_id, 'createtime' => time(),'remarks' =>'断线后重连']);
if(!$room_info){
return ['code' => 0, 'msg' => '加入房间失败', 'data' => null];
}
}
return ['code' => 1, 'msg' => '操作成功', 'data' => null];
}
//用户在房间内切后台保留机制
public function user_in_room_background($user_id,$room_id,$type)
{
return ['code' => 1, 'msg' => '操作成功', 'data' => null];//没啥用了
if(!$room_id){
return ['code' => 0, 'msg' => '参数错误', 'data' => null];
}
$room_t = db::name('vs_room')->field('type_id,label_id')->where('id',$room_id)->find();
if(!(($room_t['type_id'] == 1 || $room_t['type_id'] == 8) && $room_t['label_id'] == 1)){
if($type == 1){//1-切后台2-切前台
$is_bg = db::name('vs_user_in_room_bg')->where(['user_id' => $user_id,'room_id' => $room_id])->find();
if($is_bg){
$up_bg = [
'updatetime' => time(),
];
db::name('vs_user_in_room_bg')->where('id',$is_bg['id'])->update($up_bg);
}else{
$data = [
'user_id' => $user_id,
'room_id' => $room_id,
'createtime' => time(),
'updatetime' => time(),
];
$room_background = db::name('vs_user_in_room_bg')->insert($data);
if(!$room_background){
return ['code' => 0, 'msg' => '操作失败', 'data' => null];
}
}
}else{
db::name('vs_user_in_room_bg')->where(['user_id' => $user_id,'room_id' => $room_id])->delete();
}
}
return ['code' => 1, 'msg' => '操作成功', 'data' => null];
}
//任务跳转房间推荐