3
This commit is contained in:
@@ -992,6 +992,14 @@ local function deductICCardBalance(dev, amount)
|
|||||||
return false, tostring(detail or "deduct_failed")
|
return false, tostring(detail or "deduct_failed")
|
||||||
end
|
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 function syncICCardState(cardId, payload)
|
||||||
local id = trim(cardId)
|
local id = trim(cardId)
|
||||||
if #id == 0 then return false, "missing_card_id" end
|
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, {
|
local okSync, syncResp = syncICCardState(cardId, {
|
||||||
type = "check",
|
type = "check",
|
||||||
action = usedAction,
|
action = usedAction,
|
||||||
device = "gate",
|
device = currentDeviceId(),
|
||||||
ts = syncTs,
|
ts = syncTs,
|
||||||
station_code = exitStation,
|
station_code = exitStation,
|
||||||
entry_station = entryStation,
|
entry_station = entryStation,
|
||||||
@@ -1189,7 +1197,7 @@ local function handleScan(scan, side, scanDev)
|
|||||||
action = act,
|
action = act,
|
||||||
station_codes = stationCodesPayload,
|
station_codes = stationCodesPayload,
|
||||||
station_code = stationCodeForSide(side),
|
station_code = stationCodeForSide(side),
|
||||||
device = "gate",
|
device = currentDeviceId(),
|
||||||
ts = os.epoch("utc"),
|
ts = os.epoch("utc"),
|
||||||
trips_total = hintTripsTotal,
|
trips_total = hintTripsTotal,
|
||||||
trips_remaining = hintTripsRemaining,
|
trips_remaining = hintTripsRemaining,
|
||||||
|
|||||||
+9
-1
@@ -115,13 +115,21 @@ local function postJSON(url, payload)
|
|||||||
end
|
end
|
||||||
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 function syncRefillResult(cardInfo, amount, balance)
|
||||||
local cardId = trim(cardInfo and cardInfo.cardId or "")
|
local cardId = trim(cardInfo and cardInfo.cardId or "")
|
||||||
if #cardId == 0 then return false, "missing_card_id" end
|
if #cardId == 0 then return false, "missing_card_id" end
|
||||||
local url = API_BASE .. "/ic-cards/" .. urlEncodeComponent(cardId) .. "/sync"
|
local url = API_BASE .. "/ic-cards/" .. urlEncodeComponent(cardId) .. "/sync"
|
||||||
return postJSON(url, {
|
return postJSON(url, {
|
||||||
type = "topup",
|
type = "topup",
|
||||||
device = "refill_machine",
|
device = currentDeviceId(),
|
||||||
amount = tonumber(amount) or 0,
|
amount = tonumber(amount) or 0,
|
||||||
balance = tonumber(balance) or 0,
|
balance = tonumber(balance) or 0,
|
||||||
result = "pass",
|
result = "pass",
|
||||||
|
|||||||
+5
-1
@@ -237,7 +237,11 @@ local function firstNumber(...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function currentDeviceId()
|
local function currentDeviceId()
|
||||||
return 'ticket_machine'
|
local label = os.getComputerLabel()
|
||||||
|
if label and label ~= "" then
|
||||||
|
return label
|
||||||
|
end
|
||||||
|
return "#" .. tostring(os.getComputerID())
|
||||||
end
|
end
|
||||||
|
|
||||||
local function normalizeTrainTypeLabel(v)
|
local function normalizeTrainTypeLabel(v)
|
||||||
|
|||||||
@@ -198,7 +198,9 @@
|
|||||||
deviceId = '闸机';
|
deviceId = '闸机';
|
||||||
} else if (dStr === 'refill_machine') {
|
} else if (dStr === 'refill_machine') {
|
||||||
deviceId = '充值机';
|
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') {
|
if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') {
|
||||||
deviceId = '闸机';
|
deviceId = '闸机';
|
||||||
} else if (type === 'topup' || type === 'refill' || action === 'topup' || type === '充值') {
|
} else if (type === 'topup' || type === 'refill' || action === 'topup' || type === '充值') {
|
||||||
|
|||||||
@@ -97,7 +97,9 @@
|
|||||||
deviceId = '闸机';
|
deviceId = '闸机';
|
||||||
} else if (dStr === 'refill_machine') {
|
} else if (dStr === 'refill_machine') {
|
||||||
deviceId = '充值机';
|
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') {
|
if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') {
|
||||||
deviceId = '闸机';
|
deviceId = '闸机';
|
||||||
} else if (type === 'topup' || type === 'refill' || action === 'topup' || type === '充值') {
|
} else if (type === 'topup' || type === 'refill' || action === 'topup' || type === '充值') {
|
||||||
|
|||||||
+6
-2
@@ -355,7 +355,9 @@ createApp({
|
|||||||
deviceId = '闸机';
|
deviceId = '闸机';
|
||||||
} else if (dStr === 'refill_machine') {
|
} else if (dStr === 'refill_machine') {
|
||||||
deviceId = '充值机';
|
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') {
|
if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') {
|
||||||
deviceId = '闸机';
|
deviceId = '闸机';
|
||||||
} else {
|
} else {
|
||||||
@@ -471,7 +473,9 @@ createApp({
|
|||||||
deviceId = '闸机';
|
deviceId = '闸机';
|
||||||
} else if (dStr === 'refill_machine') {
|
} else if (dStr === 'refill_machine') {
|
||||||
deviceId = '充值机';
|
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') {
|
if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') {
|
||||||
deviceId = '闸机';
|
deviceId = '闸机';
|
||||||
} else if (type === 'topup' || type === 'refill' || action === 'topup' || type === '充值') {
|
} else if (type === 'topup' || type === 'refill' || action === 'topup' || type === '充值') {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh-CN">
|
<html lang="zh-CN">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
@@ -327,7 +327,9 @@
|
|||||||
deviceId = '闸机';
|
deviceId = '闸机';
|
||||||
} else if (dStr === 'refill_machine') {
|
} else if (dStr === 'refill_machine') {
|
||||||
deviceId = '充值机';
|
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') {
|
if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') {
|
||||||
deviceId = '闸机';
|
deviceId = '闸机';
|
||||||
} else if (type === 'topup' || type === 'refill' || action === 'topup' || type === '充值') {
|
} else if (type === 'topup' || type === 'refill' || action === 'topup' || type === '充值') {
|
||||||
|
|||||||
+3
-1
@@ -235,7 +235,9 @@ createApp({
|
|||||||
deviceId = '闸机';
|
deviceId = '闸机';
|
||||||
} else if (dStr === 'refill_machine') {
|
} else if (dStr === 'refill_machine') {
|
||||||
deviceId = '充值机';
|
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') {
|
if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') {
|
||||||
deviceId = '闸机';
|
deviceId = '闸机';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -117,7 +117,9 @@
|
|||||||
deviceId = '闸机';
|
deviceId = '闸机';
|
||||||
} else if (dStr === 'refill_machine') {
|
} else if (dStr === 'refill_machine') {
|
||||||
deviceId = '充值机';
|
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') {
|
if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') {
|
||||||
deviceId = '闸机';
|
deviceId = '闸机';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user