fix: corn表达式显示错误--bug=1006296 --user=陈建星 【github#5608】定时任务指定按周/星期的某一天执行不正确 https://www.tapd.cn/55049933/s/1042065

This commit is contained in:
chenjianxing 2021-08-31 14:58:53 +08:00 committed by jianxing
parent eead4da948
commit 333e71394f
1 changed files with 13 additions and 7 deletions

View File

@ -221,6 +221,8 @@
// //
// //
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week'); let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week');
thisWeek++ //
//dayRuleSup //dayRuleSup
if (this.dayRuleSup.indexOf(thisWeek) < 0) { if (this.dayRuleSup.indexOf(thisWeek) < 0) {
// //
@ -234,8 +236,10 @@
} }
continue; continue;
} }
} else if (this.dayRule == 'assWeek') { } else if (this.dayRule == 'assWeek') {
// this.dayRuleSup[1]--;//
//
//1 //1
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week'); let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week');
if (this.dayRuleSup[1] >= thisWeek) { if (this.dayRuleSup[1] >= thisWeek) {
@ -243,7 +247,9 @@
} else { } else {
DD = this.dayRuleSup[0] * 7 + this.dayRuleSup[1] - thisWeek + 1; DD = this.dayRuleSup[0] * 7 + this.dayRuleSup[1] - thisWeek + 1;
} }
} else if (this.dayRule == 'lastWeek') { } else if (this.dayRule == 'lastWeek') {
this.dayRuleSup--;//
// //
//230 //230
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
@ -258,11 +264,11 @@
if (this.dayRuleSup < thisWeek) { if (this.dayRuleSup < thisWeek) {
DD -= thisWeek - this.dayRuleSup; DD -= thisWeek - this.dayRuleSup;
} else if (this.dayRuleSup > thisWeek) { } else if (this.dayRuleSup > thisWeek) {
DD -= 7 - (this.dayRuleSup - thisWeek) DD -= 7 - (this.dayRuleSup - thisWeek)
} }
} }
// 1005 // 1005
DD = DD < 10 ? '0' + DD : DD; DD = DD < 10 ? '0' + DD : DD;
// //
goHour: for (let hi = hIdx; hi < hDate.length; hi++) { goHour: for (let hi = hIdx; hi < hDate.length; hi++) {