diff --git a/controllers/task_log.go b/controllers/task_log.go index c8cf3b7..d9bd18e 100644 --- a/controllers/task_log.go +++ b/controllers/task_log.go @@ -56,16 +56,15 @@ func (self *TaskLogController) Table() { } TextStatus := []string{ + " 超时", " 错误", " 正常", - " 未知", } Status, err := self.GetInt("status") if err == nil && Status != 9 { - status := Status + 1 - filters = append(filters, "status", status) + filters = append(filters, "status", Status) } filters = append(filters, "task_id", taskId) @@ -78,9 +77,13 @@ func (self *TaskLogController) Table() { row["task_id"] = v.TaskId row["start_time"] = beego.Date(time.Unix(v.CreateTime, 0), "Y-m-d H:i:s") row["process_time"] = float64(v.ProcessTime) / 1000 - row["ouput_size"] = libs.SizeFormat(float64(len(v.Output))) - index := v.Status + 1 - if index > 1 { + if v.Status == 0 { + row["output_size"] = libs.SizeFormat(float64(len(v.Output))) + } else { + row["output_size"] = libs.SizeFormat(float64(len(v.Error))) + } + index := v.Status + 2 + if index > 2 { index = 2 } row["status"] = TextStatus[index] @@ -101,21 +104,26 @@ func (self *TaskLogController) Detail() { return } LogTextStatus := []string{ + "超时", " 错误", " 正常", - " 未知", } row := make(map[string]interface{}) row["id"] = tasklog.Id row["task_id"] = tasklog.TaskId row["start_time"] = beego.Date(time.Unix(tasklog.CreateTime, 0), "Y-m-d H:i:s") row["process_time"] = float64(tasklog.ProcessTime) / 1000 - row["ouput_size"] = libs.SizeFormat(float64(len(tasklog.Output))) - row["ouput"] = tasklog.Output + if tasklog.Status == 0 { + row["output_size"] = libs.SizeFormat(float64(len(tasklog.Output))) + } else { + row["output_size"] = libs.SizeFormat(float64(len(tasklog.Error))) + } + + row["output"] = tasklog.Output row["error"] = tasklog.Error - index := tasklog.Status + 1 - if index > 1 { + index := tasklog.Status + 2 + if index > 2 { index = 2 } row["status"] = LogTextStatus[index] @@ -178,6 +186,12 @@ func (self *TaskLogController) Detail() { updateName = admin.RealName } } + + //是否出错通知 + self.Data["adminInfo"] = []int{0} + if task.NotifyUserIds != "0" && task.NotifyUserIds != "" { + self.Data["adminInfo"] = AllAdminInfo(task.NotifyUserIds) + } self.Data["CreateName"] = createName self.Data["UpdateName"] = updateName self.Data["pageTitle"] = "日志详细" + "(#" + strconv.Itoa(id) + ")" diff --git a/views/tasklog/detail.html b/views/tasklog/detail.html index 9aa02bd..322b76b 100644 --- a/views/tasklog/detail.html +++ b/views/tasklog/detail.html @@ -144,6 +144,31 @@