fix(web, ticketmachine): 修复web设备ID匹配,清理无用代码并优化界面显示
调整web端设备ID匹配正则,支持带#前缀的数字ID 移除ticketmachine.lua中未使用的变量和工具函数 替换界面成本显示文本,将$改为cogs:
This commit is contained in:
+1
-22
@@ -12,8 +12,6 @@ local function jsonDecode(str)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local serverConnected = nil
|
local serverConnected = nil
|
||||||
local serverLastChangeTs = 0
|
|
||||||
local expectedMachineVersion = nil
|
|
||||||
local versionMismatch = nil
|
local versionMismatch = nil
|
||||||
|
|
||||||
local function normalizeVersionTag(v)
|
local function normalizeVersionTag(v)
|
||||||
@@ -1227,7 +1225,7 @@ local function showSingleSegmentSelection()
|
|||||||
local x = colIdx == 0 and bx1 or bx2
|
local x = colIdx == 0 and bx1 or bx2
|
||||||
local y = by + rowIdx * 4
|
local y = by + rowIdx * 4
|
||||||
|
|
||||||
local label = seg.lineName .. ' $' .. tostring(seg.cost)
|
local label = seg.lineName .. ' cogs:' .. tostring(seg.cost)
|
||||||
if #label > bw then label = label:sub(1, bw) end
|
if #label > bw then label = label:sub(1, bw) end
|
||||||
local isSelected = (state.singleSegment == seg)
|
local isSelected = (state.singleSegment == seg)
|
||||||
addButton(x, y, label, bw, 3, {isSelected and colors.green or colors.blue, colors.white}, function()
|
addButton(x, y, label, bw, 3, {isSelected and colors.green or colors.blue, colors.white}, function()
|
||||||
@@ -2159,25 +2157,6 @@ local function generateTicketId()
|
|||||||
return generateNumericCode('TK', 8)
|
return generateNumericCode('TK', 8)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function ensureTicketIdFormat(id)
|
|
||||||
if id == nil then return '' end
|
|
||||||
local s = tostring(id)
|
|
||||||
s = s:gsub('%s+', '')
|
|
||||||
if #s == 0 then return '' end
|
|
||||||
local prefix, num = s:match('^([A-Za-z][A-Za-z])%-?([0-9]+)$')
|
|
||||||
if prefix and num then
|
|
||||||
prefix = prefix:upper()
|
|
||||||
if #num < 8 then
|
|
||||||
num = string.rep('0', 8 - #num) .. num
|
|
||||||
elseif #num > 8 then
|
|
||||||
num = num:sub(-8)
|
|
||||||
end
|
|
||||||
return prefix .. '-' .. num
|
|
||||||
end
|
|
||||||
return s:lower()
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local function showDone()
|
local function showDone()
|
||||||
if state.productMode == 'card' then
|
if state.productMode == 'card' then
|
||||||
|
|||||||
@@ -198,7 +198,7 @@
|
|||||||
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') {
|
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown') {
|
||||||
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,7 @@
|
|||||||
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') {
|
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown') {
|
||||||
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 === '充值') {
|
||||||
|
|||||||
+2
-2
@@ -355,7 +355,7 @@ 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') {
|
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown') {
|
||||||
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 +471,7 @@ 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') {
|
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown') {
|
||||||
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 === '充值') {
|
||||||
|
|||||||
@@ -327,7 +327,7 @@
|
|||||||
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') {
|
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown') {
|
||||||
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
-1
@@ -235,7 +235,7 @@ 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') {
|
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown') {
|
||||||
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,7 @@
|
|||||||
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') {
|
} else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown') {
|
||||||
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