From 1d4fb2cdb200469f3ce14c2f67f2fb1862e74707 Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Mon, 15 Jul 2024 11:36:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dvalidate=5Fsecond=5For?= =?UTF-8?q?=5Fminute=E5=8F=82=E6=95=B0=E4=B8=A2=E5=A4=B1=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-fastapi-backend/utils/cron_util.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ruoyi-fastapi-backend/utils/cron_util.py b/ruoyi-fastapi-backend/utils/cron_util.py index 09050e5..6232962 100644 --- a/ruoyi-fastapi-backend/utils/cron_util.py +++ b/ruoyi-fastapi-backend/utils/cron_util.py @@ -40,7 +40,7 @@ class CronUtil: if ( second_or_minute == '*' or ('-' in second_or_minute and cls.__valid_range(second_or_minute, 0, 59)) - or ('/' in second_or_minute and cls.__valid_sum(second_or_minute, 0, 58, 1, 59)) + or ('/' in second_or_minute and cls.__valid_sum(second_or_minute, 0, 58, 1, 59, 59)) or re.match(r'^(?:[0-5]?\d|59)(?:,[0-5]?\d|59)*$', second_or_minute) ): return True @@ -109,8 +109,8 @@ class CronUtil: if ( week in ['*', '?'] or ('-' in week and cls.__valid_range(week, 1, 7)) - or re.match(r'^[1-7]#[1-4]$', week) - or re.match(r'^[1-7]L$', week) + or ('#' in week and re.match(r'^[1-7]#[1-4]$', week)) + or ('L' in week and re.match(r'^[1-7]L$', week)) or re.match(r'^[1-7](?:(,[1-7]))*$', week) ): return True @@ -130,8 +130,8 @@ class CronUtil: year == '*' or ('-' in year and cls.__valid_range(year, current_year, 2099)) or ('/' in year and cls.__valid_sum(year, current_year, 2098, 1, 2099 - current_year, 2099)) - or re.match(r'^[1-7]#[1-4]$', year) - or re.match(r'^[1-7]L$', year) + or ('#' in year and re.match(r'^[1-7]#[1-4]$', year)) + or ('L' in year and re.match(r'^[1-7]L$', year)) or ( (len(year) == 4 or ',' in year) and all(int(item) in future_years and current_year <= int(item) <= 2099 for item in year.split(','))