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,
|
||||
|
||||
+9
-1
@@ -115,13 +115,21 @@ local function postJSON(url, payload)
|
||||
end
|
||||
end
|
||||
|
||||
local function currentDeviceId()
|
||||
local label = os.getComputerLabel()
|
||||
if label and label ~= "" then
|
||||
return label
|
||||
end
|
||||
return "充值机#" .. tostring(os.getComputerID())
|
||||
end
|
||||
|
||||
local function syncRefillResult(cardInfo, amount, balance)
|
||||
local cardId = trim(cardInfo and cardInfo.cardId or "")
|
||||
if #cardId == 0 then return false, "missing_card_id" end
|
||||
local url = API_BASE .. "/ic-cards/" .. urlEncodeComponent(cardId) .. "/sync"
|
||||
return postJSON(url, {
|
||||
type = "topup",
|
||||
device = "refill_machine",
|
||||
device = currentDeviceId(),
|
||||
amount = tonumber(amount) or 0,
|
||||
balance = tonumber(balance) or 0,
|
||||
result = "pass",
|
||||
|
||||
+5
-1
@@ -237,7 +237,11 @@ local function firstNumber(...)
|
||||
end
|
||||
|
||||
local function currentDeviceId()
|
||||
return 'ticket_machine'
|
||||
local label = os.getComputerLabel()
|
||||
if label and label ~= "" then
|
||||
return label
|
||||
end
|
||||
return "#" .. tostring(os.getComputerID())
|
||||
end
|
||||
|
||||
local function normalizeTrainTypeLabel(v)
|
||||
|
||||
@@ -198,7 +198,9 @@
|
||||
deviceId = '闸机';
|
||||
} else if (dStr === 'refill_machine') {
|
||||
deviceId = '充值机';
|
||||
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown' || dStr === '---' || dStr === '') {
|
||||
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine') {
|
||||
deviceId = '售票机';
|
||||
} else if (dStr === 'unknown' || dStr === '---' || dStr === '') {
|
||||
if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') {
|
||||
deviceId = '闸机';
|
||||
} else if (type === 'topup' || type === 'refill' || action === 'topup' || type === '充值') {
|
||||
|
||||
@@ -97,7 +97,9 @@
|
||||
deviceId = '闸机';
|
||||
} else if (dStr === 'refill_machine') {
|
||||
deviceId = '充值机';
|
||||
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown' || dStr === '---' || dStr === '') {
|
||||
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine') {
|
||||
deviceId = '售票机';
|
||||
} else if (dStr === 'unknown' || dStr === '---' || dStr === '') {
|
||||
if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') {
|
||||
deviceId = '闸机';
|
||||
} else if (type === 'topup' || type === 'refill' || action === 'topup' || type === '充值') {
|
||||
|
||||
+6
-2
@@ -355,7 +355,9 @@ createApp({
|
||||
deviceId = '闸机';
|
||||
} else if (dStr === 'refill_machine') {
|
||||
deviceId = '充值机';
|
||||
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown' || dStr === '---' || dStr === '') {
|
||||
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine') {
|
||||
deviceId = '售票机';
|
||||
} else if (dStr === 'unknown' || dStr === '---' || dStr === '') {
|
||||
if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') {
|
||||
deviceId = '闸机';
|
||||
} else {
|
||||
@@ -471,7 +473,9 @@ createApp({
|
||||
deviceId = '闸机';
|
||||
} else if (dStr === 'refill_machine') {
|
||||
deviceId = '充值机';
|
||||
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown' || dStr === '---' || dStr === '') {
|
||||
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine') {
|
||||
deviceId = '售票机';
|
||||
} else if (dStr === 'unknown' || dStr === '---' || dStr === '') {
|
||||
if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') {
|
||||
deviceId = '闸机';
|
||||
} else if (type === 'topup' || type === 'refill' || action === 'topup' || type === '充值') {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
|
||||
<head>
|
||||
@@ -327,7 +327,9 @@
|
||||
deviceId = '闸机';
|
||||
} else if (dStr === 'refill_machine') {
|
||||
deviceId = '充值机';
|
||||
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown' || dStr === '---' || dStr === '') {
|
||||
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine') {
|
||||
deviceId = '售票机';
|
||||
} else if (dStr === 'unknown' || dStr === '---' || dStr === '') {
|
||||
if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') {
|
||||
deviceId = '闸机';
|
||||
} else if (type === 'topup' || type === 'refill' || action === 'topup' || type === '充值') {
|
||||
|
||||
+3
-1
@@ -235,7 +235,9 @@ createApp({
|
||||
deviceId = '闸机';
|
||||
} else if (dStr === 'refill_machine') {
|
||||
deviceId = '充值机';
|
||||
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown' || dStr === '---' || dStr === '') {
|
||||
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine') {
|
||||
deviceId = '售票机';
|
||||
} else if (dStr === 'unknown' || dStr === '---' || dStr === '') {
|
||||
if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') {
|
||||
deviceId = '闸机';
|
||||
} else {
|
||||
|
||||
@@ -117,7 +117,9 @@
|
||||
deviceId = '闸机';
|
||||
} else if (dStr === 'refill_machine') {
|
||||
deviceId = '充值机';
|
||||
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown' || dStr === '---' || dStr === '') {
|
||||
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine') {
|
||||
deviceId = '售票机';
|
||||
} else if (dStr === 'unknown' || dStr === '---' || dStr === '') {
|
||||
if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') {
|
||||
deviceId = '闸机';
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user