mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
修复修改任务状态可能报错
This commit is contained in:
parent
b60cda66bb
commit
90fe63211d
|
@ -51,6 +51,9 @@ export default (app: Router) => {
|
||||||
const logger: Logger = Container.get('logger');
|
const logger: Logger = Container.get('logger');
|
||||||
try {
|
try {
|
||||||
const envService = Container.get(EnvService);
|
const envService = Container.get(EnvService);
|
||||||
|
if (!req.body?.length) {
|
||||||
|
return res.send({ code: 400, message: '参数不正确' });
|
||||||
|
}
|
||||||
const data = await envService.create(req.body);
|
const data = await envService.create(req.body);
|
||||||
return res.send({ code: 200, data });
|
return res.send({ code: 200, data });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -114,7 +114,13 @@ export default class CronService {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const id of ids) {
|
for (const id of ids) {
|
||||||
const cron = await this.getDb({ id });
|
let cron;
|
||||||
|
try {
|
||||||
|
cron = await this.getDb({ id });
|
||||||
|
} catch (err) {}
|
||||||
|
if (!cron) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (status === CrontabStatus.idle && log_path !== cron.log_path) {
|
if (status === CrontabStatus.idle && log_path !== cron.log_path) {
|
||||||
options = omit(options, ['status', 'log_path', 'pid']);
|
options = omit(options, ['status', 'log_path', 'pid']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Service, Inject } from 'typedi';
|
import { Service, Inject } from 'typedi';
|
||||||
import winston from 'winston';
|
import winston from 'winston';
|
||||||
import {
|
import {
|
||||||
|
createFile,
|
||||||
createRandomString,
|
createRandomString,
|
||||||
fileExist,
|
fileExist,
|
||||||
getNetIp,
|
getNetIp,
|
||||||
|
@ -266,7 +267,7 @@ export default class UserService {
|
||||||
public async getUserInfo(): Promise<any> {
|
public async getUserInfo(): Promise<any> {
|
||||||
const authFileExist = await fileExist(config.authConfigFile);
|
const authFileExist = await fileExist(config.authConfigFile);
|
||||||
if (!authFileExist) {
|
if (!authFileExist) {
|
||||||
await fs.writeFile(
|
await createFile(
|
||||||
config.authConfigFile,
|
config.authConfigFile,
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
username: 'admin',
|
username: 'admin',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user