枚举改成中文
This commit is contained in:
@@ -15,25 +15,25 @@ import (
|
||||
type PlanExecutionType string
|
||||
|
||||
const (
|
||||
PlanExecutionTypeAutomatic PlanExecutionType = "automatic" // 自动执行 (包含定时和循环)
|
||||
PlanExecutionTypeManual PlanExecutionType = "manual" // 手动执行
|
||||
PlanExecutionTypeAutomatic PlanExecutionType = "自动" // 自动执行 (包含定时和循环)
|
||||
PlanExecutionTypeManual PlanExecutionType = "手动" // 手动执行
|
||||
)
|
||||
|
||||
// PlanContentType 定义了计划包含的内容类型
|
||||
type PlanContentType string
|
||||
|
||||
const (
|
||||
PlanContentTypeSubPlans PlanContentType = "sub_plans" // 计划包含子计划
|
||||
PlanContentTypeTasks PlanContentType = "tasks" // 计划包含任务
|
||||
PlanContentTypeSubPlans PlanContentType = "子计划" // 计划包含子计划
|
||||
PlanContentTypeTasks PlanContentType = "任务" // 计划包含任务
|
||||
)
|
||||
|
||||
// TaskType 定义了任务的类型,每个类型可以对应 task 包中的一个具体动作
|
||||
type TaskType string
|
||||
|
||||
const (
|
||||
TaskPlanAnalysis TaskType = "plan_analysis" // 解析Plan的Task列表并添加到待执行队列的特殊任务
|
||||
TaskTypeWaiting TaskType = "waiting" // 等待任务
|
||||
TaskTypeReleaseFeedWeight TaskType = "release_feed_weight" // 下料口释放指定重量任务
|
||||
TaskPlanAnalysis TaskType = "计划分析" // 解析Plan的Task列表并添加到待执行队列的特殊任务
|
||||
TaskTypeWaiting TaskType = "等待" // 等待任务
|
||||
TaskTypeReleaseFeedWeight TaskType = "下料" // 下料口释放指定重量任务
|
||||
)
|
||||
|
||||
// -- Task Parameters --
|
||||
@@ -42,13 +42,14 @@ const (
|
||||
ParamsPlanID = "plan_id"
|
||||
)
|
||||
|
||||
type PlanStatus uint8
|
||||
// PlanStatus 定义了计划的状态
|
||||
type PlanStatus string
|
||||
|
||||
const (
|
||||
PlanStatusDisabled PlanStatus = 0 // 禁用计划
|
||||
PlanStatusEnabled PlanStatus = 1 // 启用计划
|
||||
PlanStatusStopeed PlanStatus = 2 // 执行完毕
|
||||
PlanStatusFailed PlanStatus = 3 // 执行失败
|
||||
PlanStatusDisabled PlanStatus = "已禁用" // 禁用计划
|
||||
PlanStatusEnabled PlanStatus = "已启用" // 启用计划
|
||||
PlanStatusStopped PlanStatus = "执行完毕" // 执行完毕
|
||||
PlanStatusFailed PlanStatus = "执行失败" // 执行失败
|
||||
)
|
||||
|
||||
// Plan 代表系统中的一个计划,可以包含子计划或任务
|
||||
@@ -58,9 +59,9 @@ type Plan struct {
|
||||
Name string `gorm:"not null" json:"name"`
|
||||
Description string `json:"description"`
|
||||
ExecutionType PlanExecutionType `gorm:"not null;index" json:"execution_type"`
|
||||
Status PlanStatus `gorm:"default:0;index" json:"status"` // 计划是否被启动
|
||||
ExecuteNum uint `gorm:"default:0" json:"execute_num"` // 计划预期执行次数
|
||||
ExecuteCount uint `gorm:"default:0" json:"execute_count"` // 执行计数器
|
||||
Status PlanStatus `gorm:"default:'已禁用';index" 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"`
|
||||
|
||||
Reference in New Issue
Block a user