|
@@ -116,8 +116,6 @@ class Party extends Common
|
|
|
$this->error("房间数量已达上线,请联系客服!");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- $party_logo = "/assets/api/party_logo.png";
|
|
|
$party_type = 8;
|
|
|
$party_notice = "请编辑房间公告";
|
|
|
$party_notice_detail = "请编辑房间公告内容!";
|
|
@@ -141,53 +139,8 @@ class Party extends Common
|
|
|
$party_type = 7;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- $easemob = new Easemob();
|
|
|
- $easemob_room_id = $easemob->room_createRoom($party_name,$party_name,$this->auth->id);
|
|
|
- if(empty($easemob_room_id)){
|
|
|
- $this->error('创建房间失败');
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- $matedata = [
|
|
|
- 'seatnum'=> $seatnum,
|
|
|
- 'waitsing_list' => json_encode([]),
|
|
|
- 'party_name' => $party_name,
|
|
|
- 'party_logo' => $party_logo,
|
|
|
- 'is_public' => $is_public,
|
|
|
- 'room_type' => $room_type,
|
|
|
- ];
|
|
|
- $rs = $easemob->room_setRoomCustomAttributeForced($easemob_room_id,$this->auth->id,$matedata);
|
|
|
-
|
|
|
-
|
|
|
- $seatdata = [];
|
|
|
- for($i=1;$i<=$seatnum;$i++){
|
|
|
- $seat = [
|
|
|
- 'charm' => 0,
|
|
|
-
|
|
|
- 'isMaster' => false,
|
|
|
- 'headUrl' => '',
|
|
|
- 'userNo' => '',
|
|
|
- 'rtcUid' => '',
|
|
|
- 'name' => '',
|
|
|
- 'seatIndex' => $i,
|
|
|
- 'chorusSongCode' => '',
|
|
|
- 'isAudioMuted' => 1,
|
|
|
- 'isVideoMuted' => 0,
|
|
|
- ];
|
|
|
-
|
|
|
-
|
|
|
- if($i == 1){
|
|
|
- $seat['isMaster'] = true;
|
|
|
- $seat['headUrl'] = localpath_to_netpath($this->auth->avatar);
|
|
|
- $seat['userNo'] = $this->auth->id;
|
|
|
- $seat['rtcUid'] = $this->auth->id;
|
|
|
- $seat['name'] = $this->auth->nickname;
|
|
|
- }
|
|
|
-
|
|
|
- $seatdata['seat'.$i] = json_encode($seat);
|
|
|
- }
|
|
|
- $rs = $easemob->room_setRoomCustomAttributeForced($easemob_room_id,$this->auth->id,$seatdata);
|
|
|
+
|
|
|
+ $easemob_room_id = $this->easemob_createroom($party_name,$party_logo,$seatnum,$is_public,$room_type);
|
|
|
|
|
|
|
|
|
Db::startTrans();
|
|
@@ -243,9 +196,7 @@ class Party extends Common
|
|
|
$this->redis->set($this->roomTypeArr[$room_type]."_".$partyInfo["id"],json_encode($partyInfo));
|
|
|
|
|
|
if($room_type != 2) {
|
|
|
-
|
|
|
-
|
|
|
- \app\common\model\User::update(["is_guild" => 3,'guild_id'], ["id" => $user_id]);*/
|
|
|
+
|
|
|
|
|
|
$guildWhere['user_id'] = $user_id;
|
|
|
$guildWhere['status'] = 1;
|
|
@@ -273,7 +224,12 @@ class Party extends Common
|
|
|
$partyInfo["is_new"] = 0;
|
|
|
|
|
|
|
|
|
- $easemob_room_id = $sqlPartyInfo['easemob_room_id'];
|
|
|
+ if(empty($sqlPartyInfo['easemob_room_id'])){
|
|
|
+ $easemob_room_id = $this->easemob_createroom($party_name,$party_logo,$seatnum,$is_public,$room_type);
|
|
|
+ }else{
|
|
|
+ $easemob_room_id = $sqlPartyInfo['easemob_room_id'];
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -282,6 +238,59 @@ class Party extends Common
|
|
|
$this->success("获取成功!",$partyInfo);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ private function easemob_createroom($party_name,$party_logo,$seatnum,$is_public,$room_type){
|
|
|
+
|
|
|
+ $easemob = new Easemob();
|
|
|
+ $easemob_room_id = $easemob->room_createRoom($party_name,$party_name,$this->auth->id);
|
|
|
+ if(empty($easemob_room_id)){
|
|
|
+ $this->error('创建房间失败');
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $matedata = [
|
|
|
+ 'seatnum'=> $seatnum,
|
|
|
+ 'waitsing_list' => json_encode([]),
|
|
|
+ 'party_name' => $party_name,
|
|
|
+ 'party_logo' => $party_logo,
|
|
|
+ 'is_public' => $is_public,
|
|
|
+ 'room_type' => $room_type,
|
|
|
+ ];
|
|
|
+ $rs = $easemob->room_setRoomCustomAttributeForced($easemob_room_id,$this->auth->id,$matedata);
|
|
|
+
|
|
|
+
|
|
|
+ $seatdata = [];
|
|
|
+ for($i=1;$i<=$seatnum;$i++){
|
|
|
+ $seat = [
|
|
|
+ 'charm' => 0,
|
|
|
+
|
|
|
+ 'isMaster' => false,
|
|
|
+ 'headUrl' => '',
|
|
|
+ 'userNo' => '',
|
|
|
+ 'rtcUid' => '',
|
|
|
+ 'name' => '',
|
|
|
+ 'seatIndex' => $i,
|
|
|
+ 'chorusSongCode' => '',
|
|
|
+ 'isAudioMuted' => 1,
|
|
|
+ 'isVideoMuted' => 0,
|
|
|
+ ];
|
|
|
+
|
|
|
+
|
|
|
+ if($i == 1){
|
|
|
+ $seat['isMaster'] = true;
|
|
|
+ $seat['headUrl'] = localpath_to_netpath($this->auth->avatar);
|
|
|
+ $seat['userNo'] = $this->auth->id;
|
|
|
+ $seat['rtcUid'] = $this->auth->id;
|
|
|
+ $seat['name'] = $this->auth->nickname;
|
|
|
+ }
|
|
|
+
|
|
|
+ $seatdata['seat'.$i] = json_encode($seat);
|
|
|
+ }
|
|
|
+ $rs = $easemob->room_setRoomCustomAttributeForced($easemob_room_id,$this->auth->id,$seatdata);
|
|
|
+
|
|
|
+ return $easemob_room_id;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public function shengwang_token($easemob_room_id,$return = 0){
|
|
|
|
|
@@ -842,6 +851,17 @@ class Party extends Common
|
|
|
}
|
|
|
|
|
|
|
|
|
+ * 解散房间
|
|
|
+ */
|
|
|
+ public function jiesan(){
|
|
|
+ $party_id = input('party_id',0);
|
|
|
+
|
|
|
+ $party_info = Db::name('party')->where('party_id',$party_id)->find();
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
* 派对内搜索用户
|
|
|
*/
|
|
|
public function searchUserParty() {
|