修改model

This commit is contained in:
2025-09-19 12:53:58 +08:00
parent 46c7b96fed
commit d94a18779e

View File

@@ -38,6 +38,14 @@ const (
ParamsPlanID = "plan_id" ParamsPlanID = "plan_id"
) )
type PlanStatus uint8
const (
PlanStatusEnabled PlanStatus = 0 // 启用计划
PlanStatusDisabled PlanStatus = 1 // 禁用计划
PlanStatusStopeed PlanStatus = 2 // 执行完毕
)
// Plan 代表系统中的一个计划,可以包含子计划或任务 // Plan 代表系统中的一个计划,可以包含子计划或任务
type Plan struct { type Plan struct {
gorm.Model gorm.Model
@@ -45,6 +53,9 @@ type Plan struct {
Name string `gorm:"not null" json:"name"` Name string `gorm:"not null" json:"name"`
Description string `json:"description"` Description string `json:"description"`
ExecutionType PlanExecutionType `gorm:"not null" json:"execution_type"` 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 表达式定义调度规则 // 针对 PlanExecutionTypeAutomatic使用 Cron 表达式定义调度规则
CronExpression string `json:"cron_expression"` CronExpression string `json:"cron_expression"`