调整 device和模板

This commit is contained in:
2025-09-29 23:46:33 +08:00
parent 35c2d03602
commit 503296e574

View File

@@ -55,8 +55,8 @@ func (g *GeneralDeviceService) Switch(device *models.Device, action DeviceAction
return fmt.Errorf("区域主控 %v(id=%v) 未通过自检: %w", areaController.Name, areaController.ID, err) return fmt.Errorf("区域主控 %v(id=%v) 未通过自检: %w", areaController.Name, areaController.ID, err)
} }
// 3. 使用模型层预定义的 BusProperties 结构体解析设备属性 // 3. 使用模型层预定义的 Bus485Properties 结构体解析设备属性
var deviceProps models.BusProperties var deviceProps models.Bus485Properties
if err := device.ParseProperties(&deviceProps); err != nil { if err := device.ParseProperties(&deviceProps); err != nil {
return fmt.Errorf("解析设备 %v(id=%v) 的属性失败: %w", device.Name, device.ID, err) return fmt.Errorf("解析设备 %v(id=%v) 的属性失败: %w", device.Name, device.ID, err)
} }
@@ -151,8 +151,8 @@ func (g *GeneralDeviceService) Collect(regionalControllerID uint, devicesToColle
continue continue
} }
// 使用模型层预定义的 BusProperties 结构体解析设备属性 // 使用模型层预定义的 Bus485Properties 结构体解析设备属性
var deviceProps models.BusProperties var deviceProps models.Bus485Properties
if err := dev.ParseProperties(&deviceProps); err != nil { if err := dev.ParseProperties(&deviceProps); err != nil {
g.logger.Warnf("跳过设备 %d因其属性解析失败: %v", dev.ID, err) g.logger.Warnf("跳过设备 %d因其属性解析失败: %v", dev.ID, err)
continue continue