|
@@ -163,7 +163,7 @@ class Party extends Common
|
|
|
$data["party_notice"] = $party_notice;
|
|
|
$data["party_notice_detail"] = $party_notice_detail;
|
|
|
$data["is_online"] = 1;
|
|
|
- $data["status"] = 1;
|
|
|
+ $data["status"] = 1;//直接正常状态
|
|
|
$data["is_recommend"] = 0;
|
|
|
$data["createtime"] = time();
|
|
|
$data["easemob_room_id"] = $easemob_room_id;
|
|
@@ -198,9 +198,9 @@ class Party extends Common
|
|
|
$partyInfo["naming"] = $userInfo;
|
|
|
$partyInfo["type_name"] = $partyTypeName;
|
|
|
|
|
|
- // 加入缓存排序
|
|
|
+ // 加入缓存排序,rediskey:派对热度
|
|
|
$redis->zAdd($this->roomTypeArr[$room_type]."Rank", $partyInfo['party_hot'], $partyInfo["id"]);
|
|
|
- // 加入缓存
|
|
|
+ // 加入缓存,rediskey:派对详情
|
|
|
$redis->set($this->roomTypeArr[$room_type]."_".$partyInfo["id"],json_encode($partyInfo));
|
|
|
|
|
|
if($room_type != 2) {
|
|
@@ -225,6 +225,11 @@ class Party extends Common
|
|
|
} else {
|
|
|
if($sqlPartyInfo["is_close"] == 1) $this->error("该房间已被关闭!");
|
|
|
|
|
|
+ // 如果是房主并且房间处于离线状态下激活
|
|
|
+ if ($sqlPartyInfo['user_id'] != $user_id) {
|
|
|
+ $this->error("当前直播已结束!");
|
|
|
+ }
|
|
|
+
|
|
|
$partyInfo = $sqlPartyInfo;
|
|
|
$partyInfo["is_new"] = 0;
|
|
|
}
|
|
@@ -255,7 +260,9 @@ class Party extends Common
|
|
|
if($redisconfig['redis_selectdb'] > 0){
|
|
|
$redis->select($redisconfig['redis_selectdb']);
|
|
|
}
|
|
|
+ //rediskey:派对热度
|
|
|
$redis->zRem($this->roomTypeArr[$room_type]."Rank",$party_id);
|
|
|
+ //rediskey:派对详情
|
|
|
$redis->del($this->roomTypeArr[$room_type]."_".$party_id);
|
|
|
$this->success("删除成功!");
|
|
|
} else {
|
|
@@ -287,6 +294,7 @@ class Party extends Common
|
|
|
if($redisconfig['redis_selectdb'] > 0){
|
|
|
$redis->select($redisconfig['redis_selectdb']);
|
|
|
}
|
|
|
+ //rediskey:派对热度
|
|
|
$redisPartyRankList = $redis->zRevRange($this->roomTypeArr[$room_type]."Rank",0,-1,true);
|
|
|
|
|
|
$partyModel = new \app\common\model\Party();
|
|
@@ -305,14 +313,17 @@ class Party extends Common
|
|
|
if($sqlPartyList) {
|
|
|
foreach($sqlPartyList as $k => $v) {
|
|
|
// 加入缓存排序
|
|
|
+ //rediskey:派对热度
|
|
|
$redis->zAdd($this->roomTypeArr[$room_type]."Rank", $v['party_hot'], $v["id"]);
|
|
|
// 设置冠名
|
|
|
$sqlPartyList[$k]["naming"] = isset($userInfoArr[$v["naming"]])?$userInfoArr[$v["naming"]]:[];
|
|
|
// 设置房主头像
|
|
|
$sqlPartyList[$k]["avatar"] = isset($userInfoArr[$v["user_id"]])?$userInfoArr[$v["user_id"]]["avatar"]:[];
|
|
|
// 加入缓存
|
|
|
+ //rediskey:派对详情
|
|
|
$redis->set($this->roomTypeArr[$room_type]."_".$v["id"],json_encode($v));
|
|
|
}
|
|
|
+ //rediskey:派对热度
|
|
|
$redisPartyRankList = $redis->zRevRange($this->roomTypeArr[$room_type]."Rank",0,-1,true);
|
|
|
}
|
|
|
}
|
|
@@ -328,18 +339,19 @@ class Party extends Common
|
|
|
|
|
|
/**
|
|
|
* 获取派对列表排序
|
|
|
- * getPartyRankList改的
|
|
|
+ * getPartyRankList改的,少传入了room_type,所有room_type的都给返回了
|
|
|
*/
|
|
|
public function getPartyList() {
|
|
|
$thispage = input('page',1,"intval"); // 当前页数
|
|
|
$pagenum = input('listrow',10,"intval"); // 每页显示条数0=不做分页
|
|
|
- $type_id = input('type_id'); // 派对类型
|
|
|
- $is_recommend = input('is_recommend'); // 推荐0=否1=是
|
|
|
- $all = input('all'); // 全部分类0=否1=是
|
|
|
+ $type_id = 0; //input('type_id'); // 派对类型
|
|
|
+ $is_recommend = input('is_recommend',0); // 推荐0=否1=是
|
|
|
+ $all = 1; //input('all'); // 全部分类0=否1=是
|
|
|
$index = input('index',0); // 全部分类0=否1=是
|
|
|
|
|
|
$start = ($thispage-1)*$pagenum;
|
|
|
$end = $start+($pagenum-1);
|
|
|
+
|
|
|
// 获取排序
|
|
|
$redis = new Redis();
|
|
|
$redisconfig = config("redis");
|
|
@@ -350,8 +362,10 @@ class Party extends Common
|
|
|
if($redisconfig['redis_selectdb'] > 0){
|
|
|
$redis->select($redisconfig['redis_selectdb']);
|
|
|
}
|
|
|
- $redisPartyRankList = $redis->zRevRange("partyRank",0,-1,true);
|
|
|
|
|
|
+ //rediskey:派对热度
|
|
|
+ $redisPartyRankList = $redis->zRevRange("partyRank",0,-1,true);
|
|
|
+ //rediskey:派对热度
|
|
|
$redisLiveRankList = $redis->zRevRange("liveRank",0,-1,true);
|
|
|
|
|
|
$roomService = new RoomService();
|