Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -266,7 +266,7 @@ class Room extends BaseCom
|
|||||||
public function change_room_type()
|
public function change_room_type()
|
||||||
{
|
{
|
||||||
$room_id = input('room_id', 0);
|
$room_id = input('room_id', 0);
|
||||||
$type = input('type', 1);//1-点唱,2-拍卖,3-男神,4-女神,7-交友
|
$type = input('type', 1);//1-交友,2-拍卖,7-互娱,8-交友(不要了),9-点唱
|
||||||
$reslut = model('Room')->change_room_type($this->uid, $room_id, $type);
|
$reslut = model('Room')->change_room_type($this->uid, $room_id, $type);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class RoomPit extends BaseCom
|
|||||||
$room_label = $res['data']['label_id'];
|
$room_label = $res['data']['label_id'];
|
||||||
$room_type = $res['data']['type_id'];
|
$room_type = $res['data']['type_id'];
|
||||||
redis_lock_exits($key_name);
|
redis_lock_exits($key_name);
|
||||||
if(($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8))|| $room_type == 2 || $room_type == 7){
|
if(($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8))|| $room_type == 2 || $room_type == 7 || $room_type == 9){
|
||||||
$reslut = model('RoomPit')->apply_pit($this->uid, $room_id,$pit_number);
|
$reslut = model('RoomPit')->apply_pit($this->uid, $room_id,$pit_number);
|
||||||
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
|
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
|
||||||
$reslut = model('RoomSong')->apply_kpit($this->uid, $room_id,$pit_number);
|
$reslut = model('RoomSong')->apply_kpit($this->uid, $room_id,$pit_number);
|
||||||
@@ -107,7 +107,7 @@ class RoomPit extends BaseCom
|
|||||||
}
|
}
|
||||||
$room_label = $res['data']['label_id'];
|
$room_label = $res['data']['label_id'];
|
||||||
$room_type = $res['data']['type_id'];
|
$room_type = $res['data']['type_id'];
|
||||||
if(($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)) || $room_type == 2 || $room_type == 7){
|
if(($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)) || $room_type == 2 || $room_type == 7 || $room_type == 9){
|
||||||
$reslut = model('RoomPit')->DownPit($this->uid, $room_id,$pit_number);
|
$reslut = model('RoomPit')->DownPit($this->uid, $room_id,$pit_number);
|
||||||
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
|
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
|
||||||
$reslut = model('RoomSong')->down_kpit($this->uid, $room_id);
|
$reslut = model('RoomSong')->down_kpit($this->uid, $room_id);
|
||||||
|
|||||||
147
application/api/controller/SingerSong.php
Normal file
147
application/api/controller/SingerSong.php
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
<?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']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//点歌
|
||||||
|
public function singerSong()
|
||||||
|
{
|
||||||
|
$song_id = input('song_id', 0);
|
||||||
|
if (!$song_id) {
|
||||||
|
return V(0, '请选择歌曲');
|
||||||
|
}
|
||||||
|
$room_id = input('room_id', 0);
|
||||||
|
if (!$room_id) {
|
||||||
|
return V(0, '请选择房间');
|
||||||
|
}
|
||||||
|
$reslut = model('SingerSong')->singerSong($this->uid, $song_id ,$room_id);
|
||||||
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//点歌列表
|
||||||
|
public function singerSongList()
|
||||||
|
{
|
||||||
|
$room_id = input('room_id', 0);
|
||||||
|
if (!$room_id) {
|
||||||
|
return V(0, '请选择房间');
|
||||||
|
}
|
||||||
|
$type = input('type', 1);//1:已点列表,2:今日列表,3:昨日列表,4:本周列表,5:本月列表
|
||||||
|
$reslut = model('SingerSong')->singerSongList($room_id,$type);
|
||||||
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//歌曲置顶
|
||||||
|
public function singerSongTop()
|
||||||
|
{
|
||||||
|
$id = input('id', 0);
|
||||||
|
if (!$id) {
|
||||||
|
return V(0, '请选择歌曲');
|
||||||
|
}
|
||||||
|
$reslut = db::name('vs_song_log')->where(['id' => $id])->update(['sort' => time()]);
|
||||||
|
if ($reslut) {
|
||||||
|
return V(1, '置顶成功');
|
||||||
|
} else {
|
||||||
|
return V(0, '置顶失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -124,6 +124,10 @@ class Chat extends Model
|
|||||||
//红包领完推送
|
//红包领完推送
|
||||||
// RedPacketComplete = 1061,
|
// RedPacketComplete = 1061,
|
||||||
|
|
||||||
|
//点歌房推送信息
|
||||||
|
//歌曲发生变化
|
||||||
|
// SongChange = 1070,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -631,7 +631,7 @@ class Room extends Model
|
|||||||
$user_pit = 0;
|
$user_pit = 0;
|
||||||
$pit_list = [];
|
$pit_list = [];
|
||||||
$cp_users = null;
|
$cp_users = null;
|
||||||
if($room['type_id'] == 1 || $room['type_id'] == 3 || $room['type_id'] == 4 || $room['type_id'] == 7 || $room['type_id'] == 8) {//1点唱,3男神,4女神
|
if($room['type_id'] == 1 || $room['type_id'] == 3 || $room['type_id'] == 4 || $room['type_id'] == 7 || $room['type_id'] == 8 || $room['type_id'] == 9) {//1点唱,3男神,4女神
|
||||||
if($room['label_id'] == 2){//K歌
|
if($room['label_id'] == 2){//K歌
|
||||||
$song = $this->get_song_info($room_id,$user_id);
|
$song = $this->get_song_info($room_id,$user_id);
|
||||||
$song_list = $song['song_user_info'];
|
$song_list = $song['song_user_info'];
|
||||||
@@ -653,7 +653,7 @@ class Room extends Model
|
|||||||
$value['dress'] = model('api/Decorate')->user_decorate_detail($value['user_id'], 1);
|
$value['dress'] = model('api/Decorate')->user_decorate_detail($value['user_id'], 1);
|
||||||
$value['user_code'] = model('api/Decorate')->user_decorate_detail($value['user_id'], 6);
|
$value['user_code'] = model('api/Decorate')->user_decorate_detail($value['user_id'], 6);
|
||||||
$Nobility = model('api/Nobility')->getUserNobilityInfo($value['user_id']);
|
$Nobility = model('api/Nobility')->getUserNobilityInfo($value['user_id']);
|
||||||
$value['nobility_info'] = $Nobility;
|
// $value['nobility_info'] = $Nobility;
|
||||||
$value['mic_cycle'] = model('api/Decorate')->user_decorate_detail($value['user_id'],3);
|
$value['mic_cycle'] = model('api/Decorate')->user_decorate_detail($value['user_id'],3);
|
||||||
$value['nobility_image'] = $Nobility['play_image'];
|
$value['nobility_image'] = $Nobility['play_image'];
|
||||||
$value['nickname_color'] = $Nobility['nick_name_color'];
|
$value['nickname_color'] = $Nobility['nick_name_color'];
|
||||||
@@ -926,7 +926,7 @@ class Room extends Model
|
|||||||
$user_info['is_mute'] = db::name('vs_room_user_muted')->where(['room_id' => $room_id, 'user_id' => $user_id,'status' => 1])->find() ? 1 : 0;
|
$user_info['is_mute'] = db::name('vs_room_user_muted')->where(['room_id' => $room_id, 'user_id' => $user_id,'status' => 1])->find() ? 1 : 0;
|
||||||
$user_info['is_mute_pit'] = db::name('vs_room_user_muted')->where(['room_id' => $room_id, 'user_id' => $user_id,'status' => 2])->find() ? 1 : 0;
|
$user_info['is_mute_pit'] = db::name('vs_room_user_muted')->where(['room_id' => $room_id, 'user_id' => $user_id,'status' => 2])->find() ? 1 : 0;
|
||||||
$Nobility = model('api/Nobility')->getUserNobilityInfo($user_id);
|
$Nobility = model('api/Nobility')->getUserNobilityInfo($user_id);
|
||||||
$user_info['nobility_info'] = $Nobility;
|
// $user_info['nobility_info'] = $Nobility;
|
||||||
$user_info['mic_cycle'] = model('api/Decorate')->user_decorate_detail($user_id,3);
|
$user_info['mic_cycle'] = model('api/Decorate')->user_decorate_detail($user_id,3);
|
||||||
$user_info['nobility_image'] = $Nobility['play_image'];
|
$user_info['nobility_image'] = $Nobility['play_image'];
|
||||||
$user_info['nickname_color'] = $Nobility['nick_name_color'];
|
$user_info['nickname_color'] = $Nobility['nick_name_color'];
|
||||||
@@ -993,7 +993,7 @@ class Room extends Model
|
|||||||
$value['dress'] = model('api/Decorate')->user_decorate_detail($value['user_id'], 1);
|
$value['dress'] = model('api/Decorate')->user_decorate_detail($value['user_id'], 1);
|
||||||
$value['user_code'] = model('api/Decorate')->user_decorate_detail($value['user_id'], 6);
|
$value['user_code'] = model('api/Decorate')->user_decorate_detail($value['user_id'], 6);
|
||||||
$Nobility = model('api/Nobility')->getUserNobilityInfo($value['user_id']);
|
$Nobility = model('api/Nobility')->getUserNobilityInfo($value['user_id']);
|
||||||
$value['nobility_info'] = $Nobility;
|
// $value['nobility_info'] = $Nobility;
|
||||||
$value['mic_cycle'] = model('api/Decorate')->user_decorate_detail($value['user_id'],3);
|
$value['mic_cycle'] = model('api/Decorate')->user_decorate_detail($value['user_id'],3);
|
||||||
$value['nobility_image'] = $Nobility['play_image'];
|
$value['nobility_image'] = $Nobility['play_image'];
|
||||||
$value['nickname_color'] = $Nobility['nick_name_color'];
|
$value['nickname_color'] = $Nobility['nick_name_color'];
|
||||||
@@ -1055,7 +1055,7 @@ class Room extends Model
|
|||||||
$auction['time_day'] = $auction['time_day'] / 60 / 60;
|
$auction['time_day'] = $auction['time_day'] / 60 / 60;
|
||||||
$auction['charm'] = db::name('vs_room_user_charm')->where(['room_id' => $room_id, 'user_id' => $auction['user_id']])->value('charm') ?? 0;
|
$auction['charm'] = db::name('vs_room_user_charm')->where(['room_id' => $room_id, 'user_id' => $auction['user_id']])->value('charm') ?? 0;
|
||||||
$Nobility = model('api/Nobility')->getUserNobilityInfo($auction['user_id']);
|
$Nobility = model('api/Nobility')->getUserNobilityInfo($auction['user_id']);
|
||||||
$auction['nobility_info'] = $Nobility;
|
// $auction['nobility_info'] = $Nobility;
|
||||||
$auction['mic_cycle'] = model('api/Decorate')->user_decorate_detail($auction['user_id'],3);
|
$auction['mic_cycle'] = model('api/Decorate')->user_decorate_detail($auction['user_id'],3);
|
||||||
$auction['nobility_image'] = $Nobility['play_image'];
|
$auction['nobility_image'] = $Nobility['play_image'];
|
||||||
$auction['nickname_color'] = $Nobility['nick_name_color'];
|
$auction['nickname_color'] = $Nobility['nick_name_color'];
|
||||||
@@ -1102,7 +1102,7 @@ class Room extends Model
|
|||||||
$user_pit['pit_number'] = 9;
|
$user_pit['pit_number'] = 9;
|
||||||
}
|
}
|
||||||
$Nobility = model('api/Nobility')->getUserNobilityInfo($value['user_id']);
|
$Nobility = model('api/Nobility')->getUserNobilityInfo($value['user_id']);
|
||||||
$value['nobility_info'] = $Nobility;
|
// $value['nobility_info'] = $Nobility;
|
||||||
$value['mic_cycle'] = model('api/Decorate')->user_decorate_detail($value['user_id'],3);
|
$value['mic_cycle'] = model('api/Decorate')->user_decorate_detail($value['user_id'],3);
|
||||||
$value['nobility_image'] = $Nobility['play_image'];
|
$value['nobility_image'] = $Nobility['play_image'];
|
||||||
$value['nickname_color'] = $Nobility['nick_name_color'];
|
$value['nickname_color'] = $Nobility['nick_name_color'];
|
||||||
@@ -1141,7 +1141,7 @@ class Room extends Model
|
|||||||
$room_label = $res['data']['label_id'] ?? 0;
|
$room_label = $res['data']['label_id'] ?? 0;
|
||||||
$room_type = $res['data']['type_id'] ?? 0;
|
$room_type = $res['data']['type_id'] ?? 0;
|
||||||
$apply_type = 0;
|
$apply_type = 0;
|
||||||
if($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
|
if($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8 || $room_type == 9)){
|
||||||
$apply_type = 1;
|
$apply_type = 1;
|
||||||
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
|
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
|
||||||
$apply_type = 2;
|
$apply_type = 2;
|
||||||
@@ -1729,6 +1729,7 @@ class Room extends Model
|
|||||||
|
|
||||||
|
|
||||||
//修改房间类型
|
//修改房间类型
|
||||||
|
// $type //1-交友,2-拍卖,7-互娱,8-交友(不要了),9-点唱
|
||||||
public function change_room_type($uid,$room_id,$type)
|
public function change_room_type($uid,$room_id,$type)
|
||||||
{
|
{
|
||||||
if(!$uid || !$room_id || !$type){
|
if(!$uid || !$room_id || !$type){
|
||||||
@@ -1759,7 +1760,7 @@ class Room extends Model
|
|||||||
//开启事务
|
//开启事务
|
||||||
db::startTrans();
|
db::startTrans();
|
||||||
$data = [];
|
$data = [];
|
||||||
if($type == 1 || $type == 3 || $type == 4 || $type == 8){
|
if($type == 1 || $type == 3 || $type == 4 || $type == 8 || $type == 9){
|
||||||
$data = [
|
$data = [
|
||||||
'label_id' => 1,
|
'label_id' => 1,
|
||||||
'type_id' => $type,
|
'type_id' => $type,
|
||||||
@@ -1809,7 +1810,7 @@ class Room extends Model
|
|||||||
//申请上麦的全部下麦
|
//申请上麦的全部下麦
|
||||||
model('RoomPit')->clear_apply_pit_list($uid, $room_id);
|
model('RoomPit')->clear_apply_pit_list($uid, $room_id);
|
||||||
|
|
||||||
if($type == 1 || $type == 3 || $type == 4 || $type == 7 || $type == 8){
|
if($type == 1 || $type == 3 || $type == 4 || $type == 7 || $type == 8 || $type == 9){
|
||||||
//查询拍卖房的状态
|
//查询拍卖房的状态
|
||||||
$room_auction = db::name('vs_room_auction')->where(['room_id' => $room_id,'status' => 2])->select();
|
$room_auction = db::name('vs_room_auction')->where(['room_id' => $room_id,'status' => 2])->select();
|
||||||
if($room_auction){
|
if($room_auction){
|
||||||
@@ -1847,7 +1848,7 @@ class Room extends Model
|
|||||||
if($room_user){
|
if($room_user){
|
||||||
foreach ($room_user as $v){
|
foreach ($room_user as $v){
|
||||||
if(Db::name('user')->where('id', $v['user_id'])->value('is_online') == 0){
|
if(Db::name('user')->where('id', $v['user_id'])->value('is_online') == 0){
|
||||||
model('Room')->quit_room($v['user_id'], $room_id,$v['user_id'],2);
|
// model('Room')->quit_room($v['user_id'], $room_id,$v['user_id'],2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1900,7 +1901,7 @@ class Room extends Model
|
|||||||
$pit_list = null;
|
$pit_list = null;
|
||||||
$roomauction = null;
|
$roomauction = null;
|
||||||
$cp_users = null;
|
$cp_users = null;
|
||||||
if($room['type_id'] == 1 || $room['type_id'] == 3 || $room['type_id'] == 4 || $room['type_id'] == 7 || $room['type_id'] == 8) {
|
if($room['type_id'] == 1 || $room['type_id'] == 3 || $room['type_id'] == 4 || $room['type_id'] == 7 || $room['type_id'] == 8 || $room['type_id'] == 9) {
|
||||||
if($room['label_id'] == 1 || $room['label_id'] == 5){
|
if($room['label_id'] == 1 || $room['label_id'] == 5){
|
||||||
//麦位信息
|
//麦位信息
|
||||||
$pit_list = db::name('vs_room_pit')->alias('a')->join('user b', 'a.user_id = b.id', 'left')
|
$pit_list = db::name('vs_room_pit')->alias('a')->join('user b', 'a.user_id = b.id', 'left')
|
||||||
@@ -1914,7 +1915,7 @@ class Room extends Model
|
|||||||
$value['dress'] = model('Decorate')->user_decorate_detail($value['user_id'], 1);
|
$value['dress'] = model('Decorate')->user_decorate_detail($value['user_id'], 1);
|
||||||
$value['user_code'] = model('Decorate')->user_decorate_detail($value['user_id'], 6);
|
$value['user_code'] = model('Decorate')->user_decorate_detail($value['user_id'], 6);
|
||||||
$Nobility = model('api/Nobility')->getUserNobilityInfo($value['user_id']);
|
$Nobility = model('api/Nobility')->getUserNobilityInfo($value['user_id']);
|
||||||
$value['nobility_info'] = $Nobility;
|
// $value['nobility_info'] = $Nobility;
|
||||||
$value['mic_cycle'] = model('api/Decorate')->user_decorate_detail($value['user_id'],3);
|
$value['mic_cycle'] = model('api/Decorate')->user_decorate_detail($value['user_id'],3);
|
||||||
$value['nobility_image'] = $Nobility['play_image'];
|
$value['nobility_image'] = $Nobility['play_image'];
|
||||||
$value['nickname_color'] = $Nobility['nick_name_color'];
|
$value['nickname_color'] = $Nobility['nick_name_color'];
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class RoomPit extends Model
|
|||||||
$FromUserInfo['dress'] = model('Decorate')->user_decorate_detail($user_id,1);
|
$FromUserInfo['dress'] = model('Decorate')->user_decorate_detail($user_id,1);
|
||||||
$FromUserInfo['charm'] = db::name('vs_room_user_charm')->where(['user_id' => $user_id,'room_id' => $room_id])->value('charm');
|
$FromUserInfo['charm'] = db::name('vs_room_user_charm')->where(['user_id' => $user_id,'room_id' => $room_id])->value('charm');
|
||||||
$Nobility = model('api/Nobility')->getUserNobilityInfo($user_id);
|
$Nobility = model('api/Nobility')->getUserNobilityInfo($user_id);
|
||||||
$FromUserInfo['nobility_info'] = $Nobility;
|
// $FromUserInfo['nobility_info'] = $Nobility;
|
||||||
$FromUserInfo['mic_cycle'] = model('api/Decorate')->user_decorate_detail($user_id,3);
|
$FromUserInfo['mic_cycle'] = model('api/Decorate')->user_decorate_detail($user_id,3);
|
||||||
$FromUserInfo['nobility_image'] = $Nobility['play_image'];
|
$FromUserInfo['nobility_image'] = $Nobility['play_image'];
|
||||||
$FromUserInfo['nickname_color'] = $Nobility['nick_name_color'];
|
$FromUserInfo['nickname_color'] = $Nobility['nick_name_color'];
|
||||||
@@ -216,7 +216,7 @@ class RoomPit extends Model
|
|||||||
return ['code' => 0, 'msg' => '请选择房间', 'data' => null];
|
return ['code' => 0, 'msg' => '请选择房间', 'data' => null];
|
||||||
}
|
}
|
||||||
//查询房间状态
|
//查询房间状态
|
||||||
$room_info = db::name('vs_room')->where(['id' => $room_id, 'apply_status' => 2])->field('id,room_status,room_up_pit_type,label_id,step')->find();
|
$room_info = db::name('vs_room')->where(['id' => $room_id, 'apply_status' => 2])->field('id,room_status,room_up_pit_type,type_id,label_id,step')->find();
|
||||||
if(!$room_info){
|
if(!$room_info){
|
||||||
return ['code' => 0, 'msg' => '房间不存在', 'data' => null];
|
return ['code' => 0, 'msg' => '房间不存在', 'data' => null];
|
||||||
}
|
}
|
||||||
@@ -224,6 +224,11 @@ class RoomPit extends Model
|
|||||||
return ['code' => 0, 'msg' => '房间违规或关闭', 'data' => null];
|
return ['code' => 0, 'msg' => '房间违规或关闭', 'data' => null];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$user_singer = db::name('vs_singer')->where(['user_id' => $user_id, 'status' => 1])->find();
|
||||||
|
if($room_info['type_id'] == 9 && !$user_singer && $pit_number < 9){
|
||||||
|
return ['code' => 0, 'msg' => '不是歌手不能上麦', 'data' => null];
|
||||||
|
}
|
||||||
|
|
||||||
if($pit_number == 9){
|
if($pit_number == 9){
|
||||||
//检查用户是否是房主或主持
|
//检查用户是否是房主或主持
|
||||||
$is_room_owner =db::name('vs_room')->where(['id' => $room_id, 'user_id' => $user_id])->field('id')->find();
|
$is_room_owner =db::name('vs_room')->where(['id' => $room_id, 'user_id' => $user_id])->field('id')->find();
|
||||||
|
|||||||
217
application/api/model/SingerSong.php
Normal file
217
application/api/model/SingerSong.php
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\model;
|
||||||
|
|
||||||
|
use think\Db;
|
||||||
|
use think\Model;
|
||||||
|
|
||||||
|
class SingerSong extends Model
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* 歌手认证 状态及等级
|
||||||
|
*/
|
||||||
|
public function singerAuthStatus($user_id)
|
||||||
|
{
|
||||||
|
$res = db::name('vs_singer')->where(['user_id' => $user_id])->find();
|
||||||
|
if ($res) {
|
||||||
|
$data = [
|
||||||
|
'status' => $res['status'],
|
||||||
|
'level' => $res['level'],
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$data = [
|
||||||
|
'status' => -1,
|
||||||
|
'level' => 0,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return $data ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 歌手认证
|
||||||
|
*/
|
||||||
|
public function singerAuth($user_id, $song)
|
||||||
|
{
|
||||||
|
//查询是否提交过认证
|
||||||
|
$res = db::name('vs_singer')->where(['user_id' => $user_id])->find();
|
||||||
|
if ($res && $res['status'] == 1) {
|
||||||
|
return ['code' => 0, 'msg' => '认证已通过,无需重复提交'];
|
||||||
|
}
|
||||||
|
if ($res) {
|
||||||
|
$data = [
|
||||||
|
'song' => $song,
|
||||||
|
'status' => 0,
|
||||||
|
'updatetime' => time()
|
||||||
|
];
|
||||||
|
$result = db::name('vs_singer')->where(['id' => $res['id']])->update($data);
|
||||||
|
}else{
|
||||||
|
$data = [
|
||||||
|
'user_id' => $user_id,
|
||||||
|
'song' => $song,
|
||||||
|
'status' => 0,
|
||||||
|
'createtime' => time()
|
||||||
|
];
|
||||||
|
$result = db::name('vs_singer')->insert($data);
|
||||||
|
}
|
||||||
|
if ($result) {
|
||||||
|
return ['code' => 1, 'msg' => '提交成功'];
|
||||||
|
} else {
|
||||||
|
return ['code' => 0, 'msg' => '提交失败'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 歌手添加歌曲
|
||||||
|
* @param song_name 歌曲名称
|
||||||
|
* @param gift_id 礼物id
|
||||||
|
* @param gift_num 礼物数量
|
||||||
|
*/
|
||||||
|
public function singerAddSong($user_id, $song_name, $gift_id, $gift_num)
|
||||||
|
{
|
||||||
|
//查询是否提交过歌曲
|
||||||
|
$res = db::name('vs_singer_song')->where(['user_id' => $user_id, 'song_name' => $song_name])->find();
|
||||||
|
if ($res) {
|
||||||
|
return ['code' => 0, 'msg' => '请勿重复提交歌曲'];
|
||||||
|
}
|
||||||
|
$data = [
|
||||||
|
'user_id' => $user_id,
|
||||||
|
'song_name' => $song_name,
|
||||||
|
'gift_id' => $gift_id,
|
||||||
|
'gift_num' => $gift_num,
|
||||||
|
'createtime' => time()
|
||||||
|
];
|
||||||
|
$result = db::name('vs_singer_song')->insert($data);
|
||||||
|
if ($result) {
|
||||||
|
return ['code' => 1, 'msg' => '提交成功'];
|
||||||
|
} else {
|
||||||
|
return ['code' => 0, 'msg' => '提交失败'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 获取房间内麦位上歌手歌曲
|
||||||
|
* @param room_id 房间id
|
||||||
|
* @param user_id 用户id
|
||||||
|
*/
|
||||||
|
public function getSong($user_id, $room_id)
|
||||||
|
{
|
||||||
|
if($user_id > 0){
|
||||||
|
$res = db::name('vs_singer_song')->where(['user_id' => $user_id])->select();
|
||||||
|
}else{
|
||||||
|
//查询当前房间内麦位上的歌手
|
||||||
|
$room_singer = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => ['<',9]])->column('user_id');
|
||||||
|
if ($room_singer) {
|
||||||
|
$res = db::name('vs_singer_song')->where(['user_id' => ['in', $room_singer]])->select();
|
||||||
|
}else{
|
||||||
|
$res = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($res) {
|
||||||
|
foreach ($res as $k => $v) {
|
||||||
|
$res[$k]['gift_name'] = db::name('vs_gift')->where(['gid' => $v['gift_id']])->value('gift_name');
|
||||||
|
$res[$k]['gift_price'] = db::name('vs_gift')->where(['gid' => $v['gift_id']])->value('gift_price');
|
||||||
|
$res[$k]['base_image'] = db::name('vs_gift')->where(['gid' => $v['base_image']])->value('base_image');
|
||||||
|
$res[$k]['nickname'] = db::name('user')->where(['id' => $v['user_id']])->value('nickname');
|
||||||
|
}
|
||||||
|
return ['code' => 1, 'msg' => '获取成功', 'data' => $res];
|
||||||
|
} else {
|
||||||
|
return ['code' => 0, 'msg' => '暂无数据'];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 点歌
|
||||||
|
* @param song_id 歌曲id
|
||||||
|
* @param user_id 用户id
|
||||||
|
*/
|
||||||
|
public function singerSong($user_id, $song_id, $room_id)
|
||||||
|
{
|
||||||
|
//查询歌曲信息
|
||||||
|
$song = db::name('vs_singer_song')->where(['id' => $song_id])->find();
|
||||||
|
if (!$song) {
|
||||||
|
return ['code' => 0, 'msg' => '歌曲不存在'];
|
||||||
|
}
|
||||||
|
//查询用户余额
|
||||||
|
$user_money = db::name('user_wallet')->where(['user_id' => $user_id])->value('coin');
|
||||||
|
$gift_price = db::name('vs_gift')->where(['gid' => $song['gift_id']])->value('gift_price');
|
||||||
|
if ($user_money < $gift_price * $song['gift_num']) {
|
||||||
|
return ['code' => 0, 'msg' => '余额不足'];
|
||||||
|
}
|
||||||
|
|
||||||
|
//走送礼流程
|
||||||
|
$res = model('GiveGift')->give_gift($user_id,$song['user_id'],$song['gift_id'],$song['gift_num'],2,1,$room_id);
|
||||||
|
if ($res['code'] == 1) {
|
||||||
|
$data = [
|
||||||
|
'user_id' => $user_id,
|
||||||
|
'room_id' => $room_id,
|
||||||
|
'singer_song_id' => $song_id,
|
||||||
|
'createtime' => time()
|
||||||
|
];
|
||||||
|
$result = db::name('vs_song_log')->insert($data);
|
||||||
|
if (!$result) {
|
||||||
|
return ['code' => 0, 'msg' => '点歌失败'];
|
||||||
|
}
|
||||||
|
//给前端推送
|
||||||
|
$text = [
|
||||||
|
'text' => '房间点歌变化'
|
||||||
|
];
|
||||||
|
//聊天室推送系统消息
|
||||||
|
model('Chat')->sendMsg(1070,$room_id,$text);
|
||||||
|
|
||||||
|
return ['code' => 1, 'msg' => '点歌成功'];
|
||||||
|
} else {
|
||||||
|
return ['code' => 0, 'msg' => $res['msg']];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 点歌列表
|
||||||
|
* @param room_id 房间id
|
||||||
|
* @param type 类型 1:已点列表,2:今日列表,3:昨日列表,4:本周列表,5:本月列表
|
||||||
|
*/
|
||||||
|
public function singerSongList($room_id,$type)
|
||||||
|
{
|
||||||
|
$where = [
|
||||||
|
'room_id' => $room_id
|
||||||
|
];
|
||||||
|
switch ($type) {
|
||||||
|
case 2:
|
||||||
|
$where['createtime'] = ['between time',[strtotime(date('Y-m-d')),time()]];
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
$where['createtime'] = ['between time',[strtotime(date('Y-m-d',strtotime("-1 day"))),strtotime(date('Y-m-d'))]];
|
||||||
|
$where['status'] = 2;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
$where['createtime'] = ['between time',[strtotime(date('Y-m-d',strtotime("-1 week"))),time()]];
|
||||||
|
$where['status'] = 2;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
$where['createtime'] = ['between time',[strtotime(date('Y-m-d',strtotime("-1 month"))),time()]];
|
||||||
|
$where['status'] = 2;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
default:
|
||||||
|
$where['status'] = ['in','1,0'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$res = db::name('vs_song_log')->where($where)->order('sort desc')->select();
|
||||||
|
if ($res) {
|
||||||
|
foreach ($res as $k => $v) {
|
||||||
|
$res[$k]['boss_nickname'] = db::name('user')->where(['id' => $v['user_id']])->value('nickname');
|
||||||
|
$res[$k]['song_name'] = db::name('vs_singer_song')->where(['id' => $v['singer_song_id']])->value('song_name');
|
||||||
|
$res[$k]['gift_name'] = db::name('vs_gift')->where(['gid' => db::name('vs_singer_song')->where(['id' => $v['singer_song_id']])->value('gift_id')])->value('gift_name');
|
||||||
|
$res[$k]['gift_price'] = db::name('vs_gift')->where(['gid' => db::name('vs_singer_song')->where(['id' => $v['singer_song_id']])->value('gift_id')])->value('gift_price');
|
||||||
|
$res[$k]['base_image'] = db::name('vs_gift')->where(['gid' => db::name('vs_singer_song')->where(['id' => $v['singer_song_id']])->value('gift_id')])->value('base_image');
|
||||||
|
$res[$k]['gift_num'] = db::name('vs_singer_song')->where(['id' => $v['singer_song_id']])->value('gift_num');
|
||||||
|
$res[$k]['nickname'] = db::name('user')->where(['id' => db::name('vs_singer_song')->where(['id' => $v['singer_song_id']])->value('user_id')])->value('nickname');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ['code' => 1, 'msg' => '获取成功', 'data' => $res];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -173,6 +173,10 @@ class User extends Model
|
|||||||
}
|
}
|
||||||
$user_info['is_hide'] = $is_hide;//是否可以设置隐藏
|
$user_info['is_hide'] = $is_hide;//是否可以设置隐藏
|
||||||
$user_info['hide_status'] = db::name('user')->where('id',$uid)->value('hide_status');//0-取消隐身,1-隐身进入
|
$user_info['hide_status'] = db::name('user')->where('id',$uid)->value('hide_status');//0-取消隐身,1-隐身进入
|
||||||
|
//歌手认证
|
||||||
|
$singer = model('api/SingerSong')->singerAuthStatus($uid);
|
||||||
|
$user_info['singer_status'] = $singer['status'];//歌手认证状态0-待审核,1-通过,2-拒绝 -1-未认证
|
||||||
|
$user_info['singer_level'] = $singer['level'];
|
||||||
|
|
||||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $user_info];
|
return ['code' => 1, 'msg' => '获取成功', 'data' => $user_info];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user