|  | @@ -3,6 +3,7 @@
 | 
											
												
													
														|  |  namespace app\api\controller;
 |  |  namespace app\api\controller;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  use app\common\controller\Api;
 |  |  use app\common\controller\Api;
 | 
											
												
													
														|  | 
 |  | +use app\common\service\TenimService;
 | 
											
												
													
														|  |  use think\Request;
 |  |  use think\Request;
 | 
											
												
													
														|  |  use getusersig\getusersig;
 |  |  use getusersig\getusersig;
 | 
											
												
													
														|  |  use tencentim\tencentim;
 |  |  use tencentim\tencentim;
 | 
											
										
											
												
													
														|  | @@ -587,7 +588,7 @@ exit;
 | 
											
												
													
														|  |      public function trtc_callback(){
 |  |      public function trtc_callback(){
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          $input = file_get_contents("php://input");
 |  |          $input = file_get_contents("php://input");
 | 
											
												
													
														|  | -        filePut('start:'.$input,'callback.txt');
 |  | 
 | 
											
												
													
														|  | 
 |  | +        //filePut('start:'.$input,'callback.txt');
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          /*$input = '{
 |  |          /*$input = '{
 | 
											
												
													
														|  |              "EventGroupId":	1,
 |  |              "EventGroupId":	1,
 | 
											
										
											
												
													
														|  | @@ -602,7 +603,19 @@ exit;
 | 
											
												
													
														|  |                  "Reason":	1
 |  |                  "Reason":	1
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |          }';*/
 |  |          }';*/
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | 
 |  | +        $input = '{
 | 
											
												
													
														|  | 
 |  | +            "EventGroupId":	1,
 | 
											
												
													
														|  | 
 |  | +            "EventType":	104,
 | 
											
												
													
														|  | 
 |  | +            "CallbackTs":	1640331295244,
 | 
											
												
													
														|  | 
 |  | +            "EventInfo":	{
 | 
											
												
													
														|  | 
 |  | +                "RoomId":	140,
 | 
											
												
													
														|  | 
 |  | +                "EventTs":	1640331295,
 | 
											
												
													
														|  | 
 |  | +                "EventMsTs": 1640331295239,
 | 
											
												
													
														|  | 
 |  | +                "UserId":	"179",
 | 
											
												
													
														|  | 
 |  | +                "Role":	21,
 | 
											
												
													
														|  | 
 |  | +                "Reason":	5
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +        }';
 | 
											
												
													
														|  |          $input = json_decode($input,true);
 |  |          $input = json_decode($input,true);
 | 
											
												
													
														|  |          $roomId = $input['EventInfo']['RoomId'];
 |  |          $roomId = $input['EventInfo']['RoomId'];
 | 
											
												
													
														|  |          //房间事件组
 |  |          //房间事件组
 | 
											
										
											
												
													
														|  | @@ -625,7 +638,7 @@ exit;
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  |                  $userId = $input['EventInfo']['UserId'];
 |  |                  $userId = $input['EventInfo']['UserId'];
 | 
											
												
													
														|  |                  $redis->hSet("online_" . $roomId, $userId, $userId);
 |  |                  $redis->hSet("online_" . $roomId, $userId, $userId);
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | 
 |  | +                $redis->zAdd("party_user_".$roomId,$userId,0); //新加的
 | 
											
												
													
														|  |                  // 记录在线用户在房间情况
 |  |                  // 记录在线用户在房间情况
 | 
											
												
													
														|  |                  $redis->hSet("livingUser",$userId,$roomId);
 |  |                  $redis->hSet("livingUser",$userId,$roomId);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -648,7 +661,7 @@ exit;
 | 
											
												
													
														|  |                          $liveInfo["is_online"] = 1;
 |  |                          $liveInfo["is_online"] = 1;
 | 
											
												
													
														|  |                          $redis->set("live_" . $roomId, json_encode($liveInfo));
 |  |                          $redis->set("live_" . $roomId, json_encode($liveInfo));
 | 
											
												
													
														|  |                          \app\common\model\Party::update(["is_online" => 1], ["id" => $roomId]);
 |  |                          \app\common\model\Party::update(["is_online" => 1], ["id" => $roomId]);
 | 
											
												
													
														|  | -                        $rs_user = Db::name('user')->where('id',$userId)->update(['is_livebc'=>1]);
 |  | 
 | 
											
												
													
														|  | 
 |  | +                        $rs_user = Db::name('user')->where('id',$userId)->update(['is_live'=>1]);
 | 
											
												
													
														|  |                      }
 |  |                      }
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -665,7 +678,7 @@ exit;
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  |                  $userId = $input['EventInfo']['UserId'];
 |  |                  $userId = $input['EventInfo']['UserId'];
 | 
											
												
													
														|  |                  $redis->HDel("online_" . $roomId, $userId);
 |  |                  $redis->HDel("online_" . $roomId, $userId);
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | 
 |  | +                $redis->zRem("party_user_".$roomId,$userId); //新加的
 | 
											
												
													
														|  |                  // 扣除在线用户在房间情况
 |  |                  // 扣除在线用户在房间情况
 | 
											
												
													
														|  |                  $redis->hDel("livingUser",$userId);
 |  |                  $redis->hDel("livingUser",$userId);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -688,10 +701,33 @@ exit;
 | 
											
												
													
														|  |                          $liveInfo["is_online"] = 0;
 |  |                          $liveInfo["is_online"] = 0;
 | 
											
												
													
														|  |                          $redis->set("live_" . $roomId, json_encode($liveInfo));
 |  |                          $redis->set("live_" . $roomId, json_encode($liveInfo));
 | 
											
												
													
														|  |                          \app\common\model\Party::update(["is_online" => 0], ["id" => $roomId]);
 |  |                          \app\common\model\Party::update(["is_online" => 0], ["id" => $roomId]);
 | 
											
												
													
														|  | -                        $rs_user = Db::name('user')->where('id',$userId)->update(['is_livebc'=>0]);
 |  | 
 | 
											
												
													
														|  | 
 |  | +                        $rs_user = Db::name('user')->where('id',$userId)->update(['is_live'=>0]);
 | 
											
												
													
														|  | 
 |  | +                    }
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +                //退出房间获取房间自定义属性
 | 
											
												
													
														|  | 
 |  | +                $tenimService = new TenimService();
 | 
											
												
													
														|  | 
 |  | +                $imParams = ['party_id' => (string)$roomId];
 | 
											
												
													
														|  | 
 |  | +                $imRes = $tenimService->getGroupAttr($imParams);
 | 
											
												
													
														|  | 
 |  | +                if ($imRes['status'] == 1) {
 | 
											
												
													
														|  | 
 |  | +                    if (isset($imRes['data']) && !empty($imRes['data'])) {
 | 
											
												
													
														|  | 
 |  | +                        $imFieldArr = ['seat0','seat1','seat2','seat3','seat4','seat5','seat6','seat7','seat8','seat9'];
 | 
											
												
													
														|  | 
 |  | +                        foreach ($imRes['data'] as $imKey => &$imVal) {
 | 
											
												
													
														|  | 
 |  | +                            if (in_array($imVal['key'],$imFieldArr)) {
 | 
											
												
													
														|  | 
 |  | +                                $tempData = json_decode($imVal['value'],true);
 | 
											
												
													
														|  | 
 |  | +                                if (isset($tempData['user']) && $tempData['user'] == $userId) {
 | 
											
												
													
														|  | 
 |  | +                                    $tempData['status'] = 0;
 | 
											
												
													
														|  | 
 |  | +                                    $tempData['user'] = "0";
 | 
											
												
													
														|  | 
 |  | +                                }
 | 
											
												
													
														|  | 
 |  | +                                $imVal['value'] = json_encode($tempData);
 | 
											
												
													
														|  | 
 |  | +                            }
 | 
											
												
													
														|  | 
 |  | +                        }
 | 
											
												
													
														|  | 
 |  | +                        $imAttrParams = [
 | 
											
												
													
														|  | 
 |  | +                            'party_id' => $roomId,
 | 
											
												
													
														|  | 
 |  | +                            'party_attr' => $imRes['data'],
 | 
											
												
													
														|  | 
 |  | +                        ];
 | 
											
												
													
														|  | 
 |  | +                        $tenimService->getGroupAttrEdit($imAttrParams);
 | 
											
												
													
														|  |                      }
 |  |                      }
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |          }elseif($input['EventGroupId'] == 2){
 |  |          }elseif($input['EventGroupId'] == 2){
 | 
											
												
													
														|  |  
 |  |  
 |