chore(backend,frontend): 移除设备位置管理全链路功能与相关代码
- 删除后端所有机器位置相关的API接口、缓存逻辑与后台同步任务 - 移除前端的机器位置导航入口、地图页面与管理代码 - 将原机器地图页面重构为车票查询页面 - 调整Lua程序的默认版本号 - 删除无用的.gitignore文件 - 优化前端页面的代码格式与导航结构
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
local DEFAULT_SERVER_BASE = "http://ticket.fse-media.group"
|
||||
local DEFAULT_SERVER_PATH = "/api/tickets/check"
|
||||
local GATE_OPEN_SECONDS = 2
|
||||
local VERSION = "v1.5.18"
|
||||
local VERSION = "v1.5.15"
|
||||
local VERSION_CHECK_INTERVAL = 5
|
||||
|
||||
local CONFIG_PATH = "gate_config.json"
|
||||
@@ -192,7 +192,6 @@ local function checkAndApplyUpdate()
|
||||
print("OTA Update Error: " .. tostring(res))
|
||||
term.setTextColor(colors.white)
|
||||
end
|
||||
sleep(3)
|
||||
end
|
||||
else
|
||||
lastUpdateError = "loadfile failed: " .. tostring(err)
|
||||
@@ -201,7 +200,6 @@ local function checkAndApplyUpdate()
|
||||
print("OTA Update Error: " .. tostring(err))
|
||||
term.setTextColor(colors.white)
|
||||
end
|
||||
sleep(3)
|
||||
end
|
||||
|
||||
isUpdating = false
|
||||
@@ -1500,49 +1498,21 @@ local function processInspectionEvent(eventName, ev)
|
||||
end
|
||||
end
|
||||
|
||||
local function mainLoop()
|
||||
while true do
|
||||
local ev = pack(os.pullEvent())
|
||||
if ev[1] == "ticket_scanned" or ev[1] == "ic_card_scanned" then
|
||||
processInspectionEvent(ev[1], ev)
|
||||
os.sleep(0.35)
|
||||
drawReadyScreen()
|
||||
end
|
||||
end
|
||||
end
|
||||
local versionTimer = os.startTimer(VERSION_CHECK_INTERVAL)
|
||||
|
||||
local function backgroundSyncTask()
|
||||
while true do
|
||||
sleep(VERSION_CHECK_INTERVAL)
|
||||
|
||||
|
||||
while true do
|
||||
local ev = pack(os.pullEvent())
|
||||
if ev[1] == "ticket_scanned" or ev[1] == "ic_card_scanned" then
|
||||
processInspectionEvent(ev[1], ev)
|
||||
os.sleep(0.35)
|
||||
drawReadyScreen()
|
||||
elseif ev[1] == "timer" and ev[2] == versionTimer then
|
||||
pcall(function()
|
||||
refreshRemoteLuaVersion(guessBaseFromStatusURL(serverURL))
|
||||
end)
|
||||
pcall(checkAndApplyUpdate)
|
||||
versionTimer = os.startTimer(VERSION_CHECK_INTERVAL)
|
||||
end
|
||||
end
|
||||
|
||||
local function backgroundLocationSyncTask()
|
||||
sleep(5)
|
||||
local x, y, z
|
||||
if gps and type(gps.locate) == "function" then
|
||||
x, y, z = gps.locate(2)
|
||||
end
|
||||
local label = os.getComputerLabel()
|
||||
if not label or label == "" then label = "#" .. tostring(os.getComputerID()) end
|
||||
local payload = {
|
||||
device_id = label,
|
||||
type = "Gate",
|
||||
gate_mode = modeBySide and "bidirectional" or mode,
|
||||
station_code = stationCodeForSide(nil) or "",
|
||||
x = x,
|
||||
y = y,
|
||||
z = z
|
||||
}
|
||||
local serverBase = guessBaseFromStatusURL(serverURL)
|
||||
pcall(postCheck, serverBase .. '/api/machine-location', payload)
|
||||
while true do
|
||||
sleep(86400)
|
||||
end
|
||||
end
|
||||
|
||||
parallel.waitForAny(mainLoop, backgroundSyncTask, backgroundLocationSyncTask)
|
||||
|
||||
Reference in New Issue
Block a user