WIN-2308041133\Administrator 2 月之前
父節點
當前提交
2a2bf3f0fe
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      app/services/workerman/chat/ChatHandle.php
  2. 1 1
      app/services/workerman/chat/ChatService.php

+ 1 - 1
app/services/workerman/chat/ChatHandle.php

@@ -108,7 +108,7 @@ class ChatHandle
 
 
         // 发送给目标用户
         // 发送给目标用户
         if (isset($this->service->user()[$to_uid])) {
         if (isset($this->service->user()[$to_uid])) {
-            $this->response->connection($this->service->user()[$to_uid])->send('reply', $data);
+            $response->connection($this->service->user()[$to_uid])->send('reply', $data);
         }
         }
     }
     }
 }
 }

+ 1 - 1
app/services/workerman/chat/ChatService.php

@@ -89,7 +89,7 @@ class ChatService
         $this->timer = Timer::add(15, function () use (&$worker) {
         $this->timer = Timer::add(15, function () use (&$worker) {
             $time_now = time();
             $time_now = time();
             foreach ($worker->connections as $connection) {
             foreach ($worker->connections as $connection) {
-                if ($time_now - $connection->lastMessageTime > 12) {
+                if ($time_now - $connection->lastMessageTime > 60) {
                     $this->response->connection($connection)->close('timeout');
                     $this->response->connection($connection)->close('timeout');
                 }
                 }
             }
             }