Commit 7ede4b8a authored by 陈子龙's avatar 陈子龙

任务历史 fix

parent d83da738
...@@ -25,6 +25,7 @@ type TaskInfoListRes struct { ...@@ -25,6 +25,7 @@ type TaskInfoListRes struct {
type TaskExecLogRes struct { type TaskExecLogRes struct {
Id int `json:"id"` // 主键id Id int `json:"id"` // 主键id
TaskId int `json:"task_id"` // 任务id
ExecDesc string `json:"exec_desc"` // 执行说明 ExecDesc string `json:"exec_desc"` // 执行说明
TaskName string `json:"task_name"` // 任务名称 TaskName string `json:"task_name"` // 任务名称
ExecStartTime time.Time `json:"exec_start_time" ` // 执行开始时间 ExecStartTime time.Time `json:"exec_start_time" ` // 执行开始时间
......
...@@ -123,7 +123,7 @@ func (t *TaskHistorySvc) TaskExecLog(id int) (taskExecLogRes response.TaskExecLo ...@@ -123,7 +123,7 @@ func (t *TaskHistorySvc) TaskExecLog(id int) (taskExecLogRes response.TaskExecLo
//查询 //查询
_, err = db.Table("task_history").Alias("th").Where("id = ?", id). _, err = db.Table("task_history").Alias("th").Where("id = ?", id).
Select("th.id,th.exec_desc,(select tm.task_name from task_manage tm where th.task_id = tm.id and tm.is_delete = 0) as task_name," + Select("th.id,th.task_id,th.exec_desc,(select tm.task_name from task_manage tm where th.task_id = tm.id and tm.is_delete = 0) as task_name," +
"th.exec_start_time,th.exec_end_time,th.state,th.exec_log").Get(&taskExecLogRes) "th.exec_start_time,th.exec_end_time,th.state,th.exec_log").Get(&taskExecLogRes)
if err != nil { if err != nil {
err = resp.DbSelectError.WithError(err) err = resp.DbSelectError.WithError(err)
......
...@@ -250,7 +250,7 @@ func (t *TaskManageSvc) ExecScript(req request.ExecScriptReq, script string) (id ...@@ -250,7 +250,7 @@ func (t *TaskManageSvc) ExecScript(req request.ExecScriptReq, script string) (id
if req.Value != "" { if req.Value != "" {
cmd = exec.Command("ansible-playbook", "/etc/ansible/ansible.yml", "--extra-vars", req.Value) cmd = exec.Command("ansible-playbook", "/etc/ansible/ansible.yml", "--extra-vars", req.Value)
} else { } else {
cmd = exec.Command("ansible-playbook", "/etc/ansible/ansible.yml") cmd = exec.Command("ansible-playbook", "/etc/ansible/ansible.yml", "--extra-vars", "{\"hosts\":\""+"cc"+"\"}")
} }
//捕获正常日志 //捕获正常日志
stdout, err := cmd.StdoutPipe() stdout, err := cmd.StdoutPipe()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment