郑晓宇 6 년 전
부모
커밋
b3a42522a2
2개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      app/Console/Commands/robot.php
  2. 1 0
      app/Jobs/Settlement.php

+ 2 - 2
app/Console/Commands/robot.php

@@ -83,7 +83,7 @@ class robot extends Command
             // $con = new AsyncTcpConnection('ws://127.0.0.1:8282');
             $con->onConnect = function($con) use($client) {
             };
-            $con->onMessage = function($con, $data) use($client, &$room_id, &$client_id, $user, $http_addr){
+            $con->onMessage = function($con, $data) use($client, &$room_id, &$client_id, $user, $http_addr, $worker){
                 //注册地址
                 Gateway::$registerAddress = '127.0.0.1:1238';
                 //格式化参数
@@ -167,7 +167,7 @@ class robot extends Command
                     Gateway::leaveGroup($client_id, $room_id);
                     Gateway::unbindUid($client_id, $user->user_id);
                     Gateway::closeClient($client_id);
-                    Worker::stopAll();
+                    $worker->stopAll();
                 }
 
             };

+ 1 - 0
app/Jobs/Settlement.php

@@ -62,6 +62,7 @@ class Settlement implements ShouldQueue
             ])->update($update_data);
 
             //当前房间结束
+            $update_data["is_end"] = 1;
             $update_data["end_at"] = date("Y-m-d H:i:s");
             Room::where("room_id", $this->room_id)->update($update_data);
             //获取胜利者