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);