From dc3101ae4bc34723aa2a92df1712dc33376f8168 Mon Sep 17 00:00:00 2001 From: Jerry Date: Sun, 4 May 2025 00:07:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Drestart=E4=B8=B4=E6=97=B6?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=9C=A8Linux=E4=B8=8A=E7=9A=84=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/system/system.service.ts | 5 ++++- src/test/wsTestClient.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/system/system.service.ts b/src/modules/system/system.service.ts index ad3b893..a17ba1a 100644 --- a/src/modules/system/system.service.ts +++ b/src/modules/system/system.service.ts @@ -1,6 +1,8 @@ import System from '../../utils/core/system'; import fs from 'fs/promises'; import logger from '../../utils/core/logger'; +import path from 'path'; +import paths from '../../utils/core/path'; class SystemService { public async systemRestart() { @@ -10,7 +12,8 @@ class SystemService { public async getRestartTime() { logger.debug(`有个小可爱想知道核心重启花了多久..`); - return await fs.readFile('/temp/restart_time', 'utf8'); + const restartTimePath = path.join(paths.get('temp'), 'restart_time'); + return await fs.readFile(restartTimePath, 'utf8'); } } diff --git a/src/test/wsTestClient.ts b/src/test/wsTestClient.ts index 8552e92..9d7e9a7 100644 --- a/src/test/wsTestClient.ts +++ b/src/test/wsTestClient.ts @@ -48,7 +48,7 @@ async function testGetAPI() { async function testPostAPI() { try { - const response = await axios.post('https://core.crystelf.top/api/system/restart', { + const response = await axios.post('https://core.crystelf.top/api/system/getRestartTime', { token: 114113, }); console.log('[HTTP][POST] Response:', response.data);