定义接口
This commit is contained in:
266
docs/docs.go
266
docs/docs.go
@@ -162,6 +162,211 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plans": {
|
||||
"get": {
|
||||
"description": "获取所有计划的列表",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "获取计划列表",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "创建一个新的计划,包括其基本信息和所有关联的子计划/任务。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "创建计划",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "计划信息",
|
||||
"name": "plan",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/plan.CreatePlanRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plans/{id}": {
|
||||
"get": {
|
||||
"description": "根据计划ID获取单个计划的详细信息。",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "获取计划详情",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "计划ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 404, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"description": "根据计划ID更新计划的详细信息。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "更新计划",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "计划ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "更新后的计划信息",
|
||||
"name": "plan",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/plan.UpdatePlanRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 404, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"description": "根据计划ID删除计划。",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "删除计划",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "计划ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 404, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plans/{id}/start": {
|
||||
"post": {
|
||||
"description": "根据计划ID启动一个计划的执行。",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "启动计划",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "计划ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 404, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plans/{id}/stop": {
|
||||
"post": {
|
||||
"description": "根据计划ID停止一个正在执行的计划。",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "停止计划",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "计划ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 404, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/users": {
|
||||
"post": {
|
||||
"description": "根据用户名和密码创建一个新的系统用户。",
|
||||
@@ -345,6 +550,67 @@ const docTemplate = `{
|
||||
"DeviceTypeDevice"
|
||||
]
|
||||
},
|
||||
"plan.CreatePlanRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string",
|
||||
"example": "根据温度自动调节风扇和加热器"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "猪舍温度控制计划"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plan.ListPlansResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"plans": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/plan.PlanResponse"
|
||||
}
|
||||
},
|
||||
"total": {
|
||||
"type": "integer",
|
||||
"example": 100
|
||||
}
|
||||
}
|
||||
},
|
||||
"plan.PlanResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string",
|
||||
"example": "根据温度自动调节风扇和加热器"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "猪舍温度控制计划"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plan.UpdatePlanRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string",
|
||||
"example": "更新后的描述"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "猪舍温度控制计划V2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.CreateUserRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
||||
@@ -151,6 +151,211 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plans": {
|
||||
"get": {
|
||||
"description": "获取所有计划的列表",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "获取计划列表",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "创建一个新的计划,包括其基本信息和所有关联的子计划/任务。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "创建计划",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "计划信息",
|
||||
"name": "plan",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/plan.CreatePlanRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plans/{id}": {
|
||||
"get": {
|
||||
"description": "根据计划ID获取单个计划的详细信息。",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "获取计划详情",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "计划ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 404, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"description": "根据计划ID更新计划的详细信息。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "更新计划",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "计划ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "更新后的计划信息",
|
||||
"name": "plan",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/plan.UpdatePlanRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 404, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"description": "根据计划ID删除计划。",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "删除计划",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "计划ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 404, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plans/{id}/start": {
|
||||
"post": {
|
||||
"description": "根据计划ID启动一个计划的执行。",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "启动计划",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "计划ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 404, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/plans/{id}/stop": {
|
||||
"post": {
|
||||
"description": "根据计划ID停止一个正在执行的计划。",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"计划管理"
|
||||
],
|
||||
"summary": "停止计划",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "计划ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 404, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/users": {
|
||||
"post": {
|
||||
"description": "根据用户名和密码创建一个新的系统用户。",
|
||||
@@ -334,6 +539,67 @@
|
||||
"DeviceTypeDevice"
|
||||
]
|
||||
},
|
||||
"plan.CreatePlanRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string",
|
||||
"example": "根据温度自动调节风扇和加热器"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "猪舍温度控制计划"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plan.ListPlansResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"plans": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/plan.PlanResponse"
|
||||
}
|
||||
},
|
||||
"total": {
|
||||
"type": "integer",
|
||||
"example": 100
|
||||
}
|
||||
}
|
||||
},
|
||||
"plan.PlanResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string",
|
||||
"example": "根据温度自动调节风扇和加热器"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "猪舍温度控制计划"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plan.UpdatePlanRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string",
|
||||
"example": "更新后的描述"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "猪舍温度控制计划V2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.CreateUserRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
||||
@@ -79,6 +79,48 @@ definitions:
|
||||
x-enum-varnames:
|
||||
- DeviceTypeAreaController
|
||||
- DeviceTypeDevice
|
||||
plan.CreatePlanRequest:
|
||||
properties:
|
||||
description:
|
||||
example: 根据温度自动调节风扇和加热器
|
||||
type: string
|
||||
name:
|
||||
example: 猪舍温度控制计划
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
plan.ListPlansResponse:
|
||||
properties:
|
||||
plans:
|
||||
items:
|
||||
$ref: '#/definitions/plan.PlanResponse'
|
||||
type: array
|
||||
total:
|
||||
example: 100
|
||||
type: integer
|
||||
type: object
|
||||
plan.PlanResponse:
|
||||
properties:
|
||||
description:
|
||||
example: 根据温度自动调节风扇和加热器
|
||||
type: string
|
||||
id:
|
||||
example: 1
|
||||
type: integer
|
||||
name:
|
||||
example: 猪舍温度控制计划
|
||||
type: string
|
||||
type: object
|
||||
plan.UpdatePlanRequest:
|
||||
properties:
|
||||
description:
|
||||
example: 更新后的描述
|
||||
type: string
|
||||
name:
|
||||
example: 猪舍温度控制计划V2
|
||||
type: string
|
||||
type: object
|
||||
user.CreateUserRequest:
|
||||
properties:
|
||||
password:
|
||||
@@ -225,6 +267,141 @@ paths:
|
||||
summary: 更新设备信息
|
||||
tags:
|
||||
- 设备管理
|
||||
/plans:
|
||||
get:
|
||||
description: 获取所有计划的列表
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 业务失败,具体错误码和信息见响应体(例如400, 500)
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
summary: 获取计划列表
|
||||
tags:
|
||||
- 计划管理
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 创建一个新的计划,包括其基本信息和所有关联的子计划/任务。
|
||||
parameters:
|
||||
- description: 计划信息
|
||||
in: body
|
||||
name: plan
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/plan.CreatePlanRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 业务失败,具体错误码和信息见响应体(例如400, 500)
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
summary: 创建计划
|
||||
tags:
|
||||
- 计划管理
|
||||
/plans/{id}:
|
||||
delete:
|
||||
description: 根据计划ID删除计划。
|
||||
parameters:
|
||||
- description: 计划ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 业务失败,具体错误码和信息见响应体(例如400, 404, 500)
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
summary: 删除计划
|
||||
tags:
|
||||
- 计划管理
|
||||
get:
|
||||
description: 根据计划ID获取单个计划的详细信息。
|
||||
parameters:
|
||||
- description: 计划ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 业务失败,具体错误码和信息见响应体(例如400, 404, 500)
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
summary: 获取计划详情
|
||||
tags:
|
||||
- 计划管理
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 根据计划ID更新计划的详细信息。
|
||||
parameters:
|
||||
- description: 计划ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: 更新后的计划信息
|
||||
in: body
|
||||
name: plan
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/plan.UpdatePlanRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 业务失败,具体错误码和信息见响应体(例如400, 404, 500)
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
summary: 更新计划
|
||||
tags:
|
||||
- 计划管理
|
||||
/plans/{id}/start:
|
||||
post:
|
||||
description: 根据计划ID启动一个计划的执行。
|
||||
parameters:
|
||||
- description: 计划ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 业务失败,具体错误码和信息见响应体(例如400, 404, 500)
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
summary: 启动计划
|
||||
tags:
|
||||
- 计划管理
|
||||
/plans/{id}/stop:
|
||||
post:
|
||||
description: 根据计划ID停止一个正在执行的计划。
|
||||
parameters:
|
||||
- description: 计划ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 业务失败,具体错误码和信息见响应体(例如400, 404, 500)
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
summary: 停止计划
|
||||
tags:
|
||||
- 计划管理
|
||||
/users:
|
||||
post:
|
||||
consumes:
|
||||
|
||||
Reference in New Issue
Block a user