完善计划任务日志功能

This commit is contained in:
dushixiang
2021-03-04 23:39:33 +08:00
parent 1b8ecefcfe
commit 2d06cd373f
14 changed files with 403 additions and 144 deletions

View File

@ -60,6 +60,14 @@ func JobChangeStatusEndpoint(c echo.Context) error {
return Success(c, "")
}
func JobExecEndpoint(c echo.Context) error {
id := c.Param("id")
if err := model.ExecJobById(id); err != nil {
return err
}
return Success(c, "")
}
func JobDeleteEndpoint(c echo.Context) error {
ids := c.Param("id")
@ -84,3 +92,22 @@ func JobGetEndpoint(c echo.Context) error {
return Success(c, item)
}
func JobGetLogsEndpoint(c echo.Context) error {
id := c.Param("id")
items, err := model.FindJobLogs(id)
if err != nil {
return err
}
return Success(c, items)
}
func JobDeleteLogsEndpoint(c echo.Context) error {
id := c.Param("id")
if err := model.DeleteJobLogByJobId(id); err != nil {
return err
}
return Success(c, "")
}

View File

@ -150,8 +150,11 @@ func SetupRoutes() *echo.Echo {
jobs.GET("/paging", JobPagingEndpoint)
jobs.PUT("/:id", JobUpdateEndpoint)
jobs.POST("/:id/change-status", JobChangeStatusEndpoint)
jobs.POST("/:id/exec", JobExecEndpoint)
jobs.DELETE("/:id", JobDeleteEndpoint)
jobs.GET("/:id", JobGetEndpoint)
jobs.GET("/:id/logs", JobGetLogsEndpoint)
jobs.DELETE("/:id/logs", JobDeleteLogsEndpoint)
}
return e