交友相关

This commit is contained in:
2025-08-16 11:29:29 +08:00
parent f90a9d11df
commit 9566409a0c
5 changed files with 102 additions and 20 deletions

View File

@@ -191,6 +191,11 @@ class RoomPit extends Model
//自由麦
if($room_info['room_up_pit_type'] == 2){
if($pit_number > 0){
if($room_info['label_id'] == 5){//交友
if($pit_number == 7 || $pit_number == 8){
return ['code' => 0, 'msg' => '该麦位已锁定了', 'data' => null];
}
}
//查询当前麦位是否有人
$pit_info = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $pit_number])->field('id,user_id,is_lock')->find();
if($pit_info['user_id'] > 0){
@@ -210,11 +215,11 @@ class RoomPit extends Model
}
}else{
// if($room_info['label_id'] == 2){
if($room_info['label_id'] == 5){//交友
$pit_number = $this->getRoomNullPitWithout($room_id, [7,8,9,10]);
}else{
$pit_number = $this->getRoomNullPitWithout($room_id, [9, 10]);
// }else{
// $pit_number = $this->getRoomNullPitWithout($room_id, [9, 10, 11,12,13,14,15,16,17,18,19,20,21,22]);
// }
}
if(!$pit_number){
return ['code' => 0, 'msg' => '当前房间没有空麦位', 'data' => null];
@@ -432,6 +437,8 @@ class RoomPit extends Model
$apply_type = 2;//K歌
}elseif($room_type == 2){
$apply_type = 3;//拍卖
}elseif($room_type == 7){
$apply_type = 7;//交友
}else{
$apply_type = 1;//聊天
}
@@ -581,6 +588,41 @@ class RoomPit extends Model
];
model('Chat')->sendMsg(1034,$room_id,$text);
return ['code' => 1, 'msg' => '上麦成功', 'data' => null];
}elseif($apply_type == 7) {
$i = 0;
foreach ($to_user as &$value) {
//查询当前空麦位
$empty_pit = $this->getRoomNullPitWithout($room_id, [7,8,9,10]);
if (!$empty_pit) {
//退出循环 并终止循环
break;
}
//查询是否已经上麦
$is_on_pit = db::name('vs_room_pit')->where(['room_id' => $room_id, 'user_id' => $value])->field('id')->find();
if ($is_on_pit) {
continue;
}
//删除他的申请上麦
$reslut = db::name('vs_room_pit_apply')->where(['user_id' => $value, 'room_id' => $room_id, 'status' => 0,'apply_type' => 1])->delete();
if (!$reslut) {
continue;
}
$on = $this->OnPit($value, $room_id, $empty_pit);//用户上了这个房间的几号麦位
if ($on['code'] != 1) {
continue;
}
$i++;
//1-禁麦位2-清空消息3-清空魅力值4-加入黑名单5-踢出房间6-关闭麦克风7-申请上麦8-同意上麦9-拒绝上麦10-点歌11-开启PK',
model('Room')->room_operation_record($user_id,$room_id,8,$value,$empty_pit);
}
$count = db::name('vs_room_pit_apply')->where(['room_id' => $room_id,'status' => 0])->count();
//申请上麦推送消息(数据重置)
$text = [
'text' => '申请上麦',
'count' => $count
];
model('Chat')->sendMsg(1034,$room_id,$text);
return ['code' => 1, 'msg' => $i . '位用户上麦成功', 'data' => null];
}
}
return ['code' => 0, 'msg' => '请选择申请上麦的用户', 'data' => null];