From de187db6461763f8f5bbf1da8c802fcccb68b104 Mon Sep 17 00:00:00 2001 From: HenryDu8133 <813367384@qq.com> Date: Sat, 11 Jul 2026 15:58:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8D=B3=E4=BD=BF=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E8=8E=B7=E5=8F=96GPS=E4=BF=A1=E5=8F=B7=E4=B9=9F=E4=B8=8A?= =?UTF-8?q?=E6=8A=A5=E6=9C=BA=E5=99=A8=E5=9C=A8=E7=BA=BF=E7=8A=B6=E6=80=81?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E5=8D=87=E7=BA=A7=E7=89=88=E6=9C=AC=E8=87=B3?= =?UTF-8?q?v1.5.18?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gate.lua | 35 ++++++++++++++++++----------------- server/services/data.js | 4 ++-- ticketmachine.lua | 29 +++++++++++++++-------------- 3 files changed, 35 insertions(+), 33 deletions(-) diff --git a/gate.lua b/gate.lua index 2032595..bbee6ea 100644 --- a/gate.lua +++ b/gate.lua @@ -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.17" +local VERSION = "v1.5.18" local VERSION_CHECK_INTERVAL = 5 local CONFIG_PATH = "gate_config.json" @@ -192,6 +192,7 @@ local function checkAndApplyUpdate() print("OTA Update Error: " .. tostring(res)) term.setTextColor(colors.white) end + sleep(3) end else lastUpdateError = "loadfile failed: " .. tostring(err) @@ -200,6 +201,7 @@ local function checkAndApplyUpdate() print("OTA Update Error: " .. tostring(err)) term.setTextColor(colors.white) end + sleep(3) end isUpdating = false @@ -1521,24 +1523,23 @@ end local function backgroundLocationSyncTask() sleep(5) + local x, y, z if gps and type(gps.locate) == "function" then - local x, y, z = gps.locate(2) - if x and y and z then - 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) - end + 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 diff --git a/server/services/data.js b/server/services/data.js index a405ba3..3b3dbf8 100644 --- a/server/services/data.js +++ b/server/services/data.js @@ -22,8 +22,8 @@ const pool = mysql.createPool({ }); const DEFAULT_LUA_VERSIONS = { - ticketmachine: 'v1.5.16', - gate: 'v1.5.16' + ticketmachine: 'v1.5.18', + gate: 'v1.5.18' }; function normalizeLuaVersions(input) { diff --git a/ticketmachine.lua b/ticketmachine.lua index d90469c..410f57d 100644 --- a/ticketmachine.lua +++ b/ticketmachine.lua @@ -1,6 +1,6 @@ local CURRENT_STATION_CODE = 'Ticket-Machine' local API_BASE = 'http://ticket.fse-media.group/api' -local VERSION = 'v1.5.17' +local VERSION = 'v1.5.18' local UPDATE_CHECK_INTERVAL = 5 -- ########################### @@ -722,6 +722,7 @@ local function checkAndApplyUpdate() print("OTA Update Error: " .. tostring(res)) term.setTextColor(colors.white) end + sleep(3) end else lastUpdateError = "loadfile failed: " .. tostring(err) @@ -730,6 +731,7 @@ local function checkAndApplyUpdate() print("OTA Update Error: " .. tostring(err)) term.setTextColor(colors.white) end + sleep(3) end isUpdating = false @@ -777,21 +779,20 @@ end local function backgroundLocationSyncTask() sleep(5) + local x, y, z if gps and type(gps.locate) == "function" then - local x, y, z = gps.locate(2) - if x and y and z then - local payload = { - device_id = currentDeviceId(), - type = "TicketMachine", - station = (CFG.current_station and (CFG.current_station.en_name or CFG.current_station.name)) or state.stationName, - station_code = state.stationCode or CURRENT_STATION_CODE, - x = x, - y = y, - z = z - } - postJSONResult(API_BASE .. '/machine-location', payload) - end + x, y, z = gps.locate(2) end + local payload = { + device_id = currentDeviceId(), + type = "TicketMachine", + station = (CFG.current_station and (CFG.current_station.en_name or CFG.current_station.name)) or state.stationName, + station_code = state.stationCode or CURRENT_STATION_CODE, + x = x, + y = y, + z = z + } + postJSONResult(API_BASE .. '/machine-location', payload) while true do sleep(86400) end