管理员可以不经过审核编辑任务
This commit is contained in:
@@ -8,13 +8,14 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
"github.com/george518/PPGo_Job/jobs"
|
"github.com/george518/PPGo_Job/jobs"
|
||||||
"github.com/george518/PPGo_Job/models"
|
"github.com/george518/PPGo_Job/models"
|
||||||
"github.com/robfig/cron"
|
"github.com/robfig/cron"
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type TaskController struct {
|
type TaskController struct {
|
||||||
@@ -36,6 +37,7 @@ func (self *TaskController) Add() {
|
|||||||
self.Data["pageTitle"] = "新增任务"
|
self.Data["pageTitle"] = "新增任务"
|
||||||
self.Data["taskGroup"] = taskGroupLists(self.taskGroups, self.userId)
|
self.Data["taskGroup"] = taskGroupLists(self.taskGroups, self.userId)
|
||||||
self.Data["serverGroup"] = serverLists(self.serverGroups, self.userId)
|
self.Data["serverGroup"] = serverLists(self.serverGroups, self.userId)
|
||||||
|
self.Data["isAdmin"] = self.userId
|
||||||
self.display()
|
self.display()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,6 +58,7 @@ func (self *TaskController) Edit() {
|
|||||||
// 分组列表
|
// 分组列表
|
||||||
self.Data["taskGroup"] = taskGroupLists(self.taskGroups, self.userId)
|
self.Data["taskGroup"] = taskGroupLists(self.taskGroups, self.userId)
|
||||||
self.Data["serverGroup"] = serverLists(self.serverGroups, self.userId)
|
self.Data["serverGroup"] = serverLists(self.serverGroups, self.userId)
|
||||||
|
self.Data["isAdmin"] = self.userId
|
||||||
self.display()
|
self.display()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +166,9 @@ func (self *TaskController) AjaxSave() {
|
|||||||
task.CreateTime = time.Now().Unix()
|
task.CreateTime = time.Now().Unix()
|
||||||
task.UpdateTime = time.Now().Unix()
|
task.UpdateTime = time.Now().Unix()
|
||||||
task.Status = 2 //审核中
|
task.Status = 2 //审核中
|
||||||
|
if self.userId == 1 {
|
||||||
|
task.Status = 0 //审核中,超级管理员不需要
|
||||||
|
}
|
||||||
if task.TaskName == "" || task.CronSpec == "" || task.Command == "" {
|
if task.TaskName == "" || task.CronSpec == "" || task.Command == "" {
|
||||||
self.ajaxMsg("请填写完整信息", MSG_ERR)
|
self.ajaxMsg("请填写完整信息", MSG_ERR)
|
||||||
}
|
}
|
||||||
@@ -190,8 +195,10 @@ func (self *TaskController) AjaxSave() {
|
|||||||
task.Command = strings.TrimSpace(self.GetString("command"))
|
task.Command = strings.TrimSpace(self.GetString("command"))
|
||||||
task.Timeout, _ = self.GetInt("timeout")
|
task.Timeout, _ = self.GetInt("timeout")
|
||||||
task.UpdateId = self.userId
|
task.UpdateId = self.userId
|
||||||
task.Status = 2 //审核中
|
task.Status = 2 //审核中,超级管理员不需要
|
||||||
|
if self.userId == 1 {
|
||||||
|
task.Status = 0
|
||||||
|
}
|
||||||
msg, isBan := checkCommand(task.Command)
|
msg, isBan := checkCommand(task.Command)
|
||||||
if !isBan {
|
if !isBan {
|
||||||
self.ajaxMsg("含有禁止命令:"+msg, MSG_ERR)
|
self.ajaxMsg("含有禁止命令:"+msg, MSG_ERR)
|
||||||
|
|||||||
Reference in New Issue
Block a user