From cab6eea89a0d82710369604ecb51f1cdb122e433 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期四, 19 十月 2023 17:26:34 +0800 Subject: [PATCH] fix --- service/device_plc.go | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/service/device_plc.go b/service/device_plc.go index 2cac8b6..90c3e51 100644 --- a/service/device_plc.go +++ b/service/device_plc.go @@ -8,7 +8,7 @@ "apsClient/pkg/structx" "encoding/json" "errors" - "gorm.io/gorm" + "github.com/jinzhu/gorm" ) type DevicePlcService struct{} @@ -21,7 +21,6 @@ DevicePlc, err := model.NewDevicePlcSearch().SetOrder("id desc").First() if err == gorm.ErrRecordNotFound { return &model.DevicePlc{ - Id: 0, Brand: "", Method: "", Address: "", @@ -42,11 +41,11 @@ func (slf DevicePlcService) GetDeviceChannelAmount() (int, error) { plcConfig, code := slf.GetDevicePlc() - if code != ecode.OK || plcConfig.Id == 0 { - return 0, errors.New("璇峰厛閰嶇疆PLC") + if code != ecode.OK || plcConfig.ID == 0 { + return 0, errors.New("鏈幏鍙栧埌PLC鍦板潃锛岃鍦ㄥ伐鑹烘ā鍨嬪簱涓笂浼狅紒") } if len(plcConfig.Details) == 0 { - return 0, errors.New("璇峰厛閰嶇疆PLC") + return 0, errors.New("鏈幏鍙栧埌PLC鍦板潃锛岃鍦ㄥ伐鑹烘ā鍨嬪簱涓笂浼狅紒") } return len(plcConfig.Details) / 2, nil } -- Gitblit v1.8.0