diff --git a/backend/app/dto/cronjob.go b/backend/app/dto/cronjob.go index e94c3c4f5..d016e41bb 100644 --- a/backend/app/dto/cronjob.go +++ b/backend/app/dto/cronjob.go @@ -6,7 +6,7 @@ type CronjobCreate struct { Name string `json:"name" validate:"required"` Type string `json:"type" validate:"required"` SpecType string `json:"specType" validate:"required"` - Week int `json:"week" validate:"number,max=7,min=1"` + Week int `json:"week" validate:"number,max=6,min=0"` Day int `json:"day" validate:"number"` Hour int `json:"hour" validate:"number"` Minute int `json:"minute" validate:"number"` @@ -27,7 +27,7 @@ type CronjobUpdate struct { ID uint `json:"id" validate:"required"` Name string `json:"name" validate:"required"` SpecType string `json:"specType" validate:"required"` - Week int `json:"week" validate:"number,max=7,min=1"` + Week int `json:"week" validate:"number,max=6,min=0"` Day int `json:"day" validate:"number"` Hour int `json:"hour" validate:"number"` Minute int `json:"minute" validate:"number"` diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 711548ef5..1fac7bc12 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -632,8 +632,10 @@ const message = { cronjob: { cronTask: 'Task', changeStatus: 'Change status', - disableMsg: 'The cronjob cannot continue to run after it is stopped. Do you want to stop it?', - enableMsg: 'The cronjob has been stopped. Enable now?', + disableMsg: + 'Stopping the scheduled task will result in the task no longer automatically executing. Do you want to continue?', + enableMsg: + 'Enabling the scheduled task will allow the task to automatically execute on a regular basis. Do you want to continue?', taskType: 'Task type', record: 'Records', shell: 'Shell script', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index f30468cd8..d5bbbb715 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -633,8 +633,8 @@ const message = { cronjob: { cronTask: '计划任务', changeStatus: '状态修改', - disableMsg: '计划任务停止后将无法继续运行,是否停止?', - enableMsg: '该计划任务已停止,是否启用?', + disableMsg: '停止计划任务会导致该任务不再自动执行。是否继续?', + enableMsg: '启用计划任务会让该任务定期自动执行。是否继续?', taskType: '任务类型', record: '报告', shell: 'Shell 脚本', diff --git a/frontend/src/views/cronjob/operate/index.vue b/frontend/src/views/cronjob/operate/index.vue index e1d095fa0..35a049c55 100644 --- a/frontend/src/views/cronjob/operate/index.vue +++ b/frontend/src/views/cronjob/operate/index.vue @@ -330,7 +330,7 @@ const weekOptions = [ { label: i18n.global.t('cronjob.thursday'), value: 4 }, { label: i18n.global.t('cronjob.friday'), value: 5 }, { label: i18n.global.t('cronjob.saturday'), value: 6 }, - { label: i18n.global.t('cronjob.sunday'), value: 7 }, + { label: i18n.global.t('cronjob.sunday'), value: 0 }, ]; const rules = reactive({ name: [Rules.requiredInput], @@ -456,7 +456,9 @@ function checkScript() { case 'perMonth': return row.day > 0 && row.day < 32 && row.hour >= 0 && row.hour < 24 && row.minute >= 0 && row.minute < 60; case 'perWeek': - return row.week > 0 && row.week < 8 && row.hour >= 0 && row.hour < 24 && row.minute >= 0 && row.minute < 60; + return ( + row.week >= 0 && row.week < 7 && row.hour >= 0 && row.hour < 24 && row.minute >= 0 && row.minute < 60 + ); case 'perDay': return row.hour >= 0 && row.hour < 24 && row.minute >= 0 && row.minute < 60; case 'perHour':