|
@@ -214,23 +214,18 @@ class Party extends Api
|
|
|
Db::commit();
|
|
|
|
|
|
} else {
|
|
|
- //if($sqlPartyInfo["is_close"] == 1) $this->error("该房间已被关闭!");
|
|
|
-
|
|
|
- // 如果是房主并且房间处于离线状态下激活
|
|
|
- /*if ($sqlPartyInfo['user_id'] != $user_id) {
|
|
|
- $this->error("当前直播已结束!");
|
|
|
- }*/
|
|
|
|
|
|
$partyInfo = $sqlPartyInfo;
|
|
|
$partyInfo["is_new"] = 0;
|
|
|
$partyInfo["status"] = 1;
|
|
|
//naming avatar type_name
|
|
|
- Db::name('party')->where('id',$sqlPartyInfo['id'])->update(['status'=>1]);
|
|
|
+ Db::name('party')->where('id',$partyInfo['id'])->update(['status'=>1]);
|
|
|
|
|
|
- if(empty($sqlPartyInfo['easemob_room_id'])){
|
|
|
+ if(empty($partyInfo['easemob_room_id'])){
|
|
|
$easemob_room_id = $this->easemob_createroom($party_name,$party_logo,$seatnum,$is_public,$room_type);
|
|
|
+ Db::name('party')->where('id',$partyInfo['id'])->update(['easemob_room_id'=>$easemob_room_id]);
|
|
|
}else{
|
|
|
- $easemob_room_id = $sqlPartyInfo['easemob_room_id'];
|
|
|
+ $easemob_room_id = $partyInfo['easemob_room_id'];
|
|
|
}
|
|
|
|
|
|
//重置easemob_room_id
|
|
@@ -240,6 +235,9 @@ class Party extends Api
|
|
|
//声网三个token
|
|
|
$partyInfo['shengwang_token'] = $this->shengwang_token_private($easemob_room_id);
|
|
|
|
|
|
+ //帮房主走一次joinparty
|
|
|
+ $this->creater_joinParty($partyInfo['id'],$easemob_room_id,$partyInfo['user_id']);
|
|
|
+
|
|
|
$this->success("获取成功!",$partyInfo);
|
|
|
}
|
|
|
|
|
@@ -906,6 +904,60 @@ class Party extends Api
|
|
|
return $this->success("加入成功!",$lsetList);
|
|
|
}
|
|
|
|
|
|
+ private function creater_joinParty($party_id,$easemob_room_id,$party_user_id) {
|
|
|
+
|
|
|
+ $user_id = $this->auth->id;
|
|
|
+
|
|
|
+ // 判断当前用户是否被该房间设置限制 //项目:1=房管,2=禁言,3=拉黑,4=踢出
|
|
|
+ $lsetList = [];
|
|
|
+
|
|
|
+ for($i=1;$i<=4;$i++) {
|
|
|
+ $hgetlist = $this->redis->hGet("party_manage_".$party_id,$user_id."-".$i);
|
|
|
+
|
|
|
+ $hgetlist = unserialize($hgetlist);
|
|
|
+
|
|
|
+ // 房管
|
|
|
+ if($hgetlist && $i == 1) {
|
|
|
+ $lsetList["manage_restime"] = "";
|
|
|
+ //重新设置成管理员
|
|
|
+ $this->setGroupAdmin($easemob_room_id,$user_id,1);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //下移
|
|
|
+ $this->redis->zAdd("party_user_".$party_id,$user_id,$user_id);
|
|
|
+ $this->redis->hSet("online_".$party_id,$user_id,$user_id); //新增的
|
|
|
+
|
|
|
+ // 判断当前用户是否存在在直播间通过切换过来的
|
|
|
+ $livingUserPartyId = $this->redis->hGet("livingUser", $user_id);
|
|
|
+ if ($livingUserPartyId) {
|
|
|
+ if($livingUserPartyId != $party_id){
|
|
|
+ // 扣除房间在线人数
|
|
|
+ $this->redis->HDel("online_" . $livingUserPartyId, $user_id);
|
|
|
+ //首页用户头像
|
|
|
+ $this->redis->zRem("party_user_".$livingUserPartyId, $user_id);
|
|
|
+ // 扣除在线用户在房间情况
|
|
|
+ $this->redis->hDel("livingUser", $user_id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 记录在线用户在房间情况
|
|
|
+ $this->redis->hSet("livingUser", $user_id, $party_id);
|
|
|
+ //下移
|
|
|
+
|
|
|
+ //[环信] 更新聊天室自定义属性 在线用户人数
|
|
|
+ $easemob = new Easemob();
|
|
|
+ $matedata = [
|
|
|
+ 'online_user_num' => count($this->redis->hGetAll("online_".$party_id)),
|
|
|
+ ];
|
|
|
+
|
|
|
+ $easemob->room_setRoomCustomAttributeForced($easemob_room_id,$party_user_id,$matedata);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 判断是否被禁言
|
|
|
*/
|