From f0cce4a35069763102ed1673dbf93b9f5a41b06d Mon Sep 17 00:00:00 2001 From: "wen.gong" Date: Fri, 23 Nov 2018 14:17:37 +0800 Subject: [PATCH] fix task.go 1 remove "github.com/robfig/cron" because github.com/george518/PPGo_Job/crons can be used instead. 2 modify job AjaxSave Add cron.Parse(task.CronSpec) condition --- controllers/task.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/controllers/task.go b/controllers/task.go index 2331a6c..1fea037 100644 --- a/controllers/task.go +++ b/controllers/task.go @@ -17,7 +17,7 @@ import ( "github.com/astaxie/beego" "github.com/george518/PPGo_Job/jobs" "github.com/george518/PPGo_Job/models" - "github.com/robfig/cron" + "github.com/george518/PPGo_Job/crons" ) type TaskController struct { @@ -247,6 +247,10 @@ func (self *TaskController) AjaxSave() { if !isBan { self.ajaxMsg("含有禁止命令:"+msg, MSG_ERR) } + + if _, err := cron.Parse(task.CronSpec); err != nil { + self.ajaxMsg("cron表达式无效", MSG_ERR) + } if err := task.Update(); err != nil { self.ajaxMsg(err.Error(), MSG_ERR)