From d93d2bc56ed06b3c060ff48f49591e8c5d779230 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期四, 14 九月 2023 22:33:45 +0800
Subject: [PATCH] 通讯方式字段转换

---
 constvar/const.go |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/constvar/const.go b/constvar/const.go
index d92f9f9..eb2f630 100644
--- a/constvar/const.go
+++ b/constvar/const.go
@@ -34,12 +34,23 @@
 type PlcMethod string
 
 const (
-	PlcMethodModbusTCP PlcMethod = "modbusTCP"
-	PlcMethodSerial    PlcMethod = "serial"
+	PlcMethodModbusTCP        PlcMethod = "modbusTCP"
+	PlcMethodSerial           PlcMethod = "serial"
+	PlcMethodModbusTCPChinese PlcMethod = "缃戠粶"
+	PlcMethodSerialChinese    PlcMethod = "涓插彛"
 )
 
-func (slf PlcMethod) Valid() bool {
-	return slf == PlcMethodModbusTCP || slf == PlcMethodSerial
+func (slf *PlcMethod) ConvertToEnglish() {
+	if *slf == PlcMethodModbusTCPChinese {
+		*slf = PlcMethodModbusTCP
+	}
+	if *slf == PlcMethodSerialChinese {
+		*slf = PlcMethodSerial
+	}
+}
+
+func (slf *PlcMethod) Valid() bool {
+	return *slf == PlcMethodModbusTCP || *slf == PlcMethodSerial
 }
 
 const (

--
Gitblit v1.8.0