diff --git a/cmd/dashboard/controller/member_api.go b/cmd/dashboard/controller/member_api.go index fedf50f..cde4cb3 100644 --- a/cmd/dashboard/controller/member_api.go +++ b/cmd/dashboard/controller/member_api.go @@ -465,7 +465,7 @@ func (ma *memberAPI) addOrEditCron(c *gin.Context) { } // 计划任务类型不得使用触发服务器执行方式 - if cr.TaskType == model.CronTypeCronTask && cr.Cover == model.CronCoverSelf { + if cr.TaskType == model.CronTypeCronTask && cr.Cover == model.CronCoverAlertTrigger { err = errors.New("计划任务类型不得使用触发服务器执行方式") c.JSON(http.StatusOK, model.Response{ Code: http.StatusBadRequest, diff --git a/model/cron.go b/model/cron.go index 2ae4f44..253b440 100644 --- a/model/cron.go +++ b/model/cron.go @@ -11,7 +11,7 @@ import ( const ( CronCoverIgnoreAll = iota CronCoverAll - CronCoverSelf + CronCoverAlertTrigger CronTypeCronTask = 0 CronTypeTriggerTask = 1 ) diff --git a/service/singleton/crontask.go b/service/singleton/crontask.go index e8019e7..bf721ea 100644 --- a/service/singleton/crontask.go +++ b/service/singleton/crontask.go @@ -3,9 +3,10 @@ package singleton import ( "bytes" "fmt" - "github.com/jinzhu/copier" "sync" + "github.com/jinzhu/copier" + "github.com/robfig/cron/v3" "github.com/naiba/nezha/model" @@ -90,7 +91,7 @@ func CronTrigger(cr model.Cron, triggerServer ...uint64) func() { crIgnoreMap[cr.Servers[j]] = true } return func() { - if cr.Cover == model.CronCoverSelf { + if cr.Cover == model.CronCoverAlertTrigger { if len(triggerServer) == 0 { return }