From 4ca3791590a7bf50222aa5f80e53edf04739108a Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期二, 22 十月 2024 17:20:23 +0800
Subject: [PATCH] fix 1400 post floor farmat

---
 nvcs/nvcs.go |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/nvcs/nvcs.go b/nvcs/nvcs.go
index bf6ccd8..17e55aa 100644
--- a/nvcs/nvcs.go
+++ b/nvcs/nvcs.go
@@ -13,7 +13,7 @@
 )
 
 // 鏁版嵁缁撴瀯
-type elevatorRunData struct {
+type ElevatorRunData struct {
 	Device    string
 	Timestamp int64
 	Floor     string
@@ -44,11 +44,32 @@
 	}
 }
 
+func CurrentRunState() (runState ElevatorRunData) {
+	node := cache.data.Back()
+	if node == nil {
+		return
+	}
+
+	return node.Value.(ElevatorRunData)
+}
+
+func FindPositionByTime(timestamp int64) ElevatorRunData {
+	return cache.getPositionByTime(timestamp)
+}
+
+func FindMovePosition(timestamp int64, floor string) ElevatorRunData {
+	return cache.getMovePosition(timestamp, floor)
+}
+
 func listenQueue() {
 	for {
-		data := queue.dequeue()
+		data := queue.get()
+
+		//t := time.Now()
 		cache.store(data)
 
+		//logger.Debug("process queue data %+v, use time %v", data, time.Since(t))
+
 		// 娓呯悊杩囨湡鏁版嵁
 		cache.cleanExpired()
 	}

--
Gitblit v1.8.0