You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.1 KiB
43 lines
1.1 KiB
package user
|
|
|
|
import (
|
|
"yunyan/comm"
|
|
"yunyan/pb"
|
|
)
|
|
|
|
// @Summary 更新设备设置接口
|
|
// @Description 更新设备设置接口
|
|
// @Tags User
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Security BearerAuth
|
|
// @Param user body pb.UserUpdateDeviceSettingReq true "发送请求"
|
|
// @Success 200 {object} comm.HttpResult{data=pb.UserUpdateDeviceSettingResp} "成功返回"
|
|
// @Router /api/home/user_updatedevicesetting [post]
|
|
func (this *apiComp) UpdateDeviceSetting(session comm.IUserSession, req *pb.UserUpdateDeviceSettingReq) (resp *pb.UserUpdateDeviceSettingResp, errdata *pb.ErrorData) {
|
|
var (
|
|
divice *pb.DBUserDivice
|
|
)
|
|
divice, err := this.module.model.getDevice(req.Id)
|
|
if err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Message: pb.ErrorCode_DBError.String(),
|
|
}
|
|
return
|
|
}
|
|
divice.Lxsetting = req.Lxsetting
|
|
err = this.module.model.saveDevice(divice)
|
|
if err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Message: pb.ErrorCode_DBError.String(),
|
|
}
|
|
return
|
|
}
|
|
resp = &pb.UserUpdateDeviceSettingResp{
|
|
Id: req.Id,
|
|
Lxsetting: req.Lxsetting,
|
|
}
|
|
return
|
|
}
|
|
|