|
@@ -47,6 +47,51 @@ class Party extends Common
|
|
parent::__construct($request);
|
|
parent::__construct($request);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //记录所有redis key
|
|
|
|
+ //$partyid = 1
|
|
|
|
+ public function redis_key(){
|
|
|
|
+
|
|
|
|
+ //派对热度
|
|
|
|
+ //partyRank,liveRank
|
|
|
|
+
|
|
|
|
+ //派对详情
|
|
|
|
+ //party_1,live_1
|
|
|
|
+
|
|
|
|
+ //派对魅力榜
|
|
|
|
+ //party_jewel_get_1:20231123d,live_jewel_get_1:20231123d 今天
|
|
|
|
+ //party_jewel_get_1:20231120w,live_jewel_get_1:20231120w 本周第一天
|
|
|
|
+ //party_jewel_get_1:20231101m,live_jewel_get_1:20231101m 本月第一天
|
|
|
|
+
|
|
|
|
+ //派对财富榜
|
|
|
|
+ //party_jewel_to_1:20231123d,live_jewel_to_1:20231123d 今天
|
|
|
|
+ //party_jewel_to_1:20231120w,live_jewel_to_1:20231120w 本周第一天
|
|
|
|
+ //party_jewel_to_1:20231101m,live_jewel_to_1:20231101m 本月第一天
|
|
|
|
+
|
|
|
|
+ //在线人列表
|
|
|
|
+ //online_1
|
|
|
|
+
|
|
|
|
+ //用户进房
|
|
|
|
+ //joinParty_days
|
|
|
|
+
|
|
|
|
+ //首页用户头像
|
|
|
|
+ //party_user_1
|
|
|
|
+
|
|
|
|
+ //在线用户在房间情况
|
|
|
|
+ //livingUser
|
|
|
|
+
|
|
|
|
+ //派对管理 1=房管,2=禁言,3=拉黑,4=踢出
|
|
|
|
+ //party_manage_1
|
|
|
|
+
|
|
|
|
+ //用户魅力值
|
|
|
|
+ //hourCharm_1
|
|
|
|
+
|
|
|
|
+ //用户排行榜前三名头像
|
|
|
|
+ //user_jewel_top3
|
|
|
|
+
|
|
|
|
+ //排麦
|
|
|
|
+ //party_lineup
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 创建/进入派对
|
|
* 创建/进入派对
|
|
@@ -340,27 +385,68 @@ class Party extends Common
|
|
*/
|
|
*/
|
|
public function closeParty() {
|
|
public function closeParty() {
|
|
|
|
|
|
- $party_id = input('party_id'); // 派对ID
|
|
|
|
|
|
+ $party_id = input('party_id'); // 派对ID
|
|
$room_type = input('room_type',1); // 房间类型:1=派对,2=直播
|
|
$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(__('派对不存在!'));
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ if($partyInfo['user_id'] != $this->auth->id){
|
|
|
|
+ $this->error('房主才能解散');
|
|
|
|
+ }
|
|
|
|
|
|
- // redis 删除
|
|
|
|
|
|
+ // redis操作
|
|
|
|
|
|
//rediskey:派对热度
|
|
//rediskey:派对热度
|
|
$this->redis->zRem($this->roomTypeArr[$room_type]."Rank",$party_id);
|
|
$this->redis->zRem($this->roomTypeArr[$room_type]."Rank",$party_id);
|
|
- //rediskey:派对详情
|
|
|
|
- $this->redis->del($this->roomTypeArr[$room_type]."_".$party_id);
|
|
|
|
- //清空房间所有人
|
|
|
|
- //清空房间麦位
|
|
|
|
- //清空房间待唱列表
|
|
|
|
|
|
|
|
|
|
+ //环信操作
|
|
|
|
+ $easemob_room_id = $partyInfo['easemob_room_id'];
|
|
|
|
+ if(!empty($easemob_room_id)){
|
|
|
|
+
|
|
|
|
+ //重置自定义属性
|
|
|
|
+ $online_user_num = [
|
|
|
|
+ 'online_num' => 0,
|
|
|
|
+ 'user_list' => [],
|
|
|
|
+ ];
|
|
|
|
|
|
- $this->success("删除成功!");
|
|
|
|
|
|
+ $matedata = [
|
|
|
|
+ 'waitsing_list' => json_encode([]),//清空房间待唱列表
|
|
|
|
+ 'online_user_num' => json_encode($online_user_num),//当前房间在线的人
|
|
|
|
+ ];
|
|
|
|
+ $easemob = new easemob();
|
|
|
|
+ $easemob->room_setRoomCustomAttributeForced($partyInfo['easemob_room_id'],$partyInfo['user_id'],$matedata);
|
|
|
|
|
|
|
|
+ //重置麦位
|
|
|
|
+ $seatnum = $partyInfo['seatnum'];
|
|
|
|
+ $seatdata = [];
|
|
|
|
+ for($i=1;$i<=$seatnum;$i++){
|
|
|
|
+ $seat = [
|
|
|
|
+ 'charm' => 0, //红心,魅力值
|
|
|
|
+
|
|
|
|
+ 'isMaster' => false, // 是否是房主
|
|
|
|
+ 'headUrl' => '', // 头像
|
|
|
|
+ 'userNo' => '', // 座位上用户no
|
|
|
|
+ 'rtcUid' => '', // 座位上用户id,与rtc的userId一致
|
|
|
|
+ 'name' => '', // 座位上用户昵称
|
|
|
|
+ 'seatIndex' => $i, // 座位编号
|
|
|
|
+ 'chorusSongCode' => '', // 是否合唱
|
|
|
|
+ 'isAudioMuted' => 1, // 是否静音
|
|
|
|
+ 'isVideoMuted' => 0, // 是否开启视频
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ $seatdata['seat'.$i] = json_encode($seat);
|
|
|
|
+ }
|
|
|
|
+ $easemob->room_setRoomCustomAttributeForced($easemob_room_id,$this->auth->id,$seatdata);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $this->success();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -512,7 +598,7 @@ class Party extends Common
|
|
/**
|
|
/**
|
|
* 派对热度更新(已废弃)
|
|
* 派对热度更新(已废弃)
|
|
*/
|
|
*/
|
|
- public function changeUserPartyhot() {
|
|
|
|
|
|
+ /*public function changeUserPartyhot() {
|
|
$party_id = input('party_id',0,"intval"); // 派对ID
|
|
$party_id = input('party_id',0,"intval"); // 派对ID
|
|
$room_type = input('room_type',1); // 房间类型
|
|
$room_type = input('room_type',1); // 房间类型
|
|
$party_hot = input('party_hot'); // 房间热度(正数表示提高的热度值,负数表示降低的热度值)
|
|
$party_hot = input('party_hot'); // 房间热度(正数表示提高的热度值,负数表示降低的热度值)
|
|
@@ -523,7 +609,7 @@ class Party extends Common
|
|
// 更新热度
|
|
// 更新热度
|
|
$this->redis->zIncrBy($this->roomTypeArr[$room_type]."Rank", $party_hot, $party_id);
|
|
$this->redis->zIncrBy($this->roomTypeArr[$room_type]."Rank", $party_hot, $party_id);
|
|
return $this->success("更新成功!");
|
|
return $this->success("更新成功!");
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -2386,6 +2472,8 @@ class Party extends Common
|
|
$this->success(1,$singlist);
|
|
$this->success(1,$singlist);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
//轮询所有房间,挨个赋值新的初始化自定义属性
|
|
//轮询所有房间,挨个赋值新的初始化自定义属性
|
|
public function room_task(){
|
|
public function room_task(){
|
|
exit;
|
|
exit;
|
|
@@ -2395,6 +2483,10 @@ class Party extends Common
|
|
foreach($ids as $key => $party){
|
|
foreach($ids as $key => $party){
|
|
|
|
|
|
//[环信]初始化房间
|
|
//[环信]初始化房间
|
|
|
|
+ $online_user_num = [
|
|
|
|
+ 'online_num' => 0,
|
|
|
|
+ 'user_list' => [],
|
|
|
|
+ ];
|
|
$matedata = [
|
|
$matedata = [
|
|
'seatnum'=> $party['seatnum'],//麦位数量
|
|
'seatnum'=> $party['seatnum'],//麦位数量
|
|
'waitsing_list' => json_encode([]),//已点歌曲列表
|
|
'waitsing_list' => json_encode([]),//已点歌曲列表
|
|
@@ -2402,6 +2494,7 @@ class Party extends Common
|
|
'party_logo' => localpath_to_netpath($party['party_logo']),//logo
|
|
'party_logo' => localpath_to_netpath($party['party_logo']),//logo
|
|
'is_public' => $party['is_public'],//是否公开
|
|
'is_public' => $party['is_public'],//是否公开
|
|
'room_type' => $party['room_type'],//房间类型
|
|
'room_type' => $party['room_type'],//房间类型
|
|
|
|
+ 'online_user_num' => json_encode($online_user_num),//当前房间在线的人
|
|
];
|
|
];
|
|
$rs = $easemob->room_setRoomCustomAttributeForced($party['easemob_room_id'],$party['user_id'],$matedata);
|
|
$rs = $easemob->room_setRoomCustomAttributeForced($party['easemob_room_id'],$party['user_id'],$matedata);
|
|
|
|
|