|
@@ -51,9 +51,9 @@ class robot extends Command
|
|
|
global $argv;
|
|
|
//获取机器人信息
|
|
|
$user_id = $this->argument('user_id');
|
|
|
- $argv[0] = '';
|
|
|
- $argv[1] = "start";
|
|
|
- $argv[2] = '';
|
|
|
+ // $argv[0] = '';
|
|
|
+ // $argv[1] = "start";
|
|
|
+ // $argv[2] = '';
|
|
|
if(!$user_id){
|
|
|
$user = User::inRandomOrder()->select('user_id','name')->where("is_robot", 1)->where("is_login", 0)->first();
|
|
|
}else{
|
|
@@ -104,7 +104,7 @@ class robot extends Command
|
|
|
if($response->getStatusCode() != 200){
|
|
|
echo "机器人绑定 socket失败, 结束进程\n";
|
|
|
//结束进程
|
|
|
- $sig = SIGTERM;
|
|
|
+ $sig = 9;
|
|
|
$master_pid = is_file($worker::$pidFile) ? file_get_contents($worker::$pidFile) : 0;
|
|
|
$master_pid && posix_kill($master_pid, $sig);
|
|
|
Log::info("用户ID: {$user->user_id} \n 绑定Socket失败退出进程\n");
|
|
@@ -119,7 +119,7 @@ class robot extends Command
|
|
|
$result = json_decode($response->getBody()->getContents());
|
|
|
if($result->code == 400 || ($result->code == 0 && $result->info->in_game == 1)){
|
|
|
//结束进程
|
|
|
- $sig = SIGTERM;
|
|
|
+ $sig = 9;
|
|
|
$master_pid = is_file($worker::$pidFile) ? file_get_contents($worker::$pidFile) : 0;
|
|
|
$master_pid && posix_kill($master_pid, $sig);
|
|
|
Log::info("用户ID: {$user->user_id} \n 正在游戏或者登录失败退出进程\n");
|
|
@@ -179,7 +179,7 @@ class robot extends Command
|
|
|
User::where("user_id", $user->user_id)->update($update_data);
|
|
|
echo "已结算,机器人离开房间";
|
|
|
//结束进程
|
|
|
- $sig = SIGTERM;
|
|
|
+ $sig = 9;
|
|
|
$master_pid = is_file($worker::$pidFile) ? file_get_contents($worker::$pidFile) : 0;
|
|
|
$master_pid && posix_kill($master_pid, $sig);
|
|
|
|