枚举改成中文

This commit is contained in:
2025-10-01 20:39:59 +08:00
parent f814e682cf
commit 3cc88a5248
12 changed files with 136 additions and 128 deletions

View File

@@ -1345,8 +1345,8 @@ const docTemplate = `{
"models.DeviceCategory": {
"type": "string",
"enum": [
"actuator",
"sensor"
"执行器",
"传感器"
],
"x-enum-varnames": [
"CategoryActuator",
@@ -1356,8 +1356,8 @@ const docTemplate = `{
"models.PlanContentType": {
"type": "string",
"enum": [
"sub_plans",
"tasks"
"子计划",
"任务"
],
"x-enum-comments": {
"PlanContentTypeSubPlans": "计划包含子计划",
@@ -1375,8 +1375,8 @@ const docTemplate = `{
"models.PlanExecutionType": {
"type": "string",
"enum": [
"automatic",
"manual"
"自动",
"手动"
],
"x-enum-comments": {
"PlanExecutionTypeAutomatic": "自动执行 (包含定时和循环)",
@@ -1392,19 +1392,18 @@ const docTemplate = `{
]
},
"models.PlanStatus": {
"type": "integer",
"format": "int32",
"type": "string",
"enum": [
0,
1,
2,
3
"已禁用",
"已启用",
"执行完毕",
"执行失败"
],
"x-enum-comments": {
"PlanStatusDisabled": "禁用计划",
"PlanStatusEnabled": "启用计划",
"PlanStatusFailed": "执行失败",
"PlanStatusStopeed": "执行完毕"
"PlanStatusStopped": "执行完毕"
},
"x-enum-descriptions": [
"禁用计划",
@@ -1415,18 +1414,18 @@ const docTemplate = `{
"x-enum-varnames": [
"PlanStatusDisabled",
"PlanStatusEnabled",
"PlanStatusStopeed",
"PlanStatusStopped",
"PlanStatusFailed"
]
},
"models.SensorType": {
"type": "string",
"enum": [
"signal_metrics",
"battery_level",
"temperature",
"humidity",
"weight"
"信号强度",
"电池电量",
"温度",
"湿度",
"重量"
],
"x-enum-comments": {
"SensorTypeBatteryLevel": "电池电量",
@@ -1453,9 +1452,9 @@ const docTemplate = `{
"models.TaskType": {
"type": "string",
"enum": [
"plan_analysis",
"waiting",
"release_feed_weight"
"计划分析",
"等待",
"下料"
],
"x-enum-comments": {
"TaskPlanAnalysis": "解析Plan的Task列表并添加到待执行队列的特殊任务",
@@ -1514,7 +1513,7 @@ const docTemplate = `{
"$ref": "#/definitions/models.PlanExecutionType"
}
],
"example": "automatic"
"example": "自动"
},
"name": {
"type": "string",
@@ -1558,7 +1557,7 @@ const docTemplate = `{
"$ref": "#/definitions/models.PlanContentType"
}
],
"example": "tasks"
"example": "任务"
},
"cron_expression": {
"type": "string",
@@ -1582,7 +1581,7 @@ const docTemplate = `{
"$ref": "#/definitions/models.PlanExecutionType"
}
],
"example": "automatic"
"example": "自动"
},
"id": {
"type": "integer",
@@ -1598,7 +1597,7 @@ const docTemplate = `{
"$ref": "#/definitions/models.PlanStatus"
}
],
"example": 0
"example": "已启用"
},
"sub_plans": {
"type": "array",
@@ -1663,7 +1662,7 @@ const docTemplate = `{
"$ref": "#/definitions/models.TaskType"
}
],
"example": "waiting"
"example": "等待"
}
}
},
@@ -1700,7 +1699,7 @@ const docTemplate = `{
"$ref": "#/definitions/models.TaskType"
}
],
"example": "waiting"
"example": "等待"
}
}
},
@@ -1725,7 +1724,7 @@ const docTemplate = `{
"$ref": "#/definitions/models.PlanExecutionType"
}
],
"example": "automatic"
"example": "自动"
},
"name": {
"type": "string",

View File

@@ -1334,8 +1334,8 @@
"models.DeviceCategory": {
"type": "string",
"enum": [
"actuator",
"sensor"
"执行器",
"传感器"
],
"x-enum-varnames": [
"CategoryActuator",
@@ -1345,8 +1345,8 @@
"models.PlanContentType": {
"type": "string",
"enum": [
"sub_plans",
"tasks"
"子计划",
"任务"
],
"x-enum-comments": {
"PlanContentTypeSubPlans": "计划包含子计划",
@@ -1364,8 +1364,8 @@
"models.PlanExecutionType": {
"type": "string",
"enum": [
"automatic",
"manual"
"自动",
"手动"
],
"x-enum-comments": {
"PlanExecutionTypeAutomatic": "自动执行 (包含定时和循环)",
@@ -1381,19 +1381,18 @@
]
},
"models.PlanStatus": {
"type": "integer",
"format": "int32",
"type": "string",
"enum": [
0,
1,
2,
3
"已禁用",
"已启用",
"执行完毕",
"执行失败"
],
"x-enum-comments": {
"PlanStatusDisabled": "禁用计划",
"PlanStatusEnabled": "启用计划",
"PlanStatusFailed": "执行失败",
"PlanStatusStopeed": "执行完毕"
"PlanStatusStopped": "执行完毕"
},
"x-enum-descriptions": [
"禁用计划",
@@ -1404,18 +1403,18 @@
"x-enum-varnames": [
"PlanStatusDisabled",
"PlanStatusEnabled",
"PlanStatusStopeed",
"PlanStatusStopped",
"PlanStatusFailed"
]
},
"models.SensorType": {
"type": "string",
"enum": [
"signal_metrics",
"battery_level",
"temperature",
"humidity",
"weight"
"信号强度",
"电池电量",
"温度",
"湿度",
"重量"
],
"x-enum-comments": {
"SensorTypeBatteryLevel": "电池电量",
@@ -1442,9 +1441,9 @@
"models.TaskType": {
"type": "string",
"enum": [
"plan_analysis",
"waiting",
"release_feed_weight"
"计划分析",
"等待",
"下料"
],
"x-enum-comments": {
"TaskPlanAnalysis": "解析Plan的Task列表并添加到待执行队列的特殊任务",
@@ -1503,7 +1502,7 @@
"$ref": "#/definitions/models.PlanExecutionType"
}
],
"example": "automatic"
"example": "自动"
},
"name": {
"type": "string",
@@ -1547,7 +1546,7 @@
"$ref": "#/definitions/models.PlanContentType"
}
],
"example": "tasks"
"example": "任务"
},
"cron_expression": {
"type": "string",
@@ -1571,7 +1570,7 @@
"$ref": "#/definitions/models.PlanExecutionType"
}
],
"example": "automatic"
"example": "自动"
},
"id": {
"type": "integer",
@@ -1587,7 +1586,7 @@
"$ref": "#/definitions/models.PlanStatus"
}
],
"example": 0
"example": "已启用"
},
"sub_plans": {
"type": "array",
@@ -1652,7 +1651,7 @@
"$ref": "#/definitions/models.TaskType"
}
],
"example": "waiting"
"example": "等待"
}
}
},
@@ -1689,7 +1688,7 @@
"$ref": "#/definitions/models.TaskType"
}
],
"example": "waiting"
"example": "等待"
}
}
},
@@ -1714,7 +1713,7 @@
"$ref": "#/definitions/models.PlanExecutionType"
}
],
"example": "automatic"
"example": "自动"
},
"name": {
"type": "string",

View File

@@ -229,16 +229,16 @@ definitions:
type: object
models.DeviceCategory:
enum:
- actuator
- sensor
- 执行器
- 传感器
type: string
x-enum-varnames:
- CategoryActuator
- CategorySensor
models.PlanContentType:
enum:
- sub_plans
- tasks
- 子计划
- 任务
type: string
x-enum-comments:
PlanContentTypeSubPlans: 计划包含子计划
@@ -251,8 +251,8 @@ definitions:
- PlanContentTypeTasks
models.PlanExecutionType:
enum:
- automatic
- manual
- 自动
- 手动
type: string
x-enum-comments:
PlanExecutionTypeAutomatic: 自动执行 (包含定时和循环)
@@ -265,17 +265,16 @@ definitions:
- PlanExecutionTypeManual
models.PlanStatus:
enum:
- 0
- 1
- 2
- 3
format: int32
type: integer
- 已禁用
- 已启用
- 执行完毕
- 执行失败
type: string
x-enum-comments:
PlanStatusDisabled: 禁用计划
PlanStatusEnabled: 启用计划
PlanStatusFailed: 执行失败
PlanStatusStopeed: 执行完毕
PlanStatusStopped: 执行完毕
x-enum-descriptions:
- 禁用计划
- 启用计划
@@ -284,15 +283,15 @@ definitions:
x-enum-varnames:
- PlanStatusDisabled
- PlanStatusEnabled
- PlanStatusStopeed
- PlanStatusStopped
- PlanStatusFailed
models.SensorType:
enum:
- signal_metrics
- battery_level
- temperature
- humidity
- weight
- 信号强度
- 电池电量
- 温度
- 湿度
- 重量
type: string
x-enum-comments:
SensorTypeBatteryLevel: 电池电量
@@ -314,9 +313,9 @@ definitions:
- SensorTypeWeight
models.TaskType:
enum:
- plan_analysis
- waiting
- release_feed_weight
- 计划分析
- 等待
- 下料
type: string
x-enum-comments:
TaskPlanAnalysis: 解析Plan的Task列表并添加到待执行队列的特殊任务
@@ -355,7 +354,7 @@ definitions:
execution_type:
allOf:
- $ref: '#/definitions/models.PlanExecutionType'
example: automatic
example: 自动
name:
example: 猪舍温度控制计划
type: string
@@ -386,7 +385,7 @@ definitions:
content_type:
allOf:
- $ref: '#/definitions/models.PlanContentType'
example: tasks
example: 任务
cron_expression:
example: 0 0 6 * * *
type: string
@@ -402,7 +401,7 @@ definitions:
execution_type:
allOf:
- $ref: '#/definitions/models.PlanExecutionType'
example: automatic
example: 自动
id:
example: 1
type: integer
@@ -412,7 +411,7 @@ definitions:
status:
allOf:
- $ref: '#/definitions/models.PlanStatus'
example: 0
example: 已启用
sub_plans:
items:
$ref: '#/definitions/plan.SubPlanResponse'
@@ -456,7 +455,7 @@ definitions:
type:
allOf:
- $ref: '#/definitions/models.TaskType'
example: waiting
example: 等待
type: object
plan.TaskResponse:
properties:
@@ -481,7 +480,7 @@ definitions:
type:
allOf:
- $ref: '#/definitions/models.TaskType'
example: waiting
example: 等待
type: object
plan.UpdatePlanRequest:
properties:
@@ -497,7 +496,7 @@ definitions:
execution_type:
allOf:
- $ref: '#/definitions/models.PlanExecutionType'
example: automatic
example: 自动
name:
example: 猪舍温度控制计划V2
type: string