From fecd8ff508b33715cbe24ca892fc19a2d1ad1ef5 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期一, 06 十一月 2023 16:34:05 +0800
Subject: [PATCH] 加锁解决同时读串口时报的资源不可用和超时报错

---
 model/device_plc.go |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/model/device_plc.go b/model/device_plc.go
index c68b1f3..a098e81 100644
--- a/model/device_plc.go
+++ b/model/device_plc.go
@@ -127,7 +127,7 @@
 func (slf *DevicePlcSearch) Save(record *DevicePlc) error {
 	var db = slf.build()
 
-	if err := db.Omit("CreatedAt").Updates(record).Error; err != nil {
+	if err := db.Omit("CreatedAt").Save(record).Error; err != nil {
 		return fmt.Errorf("save err: %v, record: %+v", err, record)
 	}
 

--
Gitblit v1.8.0