feat: add exec env point

This commit is contained in:
engigu
2025-12-21 23:34:34 +08:00
parent 86fa6a4340
commit db6a5574e6
22 changed files with 342 additions and 89 deletions
+4 -2
View File
@@ -28,6 +28,7 @@ func (tc *TaskController) CreateTask(c *gin.Context) {
Schedule string `json:"schedule" binding:"required"`
Timeout int `json:"timeout"`
CleanConfig string `json:"clean_config"`
Envs string `json:"envs"`
}
if err := c.ShouldBindJSON(&req); err != nil {
@@ -40,7 +41,7 @@ func (tc *TaskController) CreateTask(c *gin.Context) {
return
}
task := tc.taskService.CreateTask(req.Name, req.Command, req.Schedule, req.Timeout, req.CleanConfig)
task := tc.taskService.CreateTask(req.Name, req.Command, req.Schedule, req.Timeout, req.CleanConfig, req.Envs)
tc.cronService.AddTask(task)
utils.Success(c, task)
@@ -83,6 +84,7 @@ func (tc *TaskController) UpdateTask(c *gin.Context) {
Schedule string `json:"schedule"`
Timeout int `json:"timeout"`
CleanConfig string `json:"clean_config"`
Envs string `json:"envs"`
Enabled bool `json:"enabled"`
}
@@ -98,7 +100,7 @@ func (tc *TaskController) UpdateTask(c *gin.Context) {
}
}
task := tc.taskService.UpdateTask(id, req.Name, req.Command, req.Schedule, req.Timeout, req.CleanConfig, req.Enabled)
task := tc.taskService.UpdateTask(id, req.Name, req.Command, req.Schedule, req.Timeout, req.CleanConfig, req.Envs, req.Enabled)
if task == nil {
utils.NotFound(c, "任务不存在")
return