|
@@ -199,17 +199,20 @@ func parseData(data *model.QueueData) {
|
|
reg.Devices[i].State = 1
|
|
reg.Devices[i].State = 1
|
|
reg.Devices[i].OnlineTime = time.Now()
|
|
reg.Devices[i].OnlineTime = time.Now()
|
|
service.Cron{}.RelayOnOffTimeTaskSn(device.Sn)
|
|
service.Cron{}.RelayOnOffTimeTaskSn(device.Sn)
|
|
- }
|
|
|
|
- for i2, _ := range device.DeviceLoops {
|
|
|
|
- if toString[6:8] == "ff" || toString[6:8] == "0f" {
|
|
|
|
- device.DeviceLoops[i2].State = 1
|
|
|
|
- } else if toString[6:8] == "00" {
|
|
|
|
- device.DeviceLoops[i2].State = 0
|
|
|
|
|
|
+ for i2, _ := range device.DeviceLoops {
|
|
|
|
+ if toString[6:8] == "ff" || toString[6:8] == "0f" {
|
|
|
|
+ device.DeviceLoops[i2].State = 1
|
|
|
|
+ } else if toString[6:8] == "00" {
|
|
|
|
+ device.DeviceLoops[i2].State = 0
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ logger.Get().Println(reg.Devices[i])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
regions, err := utils.SaveRegionOnData(reg)
|
|
regions, err := utils.SaveRegionOnData(reg)
|
|
|
|
+ model.Mutex.Lock()
|
|
err = service.SaveData(regions)
|
|
err = service.SaveData(regions)
|
|
|
|
+ model.Mutex.Unlock()
|
|
if err != nil {
|
|
if err != nil {
|
|
logger.Get().Errorln("设备回路状态" + err.Error())
|
|
logger.Get().Errorln("设备回路状态" + err.Error())
|
|
return
|
|
return
|