feat: add exec log clean

This commit is contained in:
engigu
2025-12-21 22:19:55 +08:00
parent 0ff136cfcd
commit 86fa6a4340
18 changed files with 431 additions and 31 deletions
+10 -6
View File
@@ -11,12 +11,14 @@ func NewTaskService() *TaskService {
return &TaskService{}
}
func (ts *TaskService) CreateTask(name, command, schedule string) *models.Task {
func (ts *TaskService) CreateTask(name, command, schedule string, timeout int, cleanConfig string) *models.Task {
task := &models.Task{
Name: name,
Command: command,
Schedule: schedule,
Enabled: true,
Name: name,
Command: command,
Schedule: schedule,
Timeout: timeout,
CleanConfig: cleanConfig,
Enabled: true,
}
database.DB.Create(task)
return task
@@ -52,7 +54,7 @@ func (ts *TaskService) GetTaskByID(id int) *models.Task {
return &task
}
func (ts *TaskService) UpdateTask(id int, name, command, schedule string, enabled bool) *models.Task {
func (ts *TaskService) UpdateTask(id int, name, command, schedule string, timeout int, cleanConfig string, enabled bool) *models.Task {
var task models.Task
if err := database.DB.First(&task, id).Error; err != nil {
return nil
@@ -60,6 +62,8 @@ func (ts *TaskService) UpdateTask(id int, name, command, schedule string, enable
task.Name = name
task.Command = command
task.Schedule = schedule
task.Timeout = timeout
task.CleanConfig = cleanConfig
task.Enabled = enabled
database.DB.Save(&task)
return &task