2025-08-07 20:21:47 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
|
|
|
|
|
|
use app\common\controller\BaseCom;
|
|
|
|
|
|
use think\Db;
|
|
|
|
|
|
|
|
|
|
|
|
class Room extends BaseCom
|
|
|
|
|
|
{
|
|
|
|
|
|
//创建房间
|
|
|
|
|
|
public function create_room()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_name = input('room_name', '');
|
|
|
|
|
|
$room_cover = input('room_cover', '');
|
|
|
|
|
|
$room_intro = input('room_intro', '');
|
|
|
|
|
|
$key_name = "api:room:user_create_room:" . $this->uid;
|
|
|
|
|
|
redis_lock_exits($key_name);
|
|
|
|
|
|
$reslut = model('Room')->user_create_room($this->uid, $room_name, $room_cover, $room_intro);
|
|
|
|
|
|
redis_unlock($key_name);
|
|
|
|
|
|
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//编辑房间
|
|
|
|
|
|
public function edit_room()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$room_name = input('room_name', '');
|
|
|
|
|
|
$room_cover = input('room_cover', '');
|
|
|
|
|
|
$room_intro = input('room_intro', '');
|
|
|
|
|
|
$room_background_id = input('room_background', '');
|
|
|
|
|
|
|
|
|
|
|
|
$reslut = model('Room')->user_edit_room($this->uid, $room_id, $room_name, $room_cover, $room_intro,$room_background_id);
|
|
|
|
|
|
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//关注的用户现在所在房间(废弃)
|
|
|
|
|
|
public function user_follow_in_room_list()
|
|
|
|
|
|
{
|
|
|
|
|
|
$page = input('page', 1);
|
|
|
|
|
|
$page_limit = input('page_limit', 15);
|
|
|
|
|
|
|
|
|
|
|
|
$reslut = model('Room')->user_follow_in_room_list($this->uid, $page, $page_limit);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//房间随机名称
|
|
|
|
|
|
public function room_random_name()
|
|
|
|
|
|
{
|
|
|
|
|
|
return V(1, '获取成功', generateRandomRoomName());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 房间历史足迹
|
|
|
|
|
|
public function user_room_history_list()
|
|
|
|
|
|
{
|
|
|
|
|
|
$page = input('page', 1);
|
|
|
|
|
|
$page_limit = input('page_limit', 15);
|
|
|
|
|
|
$reslut = model('UserData')->user_room_history_list($this->uid, $page, $page_limit);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//删除历史足迹
|
|
|
|
|
|
public function delete_room_history()
|
|
|
|
|
|
{
|
|
|
|
|
|
$reslut = model('UserData')->delete_room_history($this->uid);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//我创建/主持/管理/关注的房间
|
|
|
|
|
|
public function my_associated_room()
|
|
|
|
|
|
{
|
|
|
|
|
|
$page = input('page', 1);
|
|
|
|
|
|
$page_limit = input('page_limit', 15);
|
|
|
|
|
|
$type = input('type', 0);//0-我创建的 1-我主持的 2-我管理的 3-我关注的
|
|
|
|
|
|
$reslut = model('Room')->my_associated_room($this->uid, $type, $page, $page_limit);
|
|
|
|
|
|
return V(1, '获取成功', $reslut);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//我的Cp房
|
|
|
|
|
|
public function my_cp_room()
|
|
|
|
|
|
{
|
|
|
|
|
|
$reslut = model('Room')->my_cp_room($this->uid);
|
|
|
|
|
|
return V(1, '获取成功', $reslut);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//房间补贴
|
|
|
|
|
|
public function room_ubsidy()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$reslut = model('Room')->room_ubsidy($room_id);
|
|
|
|
|
|
return V(1, '获取成功', $reslut);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//房间历史补贴记录
|
|
|
|
|
|
public function room_subsidy_history()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$page = input('page', 1);
|
|
|
|
|
|
$page_limit = input('page_limit', 15);
|
|
|
|
|
|
$reslut = model('Room')->room_subsidy_history($room_id, $page, $page_limit);
|
|
|
|
|
|
return V(1, '获取成功', $reslut);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//房间流水明细
|
|
|
|
|
|
public function room_turnover_detail()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$start_time = input('start_time', '');
|
|
|
|
|
|
$end_time = input('end_time', '');
|
|
|
|
|
|
$page = input('page', 1);
|
|
|
|
|
|
$page_limit = input('page_limit', 15);
|
|
|
|
|
|
$reslut = model('Room')->room_turnover_detail($room_id, $start_time, $end_time, $page, $page_limit);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
* 进入房间
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function join_room()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$password = input('password', '');
|
|
|
|
|
|
$reslut = model('Room')->join_room($this->uid, $room_id, $password);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//退出房间
|
|
|
|
|
|
public function quit_room()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$user_id = input('user_id', 0);
|
|
|
|
|
|
$reslut = model('Room')->quit_room($this->uid, $room_id,$user_id);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//踢出房间
|
|
|
|
|
|
public function kick_out_room()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$user_id = input('user_id', 0);
|
|
|
|
|
|
$reslut = model('Room')->quit_room($this->uid, $room_id,$user_id,1);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//直播间送礼
|
|
|
|
|
|
public function room_give_gift()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$gift_id = input('gift_id', 0);
|
|
|
|
|
|
$gift_num = input('gift_num', 0);
|
|
|
|
|
|
$to_uid = input('to_uid', 0);//收礼人ID,逗号隔开的字符串
|
|
|
|
|
|
$type = input('type', 1);//1金币购买 2送背包礼物
|
|
|
|
|
|
$pit_number = input('pit_number', 0);
|
|
|
|
|
|
|
|
|
|
|
|
$reslut = model('Room')->room_gift($this->uid, $to_uid, $gift_id, $gift_num, $type, $room_id, $pit_number);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//房间榜单
|
|
|
|
|
|
public function room_rank()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$type = input('type', 1);//1财富榜,2魅力榜
|
|
|
|
|
|
$timeType = input('time_type', 1);//1小时榜,2天榜,3周榜,
|
|
|
|
|
|
$page = input('page', 1);
|
|
|
|
|
|
$limit = input('limit', 30);
|
|
|
|
|
|
$reslut = model('Room')->room_rank($room_id, $type, $timeType, $page, $limit);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//房间在线列表
|
|
|
|
|
|
public function room_online_list()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$page = input('page', 1);
|
|
|
|
|
|
$limit = input('limit', 50);
|
|
|
|
|
|
$reslut = model('Room')->room_online_list($room_id, $page, $limit);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//房间内用户主页(房间内点头像)
|
|
|
|
|
|
public function room_user_home()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$user_id = input('user_id', 0);
|
|
|
|
|
|
$reslut = model('Room')->room_user_home($this->uid,$room_id, $user_id);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//设置开播提醒
|
|
|
|
|
|
public function set_live_reminder()
|
|
|
|
|
|
{
|
|
|
|
|
|
$user_id = input('user_id', 0);
|
|
|
|
|
|
$reslut = model('Room')->set_live_reminder($this->uid, $user_id);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//当前发(抢)头条需要的数据
|
|
|
|
|
|
public function current_headline()
|
|
|
|
|
|
{
|
|
|
|
|
|
$reslut = model('HeadLine')->current_headline();
|
|
|
|
|
|
return V(1, '成功', $reslut);
|
|
|
|
|
|
}
|
|
|
|
|
|
//发(抢)头条
|
|
|
|
|
|
public function send_headline()
|
|
|
|
|
|
{
|
|
|
|
|
|
$content = input('content', '');
|
|
|
|
|
|
$money = input('money', 0);
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$reslut = model('HeadLine')->send_headline($this->uid,$money,$content,$room_id);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//设置主持
|
|
|
|
|
|
public function set_host()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$user_id = input('user_id', 0);
|
|
|
|
|
|
$type = input('type', 1);//1-主持,2管理
|
|
|
|
|
|
$is_add = input('is_add', 1);//1-添加,2-删除
|
|
|
|
|
|
$reslut = model('Room')->set_host($this->uid, $room_id, $user_id,$type,$is_add);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//主持人,管理员列表
|
|
|
|
|
|
public function host_list()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$type = input('type', 0);
|
|
|
|
|
|
$reslut = model('Room')->host_list($room_id,$type);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//设置主持人收益
|
|
|
|
|
|
public function set_host_profit()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$host_id = input('user_id', 0);
|
|
|
|
|
|
$ratio = input('ratio', 0);
|
|
|
|
|
|
$reslut = model('Room')->set_host_profit($this->uid, $room_id, $host_id,$ratio);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//清除房间用户魅力
|
|
|
|
|
|
public function clear_user_charm()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$user_id = input('user_id', 0);
|
|
|
|
|
|
$reslut = model('Room')->clear_user_charm($this->uid, $room_id,$user_id);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//修改房间类型
|
|
|
|
|
|
public function change_room_type()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$type = input('type', 1);//1-点唱,2-拍卖,3-男神,4-女神
|
|
|
|
|
|
$reslut = model('Room')->change_room_type($this->uid, $room_id, $type);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新用户声网的token
|
|
|
|
|
|
public function update_user_sw_token()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$reslut = model('Room')->update_user_token($this->uid, $room_id);
|
|
|
|
|
|
return V(1, '成功', $reslut);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//更新房间声网的RTM token
|
|
|
|
|
|
public function update_rtm_token()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$reslut = model('Room')->update_rtm_token($this->uid, $room_id);
|
|
|
|
|
|
return V(1, '成功', $reslut);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//房间信息
|
|
|
|
|
|
public function room_info()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$reslut = model('Room')->room_info($this->uid, $room_id);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//禁言 禁麦 \解禁
|
|
|
|
|
|
public function set_mute()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$user_id = input('user_id', 0);
|
|
|
|
|
|
$is_mute = input('is_mute', 1);//1-禁言,2-禁麦,3-解禁,4-解麦
|
|
|
|
|
|
$reslut = model('Room')->set_mute($this->uid, $room_id, $user_id,$is_mute);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//禁麦 \解禁
|
|
|
|
|
|
// public function set_mute_pit()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// $room_id = input('room_id', 0);
|
|
|
|
|
|
// $pit_number = input('pit_number', 0);
|
|
|
|
|
|
// $is_mute = input('is_mute', 0);//0 未禁麦 1已
|
|
|
|
|
|
// $reslut = model('Room')->set_mute_pit($this->uid, $room_id, $pit_number,$is_mute);
|
|
|
|
|
|
// return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
//锁麦\解锁
|
|
|
|
|
|
public function set_lock_pit()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$pit_number = input('pit_number', 0);
|
|
|
|
|
|
$is_mute = input('is_lock', 0);// 0 未锁麦 1已锁麦
|
|
|
|
|
|
$reslut = model('Room')->set_lock_pit($this->uid, $room_id, $pit_number,$is_mute);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//房间背景列表
|
|
|
|
|
|
public function room_bg_list()
|
|
|
|
|
|
{
|
|
|
|
|
|
$reslut['public_bg'] = db::name('vs_room_background')->where(['upload_user'=>0,'status' => 1,'delete_time' => null])->select();
|
|
|
|
|
|
$reslut['private_bg'] = db::name('vs_room_background')->where(['upload_user'=>$this->uid,'status' => 1,'delete_time' => null])->select();
|
|
|
|
|
|
return V(1, '成功', $reslut);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//上传背景图片
|
|
|
|
|
|
public function upload_bg_img()
|
|
|
|
|
|
{
|
|
|
|
|
|
$id = input('id', 0);
|
|
|
|
|
|
$image_url = input('image_url', 0);
|
|
|
|
|
|
$reslut = model('Room')->upload_bg_img($this->uid, $image_url, $id);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//关系卡,关系位
|
|
|
|
|
|
public function relation_card()
|
|
|
|
|
|
{
|
|
|
|
|
|
$user_id = input('user_id', 0);
|
|
|
|
|
|
$reslut = model('Room')->relation_card($this->uid, $user_id);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//置顶关系卡,关系位
|
|
|
|
|
|
public function top_relation_card()
|
|
|
|
|
|
{
|
|
|
|
|
|
$relation_card_id = input('id', 0);
|
|
|
|
|
|
$reslut = model('Room')->top_relation_card($this->uid, $relation_card_id);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//删除关系卡,关系位
|
|
|
|
|
|
public function delete_relation_card()
|
|
|
|
|
|
{
|
|
|
|
|
|
$relation_card_id = input('id', 0);
|
|
|
|
|
|
$reslut = model('Room')->delete_relation_card($this->uid, $relation_card_id);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//记录房间操作
|
|
|
|
|
|
public function room_operation_record()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$type = input('type', 0);//1-禁麦位,2-清空消息,3-清空魅力值,4-加入黑名单,5-踢出房间,6-关闭麦克风,7-申请上麦,8-同意上麦,9-拒绝上麦,10-点歌,11-开启PK',
|
|
|
|
|
|
model('Room')->room_operation_record($this->uid,$room_id,$type);
|
|
|
|
|
|
return V(1, '成功', null);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//用户状态查询
|
|
|
|
|
|
public function user_online_status()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$user_id = input('user_id', '');
|
|
|
|
|
|
$reslut = model('Room')->user_online_status($room_id, $user_id);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//隐藏房间
|
|
|
|
|
|
public function hide_room()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$reslut = model('Room')->hide_room($this->uid, $room_id);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//房间内在线人数
|
|
|
|
|
|
public function room_online_number()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$reslut = model('Room')->room_online_number($room_id);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
2025-08-11 15:01:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//房间在线列表
|
|
|
|
|
|
public function room_online_list_ceshi()
|
|
|
|
|
|
{
|
|
|
|
|
|
$room_id = input('room_id', 0);
|
|
|
|
|
|
$page = input('page', 1);
|
|
|
|
|
|
$limit = input('limit', 50);
|
|
|
|
|
|
$reslut = model('Room')->room_online_list($room_id, $page, $limit);
|
|
|
|
|
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
|
|
}
|
2025-08-07 20:21:47 +08:00
|
|
|
|
}
|