diff --git a/application/api/model/RoomSong.php b/application/api/model/RoomSong.php index 3998019..cb83c8e 100644 --- a/application/api/model/RoomSong.php +++ b/application/api/model/RoomSong.php @@ -83,18 +83,37 @@ class RoomSong extends Model //同意点歌 public function agree_song($user_id,$room_id,$type){ - //判断用户是否在主持麦 -// $host_id = db::name('vs_room_pit')->where(['room_id' => $room_id,'user_id' => $user_id])->value('pit_number'); -// if($host_id != 9){ -// return ['code'=>0,'msg'=>'您不在主持麦,不能操作!','data'=>null]; -// } - $owner = db::name('vs_room')->where(['id' => $room_id, 'user_id' => $user_id])->field('id')->find(); $host = db::name('vs_room_host')->where(['room_id' => $room_id, 'user_id' => $user_id,'delete_time' => null])->find(); if(!$owner && !$host){ return ['code' => 0, 'msg' => '没有权限操作', 'data' => null]; } + //此房间类型为特殊存在,修改房间类型的时候 要判断一下条件 + $roomInfo = db::name('vs_room')->where(['id' => $room_id])->find(); + if($roomInfo['type_id'] == 1 && $roomInfo['label_id'] == 2){ + return ['code' => 0, 'msg' => '房间类型已存在', 'data' => null]; + } + + if($roomInfo['type_id'] == 7 && ($roomInfo['step'] == 2 || $roomInfo['step'] == 3)){ + return ['code' => 0, 'msg' => '请先结束交友后在修改房间类型', 'data' => null]; + } + + if($roomInfo['type_id'] == 2){ + $room_auction = db::name('vs_room_auction')->where(['room_id' => $room_id,'status' => 2])->select(); + if($room_auction){ + return ['code' => 0, 'msg' => '请先结束竞拍后在修改房间类型', 'data' => null]; + } + } + + if($roomInfo['type_id'] == 9){ + db::name('vs_song_log')->where(['room_id' => $room_id,'status' => ['<>',2]])->update(['status' => 2]); + } + + if($roomInfo['type_id'] == 10 && $roomInfo['sign_type'] != 0){ + return ['code' => 0, 'msg' => '请先结束签约后在修改房间类型', 'data' => null]; + } + $res1 = db::name('vs_room')->where('id',$room_id)->where(['label_id'=>2,'is_song'=>3])->find(); if($res1){ return ['code'=>0,'msg'=>'点歌中!请稍后再试!','data'=>null];