fix(gate): support java peripheral markEntered and bypass missing updateICCard

This commit is contained in:
2026-07-17 00:33:35 +08:00
parent 2096dd8d89
commit 1f5bc1d40d
+4 -6
View File
@@ -1,7 +1,7 @@
local DEFAULT_SERVER_BASE = "https://ticket.fse-media.group"
local DEFAULT_SERVER_PATH = "/api/tickets/check"
local GATE_OPEN_SECONDS = 2
local VERSION = "v1.5.24"
local VERSION = "v1.5.25"
local VERSION_CHECK_INTERVAL = 5
local serverURL = nil
@@ -1003,7 +1003,8 @@ local function applyTicketDeviceState(dev, action, rides)
end
local function updateICCardField(dev, key, value)
if type(dev) ~= "table" or type(dev.updateICCard) ~= "function" then return false end
if type(dev) ~= "table" then return false end
if type(dev.updateICCard) ~= "function" then return true end
local okCall, okRes, detail = pcall(dev.updateICCard, key, value)
if not okCall then return false, tostring(okRes) end
if okRes == false then return false, tostring(detail or "update_failed") end
@@ -1255,13 +1256,10 @@ local function handleICCardScan(scan, side, scanDev)
end
for _, dev in ipairs(inspectionDevs) do
applyTicketDeviceState(dev, usedAction)
if usedAction == "entry" then
updateDeviceField(dev, "entered", true)
updateDeviceField(dev, "exited", false)
if #entryStation > 0 then updateDeviceField(dev, "entry_station", entryStation) end
else
updateDeviceField(dev, "exited", true)
updateDeviceField(dev, "entered", false)
if #exitStation > 0 then updateDeviceField(dev, "exit_station", exitStation) end
updateDeviceField(dev, "last_fare", fare)
end