调整swag
This commit is contained in:
@@ -3043,11 +3043,7 @@ const docTemplate = `{
|
|||||||
"properties": {
|
"properties": {
|
||||||
"action": {
|
"action": {
|
||||||
"description": "Action 不传表示这是一个传感器, 会触发一次采集",
|
"description": "Action 不传表示这是一个传感器, 会触发一次采集",
|
||||||
"type": "string",
|
"type": "string"
|
||||||
"enum": [
|
|
||||||
"on",
|
|
||||||
"off"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3035,11 +3035,7 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"action": {
|
"action": {
|
||||||
"description": "Action 不传表示这是一个传感器, 会触发一次采集",
|
"description": "Action 不传表示这是一个传感器, 会触发一次采集",
|
||||||
"type": "string",
|
"type": "string"
|
||||||
"enum": [
|
|
||||||
"on",
|
|
||||||
"off"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -338,9 +338,6 @@ definitions:
|
|||||||
properties:
|
properties:
|
||||||
action:
|
action:
|
||||||
description: Action 不传表示这是一个传感器, 会触发一次采集
|
description: Action 不传表示这是一个传感器, 会触发一次采集
|
||||||
enum:
|
|
||||||
- "on"
|
|
||||||
- "off"
|
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
dto.MovePigsIntoPenRequest:
|
dto.MovePigsIntoPenRequest:
|
||||||
|
|||||||
@@ -355,8 +355,13 @@ func (c *Controller) ManualControl(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
action := device.DeviceActionStart
|
action := device.DeviceActionStart
|
||||||
if *req.Action == "off" {
|
switch *req.Action {
|
||||||
|
case "off":
|
||||||
action = device.DeviceActionStop
|
action = device.DeviceActionStop
|
||||||
|
case "on":
|
||||||
|
default:
|
||||||
|
c.logger.Errorf("%s: 无效的动作: %s, 设备ID: %s", actionType, *req.Action, deviceID)
|
||||||
|
controller.SendErrorWithAudit(ctx, controller.CodeBadRequest, "无效的动作: "+*req.Action, actionType, "无效的动作", req.Action)
|
||||||
}
|
}
|
||||||
err = c.deviceService.Switch(dev, action)
|
err = c.deviceService.Switch(dev, action)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ type UpdateDeviceRequest struct {
|
|||||||
// ManualControlDeviceRequest 定义了手动控制设备时需要传入的参数
|
// ManualControlDeviceRequest 定义了手动控制设备时需要传入的参数
|
||||||
type ManualControlDeviceRequest struct {
|
type ManualControlDeviceRequest struct {
|
||||||
// Action 不传表示这是一个传感器, 会触发一次采集
|
// Action 不传表示这是一个传感器, 会触发一次采集
|
||||||
Action *string `json:"action" binding:"oneof=on off"`
|
Action *string `json:"action"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateAreaControllerRequest 定义了创建区域主控时需要传入的参数
|
// CreateAreaControllerRequest 定义了创建区域主控时需要传入的参数
|
||||||
|
|||||||
Reference in New Issue
Block a user