mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-02-25 07:14:43 +08:00
fix: 解决计划任务执行周期解析错误的问题 (#5119)
This commit is contained in:
parent
3df8863904
commit
99ed9be1dd
1 changed files with 4 additions and 2 deletions
|
@ -92,10 +92,12 @@ export function transObjToSpec(specType: string, week, day, hour, minute, second
|
||||||
case 'perWeek':
|
case 'perWeek':
|
||||||
return `${minute} ${hour} * * ${week}`;
|
return `${minute} ${hour} * * ${week}`;
|
||||||
case 'perNDay':
|
case 'perNDay':
|
||||||
|
day = Number(day) + 1 + '';
|
||||||
return `${minute} ${hour} */${day} * *`;
|
return `${minute} ${hour} */${day} * *`;
|
||||||
case 'perDay':
|
case 'perDay':
|
||||||
return `${minute} ${hour} * * *`;
|
return `${minute} ${hour} * * *`;
|
||||||
case 'perNHour':
|
case 'perNHour':
|
||||||
|
hour = Number(hour) + 1 + '';
|
||||||
return `${minute} */${hour} * * *`;
|
return `${minute} */${hour} * * *`;
|
||||||
case 'perHour':
|
case 'perHour':
|
||||||
return `${minute} * * * *`;
|
return `${minute} * * * *`;
|
||||||
|
@ -139,13 +141,13 @@ export function transSpecToObj(spec: string) {
|
||||||
}
|
}
|
||||||
if (specs[1].indexOf('*/') !== -1) {
|
if (specs[1].indexOf('*/') !== -1) {
|
||||||
specItem.specType = 'perNHour';
|
specItem.specType = 'perNHour';
|
||||||
specItem.hour = Number(specs[1].replaceAll('*/', ''));
|
specItem.hour = Number(specs[1].replaceAll('*/', '')) - 1;
|
||||||
return specItem;
|
return specItem;
|
||||||
}
|
}
|
||||||
specItem.hour = Number(specs[1]);
|
specItem.hour = Number(specs[1]);
|
||||||
if (specs[2].indexOf('*/') !== -1) {
|
if (specs[2].indexOf('*/') !== -1) {
|
||||||
specItem.specType = 'perNDay';
|
specItem.specType = 'perNDay';
|
||||||
specItem.day = Number(specs[2].replaceAll('*/', ''));
|
specItem.day = Number(specs[2].replaceAll('*/', '')) - 1;
|
||||||
return specItem;
|
return specItem;
|
||||||
}
|
}
|
||||||
if (specs[2] !== '*') {
|
if (specs[2] !== '*') {
|
||||||
|
|
Loading…
Reference in a new issue