From 3f47624331bff9f565ad52508c8565832d6d7ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=A4=A7=E5=85=A8?= Date: Wed, 25 Jul 2018 23:29:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E4=B8=8D=E7=BB=8F=E8=BF=87=E5=AE=A1=E6=A0=B8=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/task.go | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/controllers/task.go b/controllers/task.go index 9197e78..add29b6 100644 --- a/controllers/task.go +++ b/controllers/task.go @@ -8,13 +8,14 @@ package controllers import ( + "strconv" + "strings" + "time" + "github.com/astaxie/beego" "github.com/george518/PPGo_Job/jobs" "github.com/george518/PPGo_Job/models" "github.com/robfig/cron" - "strconv" - "strings" - "time" ) type TaskController struct { @@ -36,6 +37,7 @@ func (self *TaskController) Add() { self.Data["pageTitle"] = "新增任务" self.Data["taskGroup"] = taskGroupLists(self.taskGroups, self.userId) self.Data["serverGroup"] = serverLists(self.serverGroups, self.userId) + self.Data["isAdmin"] = self.userId self.display() } @@ -56,6 +58,7 @@ func (self *TaskController) Edit() { // 分组列表 self.Data["taskGroup"] = taskGroupLists(self.taskGroups, self.userId) self.Data["serverGroup"] = serverLists(self.serverGroups, self.userId) + self.Data["isAdmin"] = self.userId self.display() } @@ -163,7 +166,9 @@ func (self *TaskController) AjaxSave() { task.CreateTime = time.Now().Unix() task.UpdateTime = time.Now().Unix() task.Status = 2 //审核中 - + if self.userId == 1 { + task.Status = 0 //审核中,超级管理员不需要 + } if task.TaskName == "" || task.CronSpec == "" || task.Command == "" { self.ajaxMsg("请填写完整信息", MSG_ERR) } @@ -190,8 +195,10 @@ func (self *TaskController) AjaxSave() { task.Command = strings.TrimSpace(self.GetString("command")) task.Timeout, _ = self.GetInt("timeout") task.UpdateId = self.userId - task.Status = 2 //审核中 - + task.Status = 2 //审核中,超级管理员不需要 + if self.userId == 1 { + task.Status = 0 + } msg, isBan := checkCommand(task.Command) if !isBan { self.ajaxMsg("含有禁止命令:"+msg, MSG_ERR)