修改变量,打包发布

This commit is contained in:
小王 2024-09-13 11:05:08 +08:00
parent a0f1958bf5
commit d496491479
3 changed files with 9 additions and 9 deletions

View File

@ -13,7 +13,7 @@ class Index
'code' => 200, 'code' => 200,
'msg' => 'success', 'msg' => 'success',
'data' => [ 'data' => [
'name' => 'thinkphp6' 'name' => 'thinkphp'
] ]
]); ]);
} }
@ -39,7 +39,7 @@ class Index
"url" => 'http://' . $serverIP . '/' . $savename, "url" => 'http://' . $serverIP . '/' . $savename,
// "url" => 'http://192.168.1.105:8080/file/' . $savename, // "url" => 'http://192.168.1.105:8080/file/' . $savename,
], ],
'env' => $env->get(), // 'env' => $env->get(),
]); ]);
} }
} }

View File

@ -15,9 +15,9 @@ Route::post('/file/upload', 'index/upload');
Route::post('/upload', 'index/upload'); Route::post('/upload', 'index/upload');
Route::get('/actuator/health', function () { Route::get('/actuator/health', function () {
return 'hello,ThinkPHP6!'; return 'hello,ThinkPHP!';
}); });
Route::get('/actuator/info', function () { Route::get('/actuator/info', function () {
return 'hello,ThinkPHP6!'; return 'hello,ThinkPHP!';
}); });

View File

@ -26,8 +26,8 @@ $task->onWorkerStart = function(Worker $task) use ($serverAddr, $nacosAddr)
"base_uri" => $nacosAddr, "base_uri" => $nacosAddr,
"timeout" => 5 "timeout" => 5
]); ]);
// 每2.5秒执行一次 // 心跳检测每8秒执行一次
Timer::add(5, function() use ($client, $serverAddr) Timer::add(8, function() use ($client, $serverAddr)
{ {
list ($serverIP, $serverPort) = explode(':', $serverAddr); list ($serverIP, $serverPort) = explode(':', $serverAddr);
$response = $client->request("put", "/nacos/v1/ns/instance/beat", [ $response = $client->request("put", "/nacos/v1/ns/instance/beat", [
@ -48,9 +48,9 @@ $task->onWorkerStart = function(Worker $task) use ($serverAddr, $nacosAddr)
}' }'
], ],
]); ]);
echo "send heartbeat: " . $response->getBody()->getContents() . "\n"; // echo "send heartbeat: " . $response->getBody()->getContents() . "\n";
echo json_encode($_ENV, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE); // echo json_encode($_ENV, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE);
echo "\n"; // echo "\n";
}); });
}; };