调整 device和模板
This commit is contained in:
		| @@ -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) | ||||
| 	} | ||||
|  | ||||
| 	// 3. 使用模型层预定义的 BusProperties 结构体解析设备属性 | ||||
| 	var deviceProps models.BusProperties | ||||
| 	// 3. 使用模型层预定义的 Bus485Properties 结构体解析设备属性 | ||||
| 	var deviceProps models.Bus485Properties | ||||
| 	if err := device.ParseProperties(&deviceProps); err != nil { | ||||
| 		return fmt.Errorf("解析设备 %v(id=%v) 的属性失败: %w", device.Name, device.ID, err) | ||||
| 	} | ||||
| @@ -151,8 +151,8 @@ func (g *GeneralDeviceService) Collect(regionalControllerID uint, devicesToColle | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| 		// 使用模型层预定义的 BusProperties 结构体解析设备属性 | ||||
| 		var deviceProps models.BusProperties | ||||
| 		// 使用模型层预定义的 Bus485Properties 结构体解析设备属性 | ||||
| 		var deviceProps models.Bus485Properties | ||||
| 		if err := dev.ParseProperties(&deviceProps); err != nil { | ||||
| 			g.logger.Warnf("跳过设备 %d,因其属性解析失败: %v", dev.ID, err) | ||||
| 			continue | ||||
|   | ||||
		Reference in New Issue
	
	Block a user