完善计划任务日志功能
This commit is contained in:
@ -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, "")
|
||||
}
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user