From 20bbbcc1d14536ddaa498ac84a6008828df8dc1c Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期三, 13 十二月 2023 20:23:11 +0800 Subject: [PATCH] 往plc写目标数时,优先往写入地址写,没有写入地址再往读取地址写 --- service/device.go | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/service/device.go b/service/device.go index e9731cf..1906d99 100644 --- a/service/device.go +++ b/service/device.go @@ -56,12 +56,12 @@ if err != nil { return err } - if len(deviceList) >= 0 { + if len(deviceList) > 0 { conf.Conf.CurrentDeviceID = deviceList[0] - } else if ServerID != "" { - conf.Conf.CurrentDeviceID = ServerID - } else { + } else if conf.Conf.System.DeviceId != "" { conf.Conf.CurrentDeviceID = conf.Conf.System.DeviceId + } else { + conf.Conf.CurrentDeviceID = ServerID } SetDeviceIDToFile(conf.Conf.CurrentDeviceID) return nil -- Gitblit v1.8.0