From 9c4763d79154e0c4e708c8c13b5cef1182242edf Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期四, 22 八月 2024 19:59:57 +0800
Subject: [PATCH] 修复电梯运行状态查询的bug
---
pkg/floor.go | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/pkg/floor.go b/pkg/floor.go
index 30629ee..379d22b 100644
--- a/pkg/floor.go
+++ b/pkg/floor.go
@@ -4,15 +4,14 @@
"fmt"
"strconv"
"strings"
-
- "gat1400Exchange/pkg/snowflake"
)
// 鐢熸垚涓�涓寘鍚ゼ灞傜殑浜鸿劯id,瑙f瀽妤煎眰
-// 鏂癷d鐨勮鍒�, 20浣嶈澶囩紪鐮� +02 +14浣嶆椂闂� + 5555 + 3浣嶆ゼ灞�(绗竴浣�0琛ㄧず姝�,1琛ㄧず璐�) + 5浣嶉殢鏈烘暟
+// 浣跨敤48浣嶆簮id, 鍏朵腑鍓�41浣嶆槸imageid, 涓嶅彲浠ヤ慨鏀� 41-43浣嶅~ 06 浠h〃鍥惧儚, +99 + 3浣嶆ゼ灞�(绗竴浣�0琛ㄧず姝�,1琛ㄧず璐�)
func GenerateFaceIdContainFloor(srcId, floorStr string) string {
- floorNum, _ := parseFloor(floorStr)
- newId := srcId[0:36] + "5555" + floorNum + snowflake.CreateRandomNumber(5)
+ floorNum, _ := ParseFloor(floorStr)
+ newId := srcId[0:43] + "99" + floorNum
+ //newId := srcId[0:43] + "99" + floorNum + snowflake.CreateRandomNumber(1)
return newId
}
@@ -22,15 +21,15 @@
return "", fmt.Errorf("invalid id %s", srcId)
}
- if srcId[36:40] != "5555" {
- return "", fmt.Errorf("invalid flag %s", srcId[36:40])
+ if srcId[43:45] != "99" {
+ return "", fmt.Errorf("invalid flag %s", srcId[43:45])
}
- return restoreFloor(srcId[40:43])
+ return RestoreFloor(srcId[45:48])
}
-// parseFloor parses the floor string and returns a three-character string
-func parseFloor(floor string) (string, error) {
+// ParseFloor parses the floor string and returns a three-character string
+func ParseFloor(floor string) (string, error) {
var sign string
var number string
@@ -54,8 +53,8 @@
return sign + formattedNumber, nil
}
-// restoreFloor restores the three-character string back to the original floor string
-func restoreFloor(encoded string) (string, error) {
+// RestoreFloor restores the three-character string back to the original floor string
+func RestoreFloor(encoded string) (string, error) {
if len(encoded) != 3 {
return "", fmt.Errorf("encoded string must be 3 characters long")
}
--
Gitblit v1.8.0