From 985020b42471fe638b6d1b08a24a7eb85b3d356c Mon Sep 17 00:00:00 2001 From: george Date: Thu, 9 Aug 2018 10:45:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BB=BB=E5=8A=A1=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E7=8A=B6=E6=80=81=E6=98=BE=E7=A4=BA=E5=92=8C=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=EF=BC=8C=E4=BF=AE=E6=AD=A3=E5=BC=82=E5=B8=B8=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA=E5=AD=97=E8=8A=82?= =?UTF-8?q?=E4=B8=BA0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/task_log.go | 36 +++++++++++++++++++++++++----------- views/tasklog/detail.html | 25 +++++++++++++++++++++++++ views/tasklog/list.html | 8 +++++--- 3 files changed, 55 insertions(+), 14 deletions(-) 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 @@ + + 出错通知 + {{if eq .task.IsNotify 0}}否{{end}} {{if eq .task.IsNotify 1}}否{{end}} + + + + {{if eq .task.IsNotify 1}} + + 通知类型 + {{if eq .task.NotifyType 1}}短信{{end}} {{if eq .task.NotifyType 0}}邮件{{end}} + + + + + 通知用户 + + {{range $k, $v := .adminInfo}} + {{$v.RealName}}     + {{end}} + + + + + {{end}} + 创建时间 {{.CreateTime}} diff --git a/views/tasklog/list.html b/views/tasklog/list.html index d82464f..76ec4b4 100644 --- a/views/tasklog/list.html +++ b/views/tasklog/list.html @@ -9,8 +9,10 @@
@@ -48,7 +50,7 @@ ,{field:'task_id', title: '任务ID', align:'center',sort: true, width:150} ,{field:'start_time',title: '开始时间'} ,{field:'process_time',width:100, title: '执行时间'} - ,{field:'ouput_size',title: '输出'} + ,{field:'output_size',title: '输出'} ,{field:'status', width:170,title: '状态'} ,{fixed: 'right', align:'center', title:'操作', toolbar: '#bar'} ]]