优化注释

This commit is contained in:
2025-09-12 17:51:09 +08:00
parent 9e9bf7b8a0
commit 906d371df6

View File

@@ -221,7 +221,7 @@ func (c *Controller) UpdateDevice(ctx *gin.Context) {
return
}
// 3. 更新字段
// 3. 更新从数据库中查出的现有设备对象的字段
existingDevice.Name = req.Name
existingDevice.Type = req.Type
existingDevice.SubType = req.SubType
@@ -229,7 +229,7 @@ func (c *Controller) UpdateDevice(ctx *gin.Context) {
existingDevice.Location = req.Location
existingDevice.Properties = datatypes.JSON(req.Properties)
// 4. 保存数据库
// 4. 将修改后的 existingDevice 对象保存数据库
if err := c.repo.Update(existingDevice); err != nil {
c.logger.Errorf("更新设备: 数据库操作失败: %v", err)
controller.SendErrorResponse(ctx, http.StatusInternalServerError, "更新设备失败")