86 lines
2.5 KiB
PHP
86 lines
2.5 KiB
PHP
|
|
<?php
|
|||
|
|
|
|||
|
|
namespace app\api\controller;
|
|||
|
|
|
|||
|
|
use app\common\controller\BaseCom;
|
|||
|
|
|
|||
|
|
class RoomSong extends BaseCom
|
|||
|
|
{
|
|||
|
|
//申请点歌
|
|||
|
|
public function apply_song(){
|
|||
|
|
|
|||
|
|
$room_id = input('room_id');
|
|||
|
|
$res = model('RoomSong')->apply_song($this->uid,$room_id);
|
|||
|
|
return V($res['code'], $res['msg'], $res['data']);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//同意、拒绝点歌
|
|||
|
|
public function agree_song(){
|
|||
|
|
$room_id = input('room_id');
|
|||
|
|
$type = input('type',1);//1同意 2拒绝
|
|||
|
|
$res = model('RoomSong')->agree_song($this->uid,$room_id,$type);
|
|||
|
|
|
|||
|
|
return V($res['code'], $res['msg'], $res['data']);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//点歌
|
|||
|
|
public function song(){
|
|||
|
|
$key_name = "api:room:song:" . $this->uid;
|
|||
|
|
redis_lock_exit($key_name);
|
|||
|
|
$room_id = input('room_id');
|
|||
|
|
$user_id = input('user_id');
|
|||
|
|
$song_code = input('song_code');
|
|||
|
|
$song_name = input('song_name');
|
|||
|
|
$singer = input('singer');
|
|||
|
|
$poster = input('poster');
|
|||
|
|
$duration = input('duration');
|
|||
|
|
$res = model('RoomSong')->song($room_id,$user_id,$song_code,$song_name,$singer,$poster,$duration);
|
|||
|
|
redis_unlock($key_name);
|
|||
|
|
return V($res['code'], $res['msg'], $res['data']);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//已点歌曲列表
|
|||
|
|
public function song_list(){
|
|||
|
|
$room_id = input('room_id');
|
|||
|
|
$res = model('RoomSong')->song_list($room_id);
|
|||
|
|
return V($res['code'], $res['msg'], $res['data']);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//上移歌 $type 1上移 2置顶
|
|||
|
|
public function up_song(){
|
|||
|
|
$room_song_id = input('did');
|
|||
|
|
$type = input('type');//1上移,2置顶
|
|||
|
|
$res = model('RoomSong')->up_song($room_song_id,$type);
|
|||
|
|
return V($res['code'], $res['msg'], $res['data']);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//切歌
|
|||
|
|
public function change_song(){
|
|||
|
|
$key_name = "api:room:change_song:" . $this->uid;
|
|||
|
|
redis_lock_exit($key_name);
|
|||
|
|
$room_id = input('room_id');
|
|||
|
|
$now_room_song_id = input('now_did');
|
|||
|
|
$res = model('RoomSong')->change_song($room_id,$now_room_song_id);
|
|||
|
|
redis_unlock($key_name);
|
|||
|
|
return V($res['code'], $res['msg'], $res['data']);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//结束本场次唱歌
|
|||
|
|
public function end_song(){
|
|||
|
|
$room_id = input('room_id');
|
|||
|
|
$res = model('RoomSong')->end_song($room_id);
|
|||
|
|
return V($res['code'], $res['msg'], $res['data']);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//K歌房间用户列表
|
|||
|
|
public function get_charm_rank(){
|
|||
|
|
$room_id = input('room_id');
|
|||
|
|
$res = model('RoomSong')->get_charm_rank($room_id);
|
|||
|
|
return V($res['code'], $res['msg'], $res['data']);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|