diff --git a/app/controller/Index.php b/app/controller/Index.php index 3c8ba2a..c5ff3db 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -13,7 +13,7 @@ class Index 'code' => 200, 'msg' => 'success', 'data' => [ - 'name' => 'thinkphp6' + 'name' => 'thinkphp' ] ]); } @@ -39,7 +39,7 @@ class Index "url" => 'http://' . $serverIP . '/' . $savename, // "url" => 'http://192.168.1.105:8080/file/' . $savename, ], - 'env' => $env->get(), + // 'env' => $env->get(), ]); } } diff --git a/route/app.php b/route/app.php index 34e5371..1eb4f97 100644 --- a/route/app.php +++ b/route/app.php @@ -15,9 +15,9 @@ Route::post('/file/upload', 'index/upload'); Route::post('/upload', 'index/upload'); Route::get('/actuator/health', function () { - return 'hello,ThinkPHP6!'; + return 'hello,ThinkPHP!'; }); Route::get('/actuator/info', function () { - return 'hello,ThinkPHP6!'; + return 'hello,ThinkPHP!'; }); diff --git a/start.php b/start.php index bb8e0ea..404da2d 100644 --- a/start.php +++ b/start.php @@ -26,8 +26,8 @@ $task->onWorkerStart = function(Worker $task) use ($serverAddr, $nacosAddr) "base_uri" => $nacosAddr, "timeout" => 5 ]); - // 每2.5秒执行一次 - Timer::add(5, function() use ($client, $serverAddr) + // 心跳检测,每8秒执行一次 + Timer::add(8, function() use ($client, $serverAddr) { list ($serverIP, $serverPort) = explode(':', $serverAddr); $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 json_encode($_ENV, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE); - echo "\n"; + // echo "send heartbeat: " . $response->getBody()->getContents() . "\n"; + // echo json_encode($_ENV, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE); + // echo "\n"; }); };