兼容脚本、日志、配置文件详情接口

This commit is contained in:
whyour
2024-02-08 20:47:03 +08:00
parent 29f0c2c9ac
commit e83058c3bc
5 changed files with 91 additions and 25 deletions
+8 -2
View File
@@ -1,12 +1,12 @@
import { Service, Inject } from 'typedi';
import winston from 'winston';
import path from 'path';
import path, { join } from 'path';
import SockService from './sock';
import CronService from './cron';
import ScheduleService, { TaskCallbacks } from './schedule';
import config from '../config';
import { TASK_COMMAND } from '../config/const';
import { getPid, killTask, rmPath } from '../config/util';
import { getFileContentByName, getPid, killTask, rmPath } from '../config/util';
@Service()
export default class ScriptService {
@@ -61,4 +61,10 @@ export default class ScriptService {
return { code: 200 };
}
public async getFile(filePath: string, fileName: string) {
const _filePath = join(config.scriptPath, filePath, fileName);
const content = await getFileContentByName(_filePath);
return content;
}
}