3
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user