枚举改成中文
This commit is contained in:
@@ -19,7 +19,7 @@ import (
|
||||
type CreatePlanRequest struct {
|
||||
Name string `json:"name" binding:"required" example:"猪舍温度控制计划"`
|
||||
Description string `json:"description" example:"根据温度自动调节风扇和加热器"`
|
||||
ExecutionType models.PlanExecutionType `json:"execution_type" binding:"required" example:"automatic"`
|
||||
ExecutionType models.PlanExecutionType `json:"execution_type" binding:"required" example:"自动"`
|
||||
ExecuteNum uint `json:"execute_num,omitempty" example:"10"`
|
||||
CronExpression string `json:"cron_expression" example:"0 0 6 * * *"`
|
||||
SubPlanIDs []uint `json:"sub_plan_ids,omitempty"`
|
||||
@@ -31,12 +31,12 @@ type PlanResponse struct {
|
||||
ID uint `json:"id" example:"1"`
|
||||
Name string `json:"name" example:"猪舍温度控制计划"`
|
||||
Description string `json:"description" example:"根据温度自动调节风扇和加热器"`
|
||||
ExecutionType models.PlanExecutionType `json:"execution_type" example:"automatic"`
|
||||
Status models.PlanStatus `json:"status" example:"0"`
|
||||
ExecutionType models.PlanExecutionType `json:"execution_type" example:"自动"`
|
||||
Status models.PlanStatus `json:"status" example:"已启用"`
|
||||
ExecuteNum uint `json:"execute_num" example:"10"`
|
||||
ExecuteCount uint `json:"execute_count" example:"0"`
|
||||
CronExpression string `json:"cron_expression" example:"0 0 6 * * *"`
|
||||
ContentType models.PlanContentType `json:"content_type" example:"tasks"`
|
||||
ContentType models.PlanContentType `json:"content_type" example:"任务"`
|
||||
SubPlans []SubPlanResponse `json:"sub_plans,omitempty"`
|
||||
Tasks []TaskResponse `json:"tasks,omitempty"`
|
||||
}
|
||||
@@ -51,7 +51,7 @@ type ListPlansResponse struct {
|
||||
type UpdatePlanRequest struct {
|
||||
Name string `json:"name" example:"猪舍温度控制计划V2"`
|
||||
Description string `json:"description" example:"更新后的描述"`
|
||||
ExecutionType models.PlanExecutionType `json:"execution_type" example:"automatic"`
|
||||
ExecutionType models.PlanExecutionType `json:"execution_type" example:"自动"`
|
||||
ExecuteNum uint `json:"execute_num,omitempty" example:"10"`
|
||||
CronExpression string `json:"cron_expression" example:"0 0 6 * * *"`
|
||||
SubPlanIDs []uint `json:"sub_plan_ids,omitempty"`
|
||||
@@ -72,7 +72,7 @@ type TaskRequest struct {
|
||||
Name string `json:"name" example:"打开风扇"`
|
||||
Description string `json:"description" example:"打开1号风扇"`
|
||||
ExecutionOrder int `json:"execution_order" example:"1"`
|
||||
Type models.TaskType `json:"type" example:"waiting"`
|
||||
Type models.TaskType `json:"type" example:"等待"`
|
||||
Parameters map[string]interface{} `json:"parameters,omitempty"`
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ type TaskResponse struct {
|
||||
Name string `json:"name" example:"打开风扇"`
|
||||
Description string `json:"description" example:"打开1号风扇"`
|
||||
ExecutionOrder int `json:"execution_order" example:"1"`
|
||||
Type models.TaskType `json:"type" example:"waiting"`
|
||||
Type models.TaskType `json:"type" example:"等待"`
|
||||
Parameters map[string]interface{} `json:"parameters,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -435,7 +435,7 @@ func (s *Scheduler) handlePlanCompletion(planLogID uint) {
|
||||
|
||||
// 如果是自动计划且达到执行次数上限,或计划是手动类型,则更新计划状态为已停止
|
||||
if (plan.ExecutionType == models.PlanExecutionTypeAutomatic && plan.ExecuteNum > 0 && newExecuteCount >= plan.ExecuteNum) || plan.ExecutionType == models.PlanExecutionTypeManual {
|
||||
newStatus = models.PlanStatusStopeed
|
||||
newStatus = models.PlanStatusStopped
|
||||
s.logger.Infof("计划 %d 已完成执行,状态更新为 '执行完毕'。", topLevelPlanID)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user