feat: 新增设备切卡模式接口 SetSwitchMode
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m32s

This commit is contained in:
2026-04-18 16:22:30 +08:00
parent 2b3a9cb33f
commit fd795d8742
7 changed files with 146 additions and 0 deletions

View File

@@ -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 {