|
@@ -14,7 +14,7 @@ use think\exception\ValidateException;
|
|
use think\Request;
|
|
use think\Request;
|
|
use app\common\service\RoomService;
|
|
use app\common\service\RoomService;
|
|
use app\common\library\GatewayworkerTools;
|
|
use app\common\library\GatewayworkerTools;
|
|
-
|
|
|
|
|
|
+use app\common\library\Easemob;
|
|
/**
|
|
/**
|
|
* 派对信息接口
|
|
* 派对信息接口
|
|
*/
|
|
*/
|
|
@@ -35,7 +35,7 @@ class Party extends Common
|
|
* 创建/进入派对
|
|
* 创建/进入派对
|
|
*/
|
|
*/
|
|
public function createParty() {
|
|
public function createParty() {
|
|
- $room_type = $this->request->request('room_type',2); // 房间类型:1=派对,2=直播
|
|
|
|
|
|
+ $room_type = input('room_type',2); // 房间类型:1=派对,2=直播
|
|
$partyModel = new \app\common\model\Party();
|
|
$partyModel = new \app\common\model\Party();
|
|
|
|
|
|
$user_id = $this->auth->id;
|
|
$user_id = $this->auth->id;
|
|
@@ -91,15 +91,7 @@ class Party extends Common
|
|
$where["user_id"] = $user_id;
|
|
$where["user_id"] = $user_id;
|
|
$where["room_type"] = $room_type;
|
|
$where["room_type"] = $room_type;
|
|
$sqlPartyInfo = $partyModel->where($where)->find();
|
|
$sqlPartyInfo = $partyModel->where($where)->find();
|
|
- if(!empty($sqlPartyInfo) && $sqlPartyInfo["status"] == 0){
|
|
|
|
- // 清楚对应的记录
|
|
|
|
- $redis->del($this->roomTypeArr[$room_type]."_".$sqlPartyInfo["id"]);
|
|
|
|
- // 删除派对记录
|
|
|
|
- \app\common\model\Party::where('id',$sqlPartyInfo["id"])->delete();
|
|
|
|
- $where["user_id"] = $user_id;
|
|
|
|
- $where["room_type"] = $room_type;
|
|
|
|
- $sqlPartyInfo = $partyModel->where($where)->find();
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
if(!$sqlPartyInfo) { // sql中不存在派对信息
|
|
if(!$sqlPartyInfo) { // sql中不存在派对信息
|
|
$partylimit = config("site.roomLimit");
|
|
$partylimit = config("site.roomLimit");
|
|
$partycount = $partyModel->where(['is_close'=>0])->count("id");
|
|
$partycount = $partyModel->where(['is_close'=>0])->count("id");
|
|
@@ -109,17 +101,15 @@ class Party extends Common
|
|
|
|
|
|
$party_name = $this->auth->u_id."的房间"; // 派对名称
|
|
$party_name = $this->auth->u_id."的房间"; // 派对名称
|
|
$party_logo = "/assets/api/party_logo.png"; // 派对logo
|
|
$party_logo = "/assets/api/party_logo.png"; // 派对logo
|
|
- $party_type = isset($anchorInfo['party_type_id']) ? $anchorInfo['party_type_id'] : 8; // 派对类型(情感互动,心动点单 等)
|
|
|
|
|
|
+ $party_type = 8; // 派对类型(情感互动,心动点单 等)
|
|
$party_notice = "请编辑房间公告"; // 派对公告
|
|
$party_notice = "请编辑房间公告"; // 派对公告
|
|
$party_notice_detail = "请编辑房间公告内容!"; // 派对公告详情
|
|
$party_notice_detail = "请编辑房间公告内容!"; // 派对公告详情
|
|
- if (!$party_name || !$party_logo || !$party_notice) {
|
|
|
|
- $this->error(__('Invalid parameters'));
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
$party_ids = $partyModel->column("party_id");
|
|
$party_ids = $partyModel->column("party_id");
|
|
// 创建派对ID (临时ID四位,派对数不超过8999)
|
|
// 创建派对ID (临时ID四位,派对数不超过8999)
|
|
$party_id = $this->auth->getUinqueId(4,$party_ids);
|
|
$party_id = $this->auth->getUinqueId(4,$party_ids);
|
|
if($party_id > 9999) {
|
|
if($party_id > 9999) {
|
|
- $this->error("派对超限,请联系客服");
|
|
|
|
|
|
+ $this->error("房间超限,请联系客服");
|
|
}
|
|
}
|
|
if ($room_type == 1) {//家族房间获取家族信息
|
|
if ($room_type == 1) {//家族房间获取家族信息
|
|
$guildWhere['user_id'] = $user_id;
|
|
$guildWhere['user_id'] = $user_id;
|
|
@@ -133,6 +123,16 @@ class Party extends Common
|
|
}
|
|
}
|
|
$party_type = 7;
|
|
$party_type = 7;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //[环信]创建聊天室
|
|
|
|
+ $easemob = new Easemob();
|
|
|
|
+ $easemob_room_id = $easemob->room_create($party_name,$party_notice,$this->auth->id);
|
|
|
|
+ if(empty($easemob_room_id)){
|
|
|
|
+ $this->error('创建房间失败');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Db::startTrans();
|
|
|
|
+ //写入派对
|
|
$data = [];
|
|
$data = [];
|
|
$data["user_id"] = $this->auth->id;
|
|
$data["user_id"] = $this->auth->id;
|
|
$data["room_type"] = $room_type;
|
|
$data["room_type"] = $room_type;
|
|
@@ -144,12 +144,14 @@ class Party extends Common
|
|
$data["party_notice"] = $party_notice;
|
|
$data["party_notice"] = $party_notice;
|
|
$data["party_notice_detail"] = $party_notice_detail;
|
|
$data["party_notice_detail"] = $party_notice_detail;
|
|
$data["is_online"] = 1;
|
|
$data["is_online"] = 1;
|
|
- $data["status"] = 0;//前端创建成功后会调用接口修改房间状态
|
|
|
|
|
|
+ $data["status"] = 1;
|
|
$data["is_recommend"] = 0;
|
|
$data["is_recommend"] = 0;
|
|
$data["createtime"] = time();
|
|
$data["createtime"] = time();
|
|
|
|
+ $data["easemob_room_id"] = $easemob_room_id;
|
|
$id = $partyModel->insertGetId($data);
|
|
$id = $partyModel->insertGetId($data);
|
|
if(!$id) {
|
|
if(!$id) {
|
|
- $this->error("派对创建失败,请稍后重试!");
|
|
|
|
|
|
+ Db::rollback();
|
|
|
|
+ $this->error("房间创建失败,请稍后重试!");
|
|
}
|
|
}
|
|
$data["id"] = $id;
|
|
$data["id"] = $id;
|
|
|
|
|
|
@@ -191,25 +193,19 @@ class Party extends Common
|
|
$guildWhere['status'] = 1;
|
|
$guildWhere['status'] = 1;
|
|
$guild = model('Guild')->where($guildWhere)->order('id desc')->find();
|
|
$guild = model('Guild')->where($guildWhere)->order('id desc')->find();
|
|
if (!empty($guild)) {
|
|
if (!empty($guild)) {
|
|
- model('Guild')->where($guildWhere)->update(['party_id'=>$partyInfo['id']]);
|
|
|
|
|
|
+ $rs_guild = model('Guild')->where($guildWhere)->update(['party_id'=>$partyInfo['id']]);
|
|
|
|
+ if($rs_guild === false){
|
|
|
|
+ Db::rollback();
|
|
|
|
+ $this->error('创建房间失败');
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ Db::commit();
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
if($sqlPartyInfo["is_close"] == 1) $this->error("该房间已被关闭!");
|
|
if($sqlPartyInfo["is_close"] == 1) $this->error("该房间已被关闭!");
|
|
- if($sqlPartyInfo["status"] == 0){
|
|
|
|
- // 清楚对应的记录
|
|
|
|
- $redis->del($this->roomTypeArr[$room_type]."_".$sqlPartyInfo["id"]);
|
|
|
|
- // 删除派对记录
|
|
|
|
- \app\common\model\Party::where('id',$sqlPartyInfo["id"])->delete();
|
|
|
|
|
|
|
|
- $this->error("创建失败,请重试");//不清楚具体要做什么先注释
|
|
|
|
- }
|
|
|
|
-// if($sqlPartyInfo["status"] != 1) $this->error("该房间为预创建房间,请联系管理员正式开通!");
|
|
|
|
- // 如果是房主并且房间处于离线状态下激活
|
|
|
|
- if ($sqlPartyInfo['user_id'] != $user_id) {
|
|
|
|
- $this->error("当前直播已结束!");
|
|
|
|
- }
|
|
|
|
$partyInfo = $sqlPartyInfo;
|
|
$partyInfo = $sqlPartyInfo;
|
|
$partyInfo["is_new"] = 0;
|
|
$partyInfo["is_new"] = 0;
|
|
}
|
|
}
|
|
@@ -217,53 +213,14 @@ class Party extends Common
|
|
$this->success("获取成功!",$partyInfo);
|
|
$this->success("获取成功!",$partyInfo);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 更新房间状态为正常
|
|
|
|
- */
|
|
|
|
- public function savePartyStatus() {
|
|
|
|
- $party_id = $this->request->request('party_id'); // 派对ID
|
|
|
|
- $room_type = $this->request->request('room_type',1); // 房间类型:1=派对,2=直播
|
|
|
|
- if (!$party_id || !in_array($room_type,[1,2])) $this->error(__('Invalid parameters'));
|
|
|
|
- $user_id = $this->auth->id;
|
|
|
|
- $partyInfo = \app\common\model\Party::get($party_id);
|
|
|
|
- if($partyInfo->status < 0) $this->error("当前状态不支持变更!");
|
|
|
|
- if($partyInfo->user_id !== $user_id) $this->error("当前账号异常,非工会长禁止操作!");
|
|
|
|
- $partyInfo->status = 1;
|
|
|
|
- $res = $partyInfo->save();
|
|
|
|
-
|
|
|
|
- if($res !== false) {
|
|
|
|
- // 更新redis 加入缓存排序
|
|
|
|
- $redis = new Redis();
|
|
|
|
- $redisconfig = config("redis");
|
|
|
|
- $redis->connect($redisconfig["host"], $redisconfig["port"]);
|
|
|
|
- if ($redisconfig['redis_pwd']) {
|
|
|
|
- $redis->auth($redisconfig['redis_pwd']);
|
|
|
|
- }
|
|
|
|
- if($redisconfig['redis_selectdb'] > 0){
|
|
|
|
- $redis->select($redisconfig['redis_selectdb']);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 更新redis 加入缓存
|
|
|
|
- $redPartyInfo = $redis->get($this->roomTypeArr[$room_type]."_".$partyInfo["id"]);
|
|
|
|
- if($redPartyInfo) {
|
|
|
|
- $redPartyInfo = json_decode($redPartyInfo,true);
|
|
|
|
- $redPartyInfo["status"] = 1;
|
|
|
|
- $redis->set($this->roomTypeArr[$room_type]."_".$partyInfo["id"],json_encode($redPartyInfo));
|
|
|
|
- }
|
|
|
|
- $this->success("更新公会状态成功!");
|
|
|
|
- } else {
|
|
|
|
- $this->error("网络错误,请稍后重试!");
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 删除派对(群解散)
|
|
* 删除派对(群解散)
|
|
*/
|
|
*/
|
|
public function closeParty() {
|
|
public function closeParty() {
|
|
- $party_id = $this->request->request('party_id'); // 派对ID
|
|
|
|
- $room_type = $this->request->request('room_type',1); // 房间类型:1=派对,2=直播
|
|
|
|
|
|
+ $party_id = input('party_id'); // 派对ID
|
|
|
|
+ $room_type = input('room_type',1); // 房间类型:1=派对,2=直播
|
|
if (!$party_id || !in_array($room_type,[1,2])) $this->error(__('Invalid parameters'));
|
|
if (!$party_id || !in_array($room_type,[1,2])) $this->error(__('Invalid parameters'));
|
|
$partyInfo = \app\common\model\Party::where(["id"=>$party_id])->find();
|
|
$partyInfo = \app\common\model\Party::where(["id"=>$party_id])->find();
|
|
if(!$partyInfo) $this->error(__('派对不存在!'));
|
|
if(!$partyInfo) $this->error(__('派对不存在!'));
|
|
@@ -291,13 +248,13 @@ class Party extends Common
|
|
* 获取派对列表排序
|
|
* 获取派对列表排序
|
|
*/
|
|
*/
|
|
public function getPartyRankList() {
|
|
public function getPartyRankList() {
|
|
- $thispage = $this->request->request('thispage',1,"intval"); // 当前页数
|
|
|
|
- $pagenum = $this->request->request('pagenum',10,"intval"); // 每页显示条数0=不做分页
|
|
|
|
- $type_id = $this->request->request('type_id'); // 派对类型
|
|
|
|
- $room_type = $this->request->request('room_type',1); // 房间类型:1=派对,2=直播
|
|
|
|
- $is_recommend = $this->request->request('is_recommend'); // 推荐0=否1=是
|
|
|
|
- $all = $this->request->request('all'); // 全部分类0=否1=是
|
|
|
|
- $index = $this->request->request('index',0); // 全部分类0=否1=是
|
|
|
|
|
|
+ $thispage = input('thispage',1,"intval"); // 当前页数
|
|
|
|
+ $pagenum = input('pagenum',10,"intval"); // 每页显示条数0=不做分页
|
|
|
|
+ $type_id = input('type_id'); // 派对类型
|
|
|
|
+ $room_type = input('room_type',1); // 房间类型:1=派对,2=直播
|
|
|
|
+ $is_recommend = input('is_recommend'); // 推荐0=否1=是
|
|
|
|
+ $all = input('all'); // 全部分类0=否1=是
|
|
|
|
+ $index = input('index',0); // 全部分类0=否1=是
|
|
|
|
|
|
$start = ($thispage-1)*$pagenum;
|
|
$start = ($thispage-1)*$pagenum;
|
|
$end = $start+($pagenum-1);
|
|
$end = $start+($pagenum-1);
|
|
@@ -355,12 +312,12 @@ class Party extends Common
|
|
*/
|
|
*/
|
|
public function getPartyList() {
|
|
public function getPartyList() {
|
|
try {
|
|
try {
|
|
- $thispage = $this->request->request('thispage',1,"intval"); // 当前页数
|
|
|
|
- $pagenum = $this->request->request('pagenum',10,"intval"); // 每页显示条数0=不做分页
|
|
|
|
- $type_id = $this->request->request('type_id'); // 派对类型
|
|
|
|
- $is_recommend = $this->request->request('is_recommend'); // 推荐0=否1=是
|
|
|
|
- $all = $this->request->request('all'); // 全部分类0=否1=是
|
|
|
|
- $index = $this->request->request('index',0); // 全部分类0=否1=是
|
|
|
|
|
|
+ $thispage = input('thispage',1,"intval"); // 当前页数
|
|
|
|
+ $pagenum = input('pagenum',10,"intval"); // 每页显示条数0=不做分页
|
|
|
|
+ $type_id = input('type_id'); // 派对类型
|
|
|
|
+ $is_recommend = input('is_recommend'); // 推荐0=否1=是
|
|
|
|
+ $all = input('all'); // 全部分类0=否1=是
|
|
|
|
+ $index = input('index',0); // 全部分类0=否1=是
|
|
|
|
|
|
$start = ($thispage-1)*$pagenum;
|
|
$start = ($thispage-1)*$pagenum;
|
|
$end = $start+($pagenum-1);
|
|
$end = $start+($pagenum-1);
|
|
@@ -420,8 +377,8 @@ class Party extends Common
|
|
* 获取派对用户排序
|
|
* 获取派对用户排序
|
|
*/
|
|
*/
|
|
public function getPartyUserRank() {
|
|
public function getPartyUserRank() {
|
|
- $room_type = $this->request->request('room_type',1); // 房间类型
|
|
|
|
- $party_id = $this->request->request("party_id");// 派对ID
|
|
|
|
|
|
+ $room_type = input('room_type',1); // 房间类型
|
|
|
|
+ $party_id = input("party_id");// 派对ID
|
|
if (!$party_id) $this->error(__('Invalid parameters'));
|
|
if (!$party_id) $this->error(__('Invalid parameters'));
|
|
$redis = new Redis();
|
|
$redis = new Redis();
|
|
$redisconfig = config("redis");
|
|
$redisconfig = config("redis");
|
|
@@ -478,9 +435,9 @@ class Party extends Common
|
|
* 派对热度更新(已废弃)
|
|
* 派对热度更新(已废弃)
|
|
*/
|
|
*/
|
|
public function changeUserPartyhot() {
|
|
public function changeUserPartyhot() {
|
|
- $party_id = $this->request->request('party_id',0,"intval"); // 派对ID
|
|
|
|
- $room_type = $this->request->request('room_type',1); // 房间类型
|
|
|
|
- $party_hot = $this->request->request('party_hot'); // 房间热度(正数表示提高的热度值,负数表示降低的热度值)
|
|
|
|
|
|
+ $party_id = input('party_id',0,"intval"); // 派对ID
|
|
|
|
+ $room_type = input('room_type',1); // 房间类型
|
|
|
|
+ $party_hot = input('party_hot'); // 房间热度(正数表示提高的热度值,负数表示降低的热度值)
|
|
if (!$party_id || !$party_hot) {
|
|
if (!$party_id || !$party_hot) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -503,12 +460,12 @@ class Party extends Common
|
|
* 更新主持人和麦位前四位至首页房间排行
|
|
* 更新主持人和麦位前四位至首页房间排行
|
|
*/
|
|
*/
|
|
public function addUserPositionToParty() {
|
|
public function addUserPositionToParty() {
|
|
- $party_id = $this->request->request('party_id',0,"intval"); // 直播间ID
|
|
|
|
- $user_id = $this->request->request('user_id',0,"intval"); // 用户ID
|
|
|
|
- $upOrdown = $this->request->request('upordown'); // 上下麦:1=上麦-1=下麦
|
|
|
|
- $room_type = $this->request->request('room_type',1); // 房间类型
|
|
|
|
- $avatar = $this->request->request('avatar'); // 用户头像 (upOrdown参数为-1时可以不传)
|
|
|
|
- $position = $this->request->request('position'); // 麦位置:0=支持人,1=1号麦,2=2号麦,3=3号麦,4=4号麦
|
|
|
|
|
|
+ $party_id = input('party_id',0,"intval"); // 直播间ID
|
|
|
|
+ $user_id = input('user_id',0,"intval"); // 用户ID
|
|
|
|
+ $upOrdown = input('upordown'); // 上下麦:1=上麦-1=下麦
|
|
|
|
+ $room_type = input('room_type',1); // 房间类型
|
|
|
|
+ $avatar = input('avatar'); // 用户头像 (upOrdown参数为-1时可以不传)
|
|
|
|
+ $position = input('position'); // 麦位置:0=支持人,1=1号麦,2=2号麦,3=3号麦,4=4号麦
|
|
if (!$party_id || !$user_id || !in_array($position,[0,1,2,3,4,5,6,7,8]) || !in_array($upOrdown,[1,-1])) {
|
|
if (!$party_id || !$user_id || !in_array($position,[0,1,2,3,4,5,6,7,8]) || !in_array($upOrdown,[1,-1])) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -568,9 +525,9 @@ class Party extends Common
|
|
* 获取派对在线人数列表
|
|
* 获取派对在线人数列表
|
|
*/
|
|
*/
|
|
public function getOnlieList() {
|
|
public function getOnlieList() {
|
|
- $party_id = $this->request->request('party_id',0,"intval"); // 直播间ID 逻辑ID
|
|
|
|
- $page = $this->request->request('page',1); // 分页
|
|
|
|
- $pageNum = $this->request->request('pageNum',10); // 分页
|
|
|
|
|
|
+ $party_id = input('party_id',0,"intval"); // 直播间ID 逻辑ID
|
|
|
|
+ $page = input('page',1); // 分页
|
|
|
|
+ $pageNum = input('pageNum',10); // 分页
|
|
// 分页搜索构建
|
|
// 分页搜索构建
|
|
$pageStart = ($page-1)*$pageNum;
|
|
$pageStart = ($page-1)*$pageNum;
|
|
if (!$party_id) {
|
|
if (!$party_id) {
|
|
@@ -641,9 +598,9 @@ class Party extends Common
|
|
* 加入派对
|
|
* 加入派对
|
|
*/
|
|
*/
|
|
public function joinParty() {
|
|
public function joinParty() {
|
|
- $party_id = $this->request->request('party_id',0,"intval"); // 直播间ID 逻辑ID
|
|
|
|
- $room_type = $this->request->request("room_type",1);//
|
|
|
|
- $party_pass = $this->request->request("party_pass");//
|
|
|
|
|
|
+ $party_id = input('party_id',0,"intval"); // 直播间ID 逻辑ID
|
|
|
|
+ $room_type = input("room_type",1);//
|
|
|
|
+ $party_pass = input("party_pass");//
|
|
if (!$party_id || !in_array($room_type,[1,2])) {
|
|
if (!$party_id || !in_array($room_type,[1,2])) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -779,8 +736,8 @@ class Party extends Common
|
|
* 判断是否被禁言
|
|
* 判断是否被禁言
|
|
*/
|
|
*/
|
|
public function isNotalk() {
|
|
public function isNotalk() {
|
|
- $party_id = $this->request->request('party_id',0,"intval"); // 直播间ID 逻辑ID
|
|
|
|
- $user_id = $this->request->request('user_id',0,"intval"); // 用户ID 逻辑ID
|
|
|
|
|
|
+ $party_id = input('party_id',0,"intval"); // 直播间ID 逻辑ID
|
|
|
|
+ $user_id = input('user_id',0,"intval"); // 用户ID 逻辑ID
|
|
if (!$user_id || !$party_id) {
|
|
if (!$user_id || !$party_id) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -816,7 +773,7 @@ class Party extends Common
|
|
* 退出派对
|
|
* 退出派对
|
|
*/
|
|
*/
|
|
public function outParty() {
|
|
public function outParty() {
|
|
- $party_id = $this->request->request('party_id',0,"intval"); // 直播间ID
|
|
|
|
|
|
+ $party_id = input('party_id',0,"intval"); // 直播间ID
|
|
if (!$party_id) {
|
|
if (!$party_id) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -870,8 +827,8 @@ class Party extends Common
|
|
* 派对内搜索用户
|
|
* 派对内搜索用户
|
|
*/
|
|
*/
|
|
public function searchUserParty() {
|
|
public function searchUserParty() {
|
|
- $u_id = $this->request->request('u_id',0,"intval"); // 用户u_id
|
|
|
|
- $party_id = $this->request->request('party_id',0,"intval"); // 直播间ID
|
|
|
|
|
|
+ $u_id = input('u_id',0,"intval"); // 用户u_id
|
|
|
|
+ $party_id = input('party_id',0,"intval"); // 直播间ID
|
|
|
|
|
|
// $redis = new Redis();
|
|
// $redis = new Redis();
|
|
// $redisconfig = config("redis");
|
|
// $redisconfig = config("redis");
|
|
@@ -899,9 +856,9 @@ class Party extends Common
|
|
* 设置冠名
|
|
* 设置冠名
|
|
*/
|
|
*/
|
|
public function setNaming() {
|
|
public function setNaming() {
|
|
- $party_id = $this->request->request('party_id',0,"intval"); // 直播间ID
|
|
|
|
- $user_id = $this->request->request('user_id',0,"intval"); // 用户ID
|
|
|
|
- $type = $this->request->request('type',1); // 1:设置 0:取消设置
|
|
|
|
|
|
+ $party_id = input('party_id',0,"intval"); // 直播间ID
|
|
|
|
+ $user_id = input('user_id',0,"intval"); // 用户ID
|
|
|
|
+ $type = input('type',1); // 1:设置 0:取消设置
|
|
if (!$party_id || !$user_id || ($type != 1 && $type != 0)) {
|
|
if (!$party_id || !$user_id || ($type != 1 && $type != 0)) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -944,7 +901,7 @@ class Party extends Common
|
|
* 派对收藏
|
|
* 派对收藏
|
|
*/
|
|
*/
|
|
public function cellectionParty() {
|
|
public function cellectionParty() {
|
|
- $party_id = $this->request->request('party_id',0,"intval"); // 直播间ID
|
|
|
|
|
|
+ $party_id = input('party_id',0,"intval"); // 直播间ID
|
|
if (!$party_id) {
|
|
if (!$party_id) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -981,8 +938,8 @@ class Party extends Common
|
|
* 派对收藏列表
|
|
* 派对收藏列表
|
|
*/
|
|
*/
|
|
public function cellectionPartyList() {
|
|
public function cellectionPartyList() {
|
|
- $page = $this->request->request('page',1); // 分页
|
|
|
|
- $pageNum = $this->request->request('pageNum',10); // 分页
|
|
|
|
|
|
+ $page = input('page',1); // 分页
|
|
|
|
+ $pageNum = input('pageNum',10); // 分页
|
|
// 分页搜索构建
|
|
// 分页搜索构建
|
|
$pageStart = ($page-1)*$pageNum;
|
|
$pageStart = ($page-1)*$pageNum;
|
|
$partycellectionModel = new \app\common\model\PartyCellection();
|
|
$partycellectionModel = new \app\common\model\PartyCellection();
|
|
@@ -1044,7 +1001,7 @@ class Party extends Common
|
|
* 获取派对信息
|
|
* 获取派对信息
|
|
*/
|
|
*/
|
|
public function getPartyInfo() {
|
|
public function getPartyInfo() {
|
|
- $party_id = $this->request->request('party_id',0,"intval"); // 直播间ID
|
|
|
|
|
|
+ $party_id = input('party_id',0,"intval"); // 直播间ID
|
|
if (!$party_id) {
|
|
if (!$party_id) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -1097,15 +1054,15 @@ class Party extends Common
|
|
* 派对设置
|
|
* 派对设置
|
|
*/
|
|
*/
|
|
public function setParty() {
|
|
public function setParty() {
|
|
- $party_id = $this->request->request('party_id',0,"intval"); // 直播间ID
|
|
|
|
- $party_name = $this->request->request('party_name'); // 派对名称
|
|
|
|
- $party_logo = $this->request->request('party_logo'); // 派对logo/封面
|
|
|
|
- $party_pass = $this->request->request('party_pass'); // 派对密码
|
|
|
|
- $party_type = $this->request->request('party_type'); // 使用场景
|
|
|
|
- $is_screen = $this->request->request('is_screen'); // 是否关闭公屏:1=是,0=否
|
|
|
|
- $on_model = $this->request->request('on_model'); // 上麦模式:1=自由模式,2=麦序模式
|
|
|
|
- $room_type = $this->request->request('room_type',1); // 房间类型:1=派对,2=直播
|
|
|
|
- $background = $this->request->request('background'); // 派对背景
|
|
|
|
|
|
+ $party_id = input('party_id',0,"intval"); // 直播间ID
|
|
|
|
+ $party_name = input('party_name'); // 派对名称
|
|
|
|
+ $party_logo = input('party_logo'); // 派对logo/封面
|
|
|
|
+ $party_pass = input('party_pass'); // 派对密码
|
|
|
|
+ $party_type = input('party_type'); // 使用场景
|
|
|
|
+ $is_screen = input('is_screen'); // 是否关闭公屏:1=是,0=否
|
|
|
|
+ $on_model = input('on_model'); // 上麦模式:1=自由模式,2=麦序模式
|
|
|
|
+ $room_type = input('room_type',1); // 房间类型:1=派对,2=直播
|
|
|
|
+ $background = input('background'); // 派对背景
|
|
if (!$party_id || (!$party_name && !$party_logo && !$party_pass && !$party_type && !$is_screen && !$on_model && !$background)) {
|
|
if (!$party_id || (!$party_name && !$party_logo && !$party_pass && !$party_type && !$is_screen && !$on_model && !$background)) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -1155,7 +1112,7 @@ class Party extends Common
|
|
* 获取派对背景
|
|
* 获取派对背景
|
|
*/
|
|
*/
|
|
public function getDefaultBackground() {
|
|
public function getDefaultBackground() {
|
|
- $room_type = $this->request->request('room_type',1); // 房间类型
|
|
|
|
|
|
+ $room_type = input('room_type',1); // 房间类型
|
|
if (!in_array($room_type,[1,2])) {
|
|
if (!in_array($room_type,[1,2])) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -1174,10 +1131,10 @@ class Party extends Common
|
|
* 派对管理设置
|
|
* 派对管理设置
|
|
*/
|
|
*/
|
|
public function partyManageSet() {
|
|
public function partyManageSet() {
|
|
- $party_id = $this->request->request('party_id',0,"intval"); // 直播间ID
|
|
|
|
- $user_id = $this->request->request('user_id',0,"intval"); // 用户ID
|
|
|
|
- $item = $this->request->request('item'); // 项目:1=房管,2=禁言,3=拉黑,4=踢出
|
|
|
|
- $time = $this->request->request('time'); // 限制时间(单位:秒):0=永久
|
|
|
|
|
|
+ $party_id = input('party_id',0,"intval"); // 直播间ID
|
|
|
|
+ $user_id = input('user_id',0,"intval"); // 用户ID
|
|
|
|
+ $item = input('item'); // 项目:1=房管,2=禁言,3=拉黑,4=踢出
|
|
|
|
+ $time = input('time'); // 限制时间(单位:秒):0=永久
|
|
if (!$party_id || !$user_id || !in_array($item,[1,2,3,4])) {
|
|
if (!$party_id || !$user_id || !in_array($item,[1,2,3,4])) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -1234,8 +1191,8 @@ class Party extends Common
|
|
* 派对管理设置列表
|
|
* 派对管理设置列表
|
|
*/
|
|
*/
|
|
public function partyManageSetList() {
|
|
public function partyManageSetList() {
|
|
- $party_id = $this->request->request('party_id',0,"intval"); // 直播间ID
|
|
|
|
- $item = $this->request->request('item',1,"intval"); // 项目:1=房管,2=禁言,3=拉黑,4=踢出
|
|
|
|
|
|
+ $party_id = input('party_id',0,"intval"); // 直播间ID
|
|
|
|
+ $item = input('item',1,"intval"); // 项目:1=房管,2=禁言,3=拉黑,4=踢出
|
|
if (!$party_id || !in_array($item,[1,2,3,4])) {
|
|
if (!$party_id || !in_array($item,[1,2,3,4])) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -1272,9 +1229,9 @@ class Party extends Common
|
|
* 派对管理设置移除
|
|
* 派对管理设置移除
|
|
*/
|
|
*/
|
|
public function partyManageSetDel() {
|
|
public function partyManageSetDel() {
|
|
- $id = $this->request->request('user_id',0,"intval"); // userid
|
|
|
|
- $party_id = $this->request->request('party_id',0,"intval"); // 房间ID
|
|
|
|
- $item = $this->request->request('item',1,"intval"); // 项目:1=房管,2=禁言,3=拉黑,4=踢出
|
|
|
|
|
|
+ $id = input('user_id',0,"intval"); // userid
|
|
|
|
+ $party_id = input('party_id',0,"intval"); // 房间ID
|
|
|
|
+ $item = input('item',1,"intval"); // 项目:1=房管,2=禁言,3=拉黑,4=踢出
|
|
if (!$id || !in_array($item,[1,2,3,4])) {
|
|
if (!$id || !in_array($item,[1,2,3,4])) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -1299,10 +1256,10 @@ class Party extends Common
|
|
* 更新派对公告
|
|
* 更新派对公告
|
|
*/
|
|
*/
|
|
public function savePartyNotice() {
|
|
public function savePartyNotice() {
|
|
- $party_id = $this->request->request('party_id',0,"intval"); // 直播间ID
|
|
|
|
- $room_type = $this->request->request('room_type',1); // 房间类型:1=派对2=直播
|
|
|
|
- $party_notice = $this->request->request('party_notice'); // 公告标题
|
|
|
|
- $party_notice_detail = $this->request->request('party_notice_detail'); // 公告内容
|
|
|
|
|
|
+ $party_id = input('party_id',0,"intval"); // 直播间ID
|
|
|
|
+ $room_type = input('room_type',1); // 房间类型:1=派对2=直播
|
|
|
|
+ $party_notice = input('party_notice'); // 公告标题
|
|
|
|
+ $party_notice_detail = input('party_notice_detail'); // 公告内容
|
|
if (!$party_id || !$party_notice || !$party_notice_detail) {
|
|
if (!$party_id || !$party_notice || !$party_notice_detail) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -1341,8 +1298,8 @@ class Party extends Common
|
|
* 开始排麦
|
|
* 开始排麦
|
|
*/
|
|
*/
|
|
public function addLineUp() {
|
|
public function addLineUp() {
|
|
- $party_id = $this->request->request('party_id',0,"intval"); // 直播间ID
|
|
|
|
- $mai_id = $this->request->request('mai_id',"1"); // 麦位置
|
|
|
|
|
|
+ $party_id = input('party_id',0,"intval"); // 直播间ID
|
|
|
|
+ $mai_id = input('mai_id',"1"); // 麦位置
|
|
if (!$party_id) {
|
|
if (!$party_id) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -1386,9 +1343,9 @@ class Party extends Common
|
|
* 取消排麦
|
|
* 取消排麦
|
|
*/
|
|
*/
|
|
public function cancelLineUp() {
|
|
public function cancelLineUp() {
|
|
- $party_id = $this->request->request('party_id',0,"intval"); // 直播间ID
|
|
|
|
- $user_id = $this->request->request('user_id',0); // 直播间ID
|
|
|
|
- $is_empty = $this->request->request('is_empty',0,"intval"); // 是否清空排麦列表 1=清空,0=不清空
|
|
|
|
|
|
+ $party_id = input('party_id',0,"intval"); // 直播间ID
|
|
|
|
+ $user_id = input('user_id',0); // 直播间ID
|
|
|
|
+ $is_empty = input('is_empty',0,"intval"); // 是否清空排麦列表 1=清空,0=不清空
|
|
if (!$party_id) {
|
|
if (!$party_id) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -1423,7 +1380,7 @@ class Party extends Common
|
|
* 排麦列表
|
|
* 排麦列表
|
|
*/
|
|
*/
|
|
public function lineUpList() {
|
|
public function lineUpList() {
|
|
- $party_id = $this->request->request('party_id',0,"intval"); // 直播间ID
|
|
|
|
|
|
+ $party_id = input('party_id',0,"intval"); // 直播间ID
|
|
if (!$party_id) {
|
|
if (!$party_id) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -1451,7 +1408,7 @@ class Party extends Common
|
|
* 获取派对类型
|
|
* 获取派对类型
|
|
*/
|
|
*/
|
|
public function getPatyType() {
|
|
public function getPatyType() {
|
|
- $room_type = $this->request->request("room_type",1);//
|
|
|
|
|
|
+ $room_type = input("room_type",1);//
|
|
if (!in_array($room_type,[1,2])) $this->error(__('Invalid parameters'));
|
|
if (!in_array($room_type,[1,2])) $this->error(__('Invalid parameters'));
|
|
$partytypeModel = new \app\common\model\PartyType();
|
|
$partytypeModel = new \app\common\model\PartyType();
|
|
$partytypeList = $partytypeModel->where(["room_type"=>$room_type])->select();
|
|
$partytypeList = $partytypeModel->where(["room_type"=>$room_type])->select();
|
|
@@ -1462,9 +1419,9 @@ class Party extends Common
|
|
* 判断派对是否设置过密码
|
|
* 判断派对是否设置过密码
|
|
*/
|
|
*/
|
|
public function getPatyIspass() {
|
|
public function getPatyIspass() {
|
|
- $party_id = $this->request->request("party_id");// 派对ID
|
|
|
|
- $room_type = $this->request->request("room_type",1);//
|
|
|
|
- $is_miniprogram = $this->request->request("is_miniprogram",0);//
|
|
|
|
|
|
+ $party_id = input("party_id");// 派对ID
|
|
|
|
+ $room_type = input("room_type",1);//
|
|
|
|
+ $is_miniprogram = input("is_miniprogram",0);//
|
|
if (!$party_id) $this->error(__('Invalid parameters'));
|
|
if (!$party_id) $this->error(__('Invalid parameters'));
|
|
|
|
|
|
$user_id = $this->auth->id;
|
|
$user_id = $this->auth->id;
|
|
@@ -1592,7 +1549,7 @@ class Party extends Common
|
|
*/
|
|
*/
|
|
public function giveGiftToYou() {
|
|
public function giveGiftToYou() {
|
|
// 是否背包赠送: 1=是,0=否
|
|
// 是否背包赠送: 1=是,0=否
|
|
- $is_back = $this->request->request("is_back",0);
|
|
|
|
|
|
+ $is_back = input("is_back",0);
|
|
|
|
|
|
// 接口防并发
|
|
// 接口防并发
|
|
if($is_back){
|
|
if($is_back){
|
|
@@ -1613,11 +1570,11 @@ class Party extends Common
|
|
}
|
|
}
|
|
|
|
|
|
//接收参数
|
|
//接收参数
|
|
- $user_ids = $this->request->request("user_id");// 赠送对象
|
|
|
|
- $gift_id = $this->request->request("gift_id");// 礼物ID。如果是背包赠送,则是gift_back表的id,这样不合理,但是已经不好改了
|
|
|
|
- $party_id = $this->request->request("party_id",0);// 派对ID
|
|
|
|
- $room_type = $this->request->request('room_type',1); // 房间类型
|
|
|
|
- $number = $this->request->request("number");// 赠送数量
|
|
|
|
|
|
+ $user_ids = input("user_id");// 赠送对象
|
|
|
|
+ $gift_id = input("gift_id");// 礼物ID。如果是背包赠送,则是gift_back表的id,这样不合理,但是已经不好改了
|
|
|
|
+ $party_id = input("party_id",0);// 派对ID
|
|
|
|
+ $room_type = input('room_type',1); // 房间类型
|
|
|
|
+ $number = input("number");// 赠送数量
|
|
|
|
|
|
if (!$user_ids || !in_array($is_back,[0,1]) || !$gift_id || !$number || !in_array($room_type,[1,2]))
|
|
if (!$user_ids || !in_array($is_back,[0,1]) || !$gift_id || !$number || !in_array($room_type,[1,2]))
|
|
{
|
|
{
|
|
@@ -2160,8 +2117,8 @@ class Party extends Common
|
|
* 单个房间魅力值清零
|
|
* 单个房间魅力值清零
|
|
*/
|
|
*/
|
|
public function partyClearCharm() {
|
|
public function partyClearCharm() {
|
|
- $party_id = $this->request->request("party_id");// 派对ID
|
|
|
|
- $userId = $this->request->request("user_id", 0);// 用户ID
|
|
|
|
|
|
+ $party_id = input("party_id");// 派对ID
|
|
|
|
+ $userId = input("user_id", 0);// 用户ID
|
|
if($party_id <= 0) {
|
|
if($party_id <= 0) {
|
|
$this->error("请输入派对ID");
|
|
$this->error("请输入派对ID");
|
|
}
|
|
}
|