wesmiler 2 years ago
parent
commit
f6a74c27da
1 changed files with 8 additions and 6 deletions
  1. 8 6
      app/Console/Commands/SocketServer.php

+ 8 - 6
app/Console/Commands/SocketServer.php

@@ -137,13 +137,15 @@ class SocketServer extends Command
         $apiUrl = env('APP_URL','');
         $chatKey = isset($data['chat_key']) ? trim($data['chat_key']) : '';
         $chatKey = $chatKey ? $chatKey : getChatKey($fromUid, $toUid);
+        $liveId = isset($data['live_id']) ? $data['live_id'] : 0;
         try {
             // 推送Fd处理
             if ($fromUid && $frameId) {
-                $fds = RedisService::get("chats:bindFds:{$chatKey}");
+
+                $fds = RedisService::get("chats:bindFds:{$scene}_{$liveId}");
                 $fds = $fds? $fds : [];
                 $fds[$scene.'_'.$fromUid] = $frameId;
-                RedisService::set("chats:bindFds:{$chatKey}", $fds, 86400);
+                RedisService::set("chats:bindFds:{$scene}_{$liveId}", $fds, 86400);
                 RedisService::set("chats:bind:{$scene}_{$fromUid}", ['fd' => $frameId,'scene'=>$scene, 'user_id' => $fromUid, 'uuid' => $uuid, 'chat_key' => $chatKey], 86400);
             }
 
@@ -274,7 +276,7 @@ class SocketServer extends Command
                     $msgData['nickname'] = MemberModel::where(['id'=> $fromUid])->value('nickname');
                     $msgData['time_text'] = dateFormat($msgData['create_time']);
                     //$this->sendMsg($frameId, ['success' => true, 'op' => 'push_live', 'scene'=> $scene, 'data' => $msgData, 'message' => '发送成功:' . $frameId]);
-                    $fids =  RedisService::get("chats:bindFds:{$chatKey}");
+                    $fids =  RedisService::get("chats:bindFds:{$scene}_{$liveId}");
                     $fids = array_values($fids);
                     $fids = array_unique($fids);
                     if($fids){
@@ -290,7 +292,7 @@ class SocketServer extends Command
                     $this->sendMsg($frameId, ['success' => true,'op'=> $op, 'scene'=>$scene, 'message' => '登录成功', 'data' => $data, 't' => time()]);
                     break;
                 case 'gift': // 打赏礼物消息
-                    $fids =  RedisService::get("chats:bindFds:{$chatKey}");
+                    $fids =  RedisService::get("chats:bindFds:{$scene}_{$liveId}");
                     $fids = array_values($fids);
                     $fids = array_unique($fids);
                     if($fids){
@@ -300,7 +302,7 @@ class SocketServer extends Command
                     }
                     break;
                 case 'live_entry': // 进入直播间消息
-                    $fids =  RedisService::get("chats:bindFds:{$chatKey}");
+                    $fids =  RedisService::get("chats:bindFds:{$scene}_{$liveId}");
                     $fids = array_values($fids);
                     $fids = array_unique($fids);
                     if($fids){
@@ -310,7 +312,7 @@ class SocketServer extends Command
                     }
                     break;
                 case 'live_like': // 进入直播间消息
-                    $fids =  RedisService::get("chats:bindFds:{$chatKey}");
+                    $fids =  RedisService::get("chats:bindFds:{$scene}_{$liveId}");
                     $fids = array_values($fids);
                     $fids = array_unique($fids);
                     if($fids){