Selaa lähdekoodia

麦位seat1-seat8,改成seat0-seat7

lizhen_gitee 1 vuosi sitten
vanhempi
commit
b00a72170d
2 muutettua tiedostoa jossa 10 lisäystä ja 10 poistoa
  1. 2 2
      application/api/controller/Easemob.php
  2. 8 8
      application/api/controller/Party.php

+ 2 - 2
application/api/controller/Easemob.php

@@ -318,7 +318,7 @@ class Easemob extends Api
 
         //获取所有麦位,假设8个
         $easemob = new Easemoblib();
-        $seatlist = $easemob->room_getRoomCustomAttribute($easemob_room_id,['seat1','seat2','seat3','seat4','seat5','seat6','seat7','seat8']);
+        $seatlist = $easemob->room_getRoomCustomAttribute($easemob_room_id,['seat0','seat1','seat2','seat3','seat4','seat5','seat6','seat7']);
         if(empty($seatlist)){
             //默认为空
             return false;
@@ -346,7 +346,7 @@ class Easemob extends Api
 
             //找到当前用户所在的麦位
             if(isset($seat['rtcUid']) && !empty($seat['rtcUid']) && $seat['rtcUid'] == $uid){
-                $newseat['seatIndex'] = $seat['seatIndex'];
+                $newseat['seatIndex'] = substr($k,-1);
 
                 //初始化这个麦位
                 $matedata = [

+ 8 - 8
application/api/controller/Party.php

@@ -304,7 +304,7 @@ class Party extends Api
 
         //[环信]初始化N个麦位
         $seatdata = [];
-        for($i=1;$i<=$seatnum;$i++){
+        for($i=0;$i<$seatnum;$i++){
             $seat = [
                 'charm'    => 0,                    //红心,魅力值
 
@@ -431,7 +431,7 @@ class Party extends Api
             //重置麦位
             $seatnum = $partyInfo['seatnum'];
             $seatdata = [];
-            for($i=1;$i<=$seatnum;$i++){
+            for($i=0;$i<$seatnum;$i++){
                 $seat = [
                     'charm'    => 0,                    //红心,魅力值
 
@@ -1454,7 +1454,7 @@ class Party extends Api
 
         //获取所有麦位,假设8个
         $easemob = new Easemob();
-        $seatlist = $easemob->room_getRoomCustomAttribute($partyinfo['easemob_room_id'],['seat1','seat2','seat3','seat4','seat5','seat6','seat7','seat8']);
+        $seatlist = $easemob->room_getRoomCustomAttribute($partyinfo['easemob_room_id'],['seat0','seat1','seat2','seat3','seat4','seat5','seat6','seat7']);
 
         $newseat = [
             'charm'    => 0,                    //红心,魅力值
@@ -1464,7 +1464,7 @@ class Party extends Api
             'userNo'         => $baomai_user['user_id'],               // 座位上用户no
             'rtcUid'         => $baomai_user['user_id'],               // 座位上用户id,与rtc的userId一致
             'name'           => $baomai_user['nickname'],                 // 座位上用户昵称
-            'seatIndex'      => 1,               // 座位编号
+            'seatIndex'      => 0,               // 座位编号
             'chorusSongCode' => '',             // 是否合唱
             'isAudioMuted'   => 1,            // 是否静音
             'isVideoMuted'   => 0,            // 是否开启视频
@@ -1473,7 +1473,7 @@ class Party extends Api
         ];
 
         if(empty($seatlist)){
-            $matedata['seat1'] = $newseat;
+            $matedata['seat0'] = $newseat;
         }else{
             //第一遍轮询麦位,尝试找到这个人,如果找到在任何一个麦位,立刻return
             foreach($seatlist as $k => $seat){
@@ -2587,7 +2587,7 @@ class Party extends Api
 
             //[环信]初始化N个麦位
             $seatdata = [];
-            for($i=1;$i<=$party['seatnum'];$i++){
+            for($i=0;$i<$party['seatnum'];$i++){
                 $seat = [
                     'charm'    => 0,                    //红心,魅力值
 
@@ -2606,7 +2606,7 @@ class Party extends Api
 
                 //创建完房间就进入,所以房主直接在麦位1
                 $owner = Db::name('user')->where('id',$party['user_id'])->find();
-                if($i == 1){
+                if($i == 0){
                     $seat['isMaster'] = true;
                     $seat['headUrl']  = localpath_to_netpath($owner['avatar']);
                     $seat['userNo']   = $owner['id'];
@@ -2638,7 +2638,7 @@ class Party extends Api
             'wealth_top3_userlist',
             'background',
         ];
-        for($i=1;$i<=$party_info['seatnum'];$i++){
+        for($i=0;$i<$party_info['seatnum'];$i++){
             $field[] = 'seat'.$i;
         }
         $all_attr = $easemob->room_getRoomCustomAttribute($party_info['easemob_room_id'],$field);