| | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // SetDeviceConfig |
| | | // @Tags 设备 |
| | | // @Summary 设置设备一些配置 |
| | | // @Produce application/json |
| | | // @Param object body request.DeviceConfig true "查询参数" |
| | | // @Success 200 {object} contextx.Response{} "成功" |
| | | // @Router /v1/device/config [post] |
| | | func (slf *DeviceApi) config(c *gin.Context) { |
| | | var params request.DeviceConfig |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | if conf.Conf.CurrentDeviceID == "" { |
| | | ctx.FailWithMsg(ecode.UnknownErr, "当前设备为空,请检查") |
| | | return |
| | | } |
| | | err := service.UpdateDevice(conf.Conf.CurrentDeviceID, params.NeedSetProcessParams) |
| | | if err != nil { |
| | | logx.Errorf("save device config err:%v", err) |
| | | ctx.Fail(ecode.DBErr) |
| | | return |
| | | } |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // DeviceList |
| | | // @Tags 设备 |
| | | // @Summary 获取当前面板绑定的设备列表 |