feat: 新增设备切卡模式接口 SetSwitchMode
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m32s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m32s
This commit is contained in:
@@ -286,6 +286,26 @@ func (h *DeviceHandler) SwitchCard(c *fiber.Ctx) error {
|
||||
return response.Success(c, nil)
|
||||
}
|
||||
|
||||
// SetSwitchMode 设置设备切卡模式
|
||||
// POST /api/admin/devices/by-identifier/:identifier/switch-mode
|
||||
func (h *DeviceHandler) SetSwitchMode(c *fiber.Ctx) error {
|
||||
identifier := c.Params("identifier")
|
||||
if identifier == "" {
|
||||
return errors.New(errors.CodeInvalidParam, "设备标识符不能为空")
|
||||
}
|
||||
|
||||
var req dto.SetSwitchModeRequest
|
||||
if err := c.BodyParser(&req); err != nil {
|
||||
return errors.New(errors.CodeInvalidParam, "请求参数解析失败")
|
||||
}
|
||||
|
||||
if err := h.service.GatewaySwitchMode(c.UserContext(), identifier, &req); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return response.Success(c, nil)
|
||||
}
|
||||
|
||||
// RebootDevice 重启设备
|
||||
// POST /api/admin/devices/by-identifier/:identifier/reboot
|
||||
func (h *DeviceHandler) RebootDevice(c *fiber.Ctx) error {
|
||||
|
||||
Reference in New Issue
Block a user