浏览代码

更新机器人

郑晓宇 6 年之前
父节点
当前提交
42c9deb473
共有 2 个文件被更改,包括 3 次插入0 次删除
  1. 1 0
      app/Console/Commands/gamematch.php
  2. 2 0
      app/Console/Commands/robot.php

+ 1 - 0
app/Console/Commands/gamematch.php

@@ -79,6 +79,7 @@ class gamematch extends Command
 
                     //发布启动机器人
                     Redis::publish("startRobot", $user->user_id);
+                    echo "启动机器人 {$user->user_id}\n";
                     // $message['type'] = 'gotomatch';
                     // Gateway::sendToUid($user->user_id, json_encode($message));
                 }

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

@@ -98,6 +98,7 @@ class robot extends Command
                     if($response->getStatusCode() != 200){
                         echo "机器人绑定 socket失败, 结束进程\n";
                         //结束进程
+                        $sig = SIGINT;
                         $master_pid = is_file($worker::$pidFile) ? file_get_contents($worker::$pidFile) : 0;
                         $master_pid && posix_kill($master_pid, $sig);
                         return 0;
@@ -175,6 +176,7 @@ class robot extends Command
                     Gateway::leaveGroup($client_id, $room_id);
                     echo "已结算,机器人离开房间";
                     //结束进程
+                    $sig = SIGINT;
                     $master_pid = is_file($worker::$pidFile) ? file_get_contents($worker::$pidFile) : 0;
                     $master_pid && posix_kill($master_pid, $sig);
                 }