This commit is contained in:
2026-07-10 14:55:42 +08:00
parent f65e043130
commit 230418079c
9 changed files with 46 additions and 12 deletions
+10 -2
View File
@@ -992,6 +992,14 @@ local function deductICCardBalance(dev, amount)
return false, tostring(detail or "deduct_failed")
end
local function currentDeviceId()
local label = os.getComputerLabel()
if label and label ~= "" then
return label
end
return "闸机#" .. tostring(os.getComputerID())
end
local function syncICCardState(cardId, payload)
local id = trim(cardId)
if #id == 0 then return false, "missing_card_id" end
@@ -1131,7 +1139,7 @@ local function handleICCardScan(scan, side, scanDev)
local okSync, syncResp = syncICCardState(cardId, {
type = "check",
action = usedAction,
device = "gate",
device = currentDeviceId(),
ts = syncTs,
station_code = exitStation,
entry_station = entryStation,
@@ -1189,7 +1197,7 @@ local function handleScan(scan, side, scanDev)
action = act,
station_codes = stationCodesPayload,
station_code = stationCodeForSide(side),
device = "gate",
device = currentDeviceId(),
ts = os.epoch("utc"),
trips_total = hintTripsTotal,
trips_remaining = hintTripsRemaining,