101 lines
2.6 KiB
PHP
101 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\common\controller\BaseCom;
|
|
use think\Db;
|
|
|
|
class SingerSong extends BaseCom
|
|
{
|
|
|
|
//歌手认证
|
|
public function singerAuth()
|
|
{
|
|
//试音地址
|
|
$song = input('song', 0);
|
|
if (!$song) {
|
|
return V(0, '请上传试音地址');
|
|
}
|
|
|
|
$reslut = model('SingerSong')->singerAuth($this->uid, $song);
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
|
|
//歌手添加歌曲
|
|
public function singerAddSong()
|
|
{
|
|
$song_name = input('song_name', 0);
|
|
if (!$song_name) {
|
|
return V(0, '请输入歌曲名称');
|
|
}
|
|
$gift_id = input('gift_id', 0);
|
|
if (!$gift_id) {
|
|
return V(0, '请选择礼物');
|
|
}
|
|
$gift_num = input('gift_num', 1);
|
|
$reslut = model('SingerSong')->singerAddSong($this->uid, $song_name, $gift_id, $gift_num);
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
|
|
//歌手删除 歌曲
|
|
public function singerDelSong()
|
|
{
|
|
$id = input('id', 0);
|
|
if (!$id) {
|
|
return V(0, '请选择歌曲');
|
|
}
|
|
$reslut = db::name('vs_singer_song')->where(['id' => $id])->update(['deletetime' => time()]);
|
|
if ($reslut) {
|
|
return V(1, '删除成功');
|
|
} else {
|
|
return V(0, '删除失败');
|
|
}
|
|
}
|
|
|
|
|
|
//歌手修改歌曲
|
|
public function singerEditSong()
|
|
{
|
|
$id = input('id', 0);
|
|
if (!$id) {
|
|
return V(0, '请选择歌曲');
|
|
}
|
|
$song_name = input('song_name', 0);
|
|
if (!$song_name) {
|
|
return V(0, '请输入歌曲名称');
|
|
}
|
|
$gift_id = input('gift_id', 0);
|
|
if (!$gift_id) {
|
|
return V(0, '请选择礼物');
|
|
}
|
|
$gift_num = input('gift_num', 1);
|
|
$reslut = db::name('vs_singer_song')->where(['id' => $id])->update([
|
|
'song_name' => $song_name,
|
|
'gift_id' => $gift_id,
|
|
'gift_num' => $gift_num,
|
|
]);
|
|
if ($reslut) {
|
|
return V(1, '修改成功');
|
|
} else {
|
|
return V(0, '修改失败');
|
|
}
|
|
}
|
|
|
|
|
|
//获取房间内麦位上歌手歌曲
|
|
public function getSong()
|
|
{
|
|
$room_id = input('room_id', 0);
|
|
//用户ID
|
|
$user_id = input('user_id', 0);
|
|
//以上两个参数二选一
|
|
if (!$room_id && !$user_id) {
|
|
return V(0, '请选择房间或歌手');
|
|
}
|
|
$reslut = model('SingerSong')->getSong($user_id, $room_id);
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
} |