From 3fb5f541891e3aa69060a1ea9b3808cc42bbbfa8 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期一, 06 十一月 2023 10:51:26 +0800
Subject: [PATCH] add log
---
service/device.go | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/service/device.go b/service/device.go
index 29f2784..8ad1d23 100644
--- a/service/device.go
+++ b/service/device.go
@@ -4,12 +4,16 @@
"apsClient/conf"
"apsClient/model"
"apsClient/pkg/logx"
+ "github.com/jinzhu/gorm"
"os"
"strings"
)
func GetDeviceIDList() (deviceIds []string, err error) {
devices, err := model.NewDeviceSearch().SetDeviceMac(conf.Conf.System.DeviceId).FindNotTotal()
+ if err == gorm.ErrRecordNotFound {
+ return nil, nil
+ }
if err != nil {
return nil, err
}
@@ -32,9 +36,9 @@
}
if len(deviceList) == 0 {
conf.Conf.CurrentDeviceID = conf.Conf.System.DeviceId
- return nil
+ } else {
+ conf.Conf.CurrentDeviceID = deviceList[0]
}
- conf.Conf.CurrentDeviceID = deviceList[0]
SetDeviceIDToFile(conf.Conf.CurrentDeviceID)
return nil
}
--
Gitblit v1.8.0