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 | 24 ++++++++++++++++++------ 1 files changed, 18 insertions(+), 6 deletions(-) diff --git a/nvcs/nvcs.go b/nvcs/nvcs.go index 2f7ccf6..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,20 +44,32 @@ } } -func CurrentRunState() (string, int) { - runState := cache.data.Back().Value - if runState == nil { - return "", 0 +func CurrentRunState() (runState ElevatorRunData) { + node := cache.data.Back() + if node == nil { + return } - return runState.(elevatorRunData).Floor, runState.(elevatorRunData).RunState + 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.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