歌曲置顶 权限处理
This commit is contained in:
@@ -53,7 +53,7 @@ class RoomSong extends BaseCom
|
||||
public function up_song(){
|
||||
$room_song_id = input('did');
|
||||
$type = input('type');//1上移,2置顶
|
||||
$res = model('RoomSong')->up_song($room_song_id,$type);
|
||||
$res = model('RoomSong')->up_song($this->uid,$room_song_id,$type);
|
||||
return V($res['code'], $res['msg'], $res['data']);
|
||||
}
|
||||
|
||||
|
||||
@@ -285,9 +285,14 @@ class RoomSong extends Model
|
||||
|
||||
|
||||
//上移歌 $type 1上移 2置顶
|
||||
public function up_song($room_song_id,$type=1){
|
||||
public function up_song($user_id,$room_song_id,$type=1){
|
||||
//查询当前数据的信息
|
||||
$sort = db::name('vs_room_song')->where('did',$room_song_id)->field('room_id,sort,times')->find();
|
||||
//查询当前用户是否是在9号麦的主持
|
||||
$is_host = db::name('vs_room_pit')->where(['user_id' => $user_id,'room_id' => $sort['room_id'],'pit_number' =>9])->find();
|
||||
if(!$is_host){
|
||||
return ['code'=>0,'msg'=>'您没有权限操作','data'=>null];
|
||||
}
|
||||
//根据房间ID查询当前房间中正在排序的歌曲 并获取当前排序的前一位的ID
|
||||
$sort_up = db::name('vs_room_song')->where(['room_id' => $sort['room_id'],'status' => 1,'times' =>$sort['times'],'times_status' => 1])->field('did')->order('sort desc')->select();
|
||||
if($sort_up[0]['did'] == $room_song_id){
|
||||
|
||||
Reference in New Issue
Block a user