diff --git a/internal/infra/models/plan.go b/internal/infra/models/plan.go index fe3a186..84aaa79 100644 --- a/internal/infra/models/plan.go +++ b/internal/infra/models/plan.go @@ -38,6 +38,14 @@ const ( ParamsPlanID = "plan_id" ) +type PlanStatus uint8 + +const ( + PlanStatusEnabled PlanStatus = 0 // 启用计划 + PlanStatusDisabled PlanStatus = 1 // 禁用计划 + PlanStatusStopeed PlanStatus = 2 // 执行完毕 +) + // Plan 代表系统中的一个计划,可以包含子计划或任务 type Plan struct { gorm.Model @@ -45,6 +53,9 @@ type Plan struct { Name string `gorm:"not null" json:"name"` Description string `json:"description"` ExecutionType PlanExecutionType `gorm:"not null" json:"execution_type"` + Status PlanStatus `gorm:"default:0" json:"status"` // 计划是否被启动 + ExecuteNum uint `gorm:"default:0" json:"execute_num"` // 计划预期执行次数 + ExecuteCount uint `gorm:"default:0" json:"execute_count"` // 执行计数器 // 针对 PlanExecutionTypeAutomatic,使用 Cron 表达式定义调度规则 CronExpression string `json:"cron_expression"`