fix(web, ticketmachine): 修复web设备ID匹配,清理无用代码并优化界面显示

调整web端设备ID匹配正则,支持带#前缀的数字ID
移除ticketmachine.lua中未使用的变量和工具函数
替换界面成本显示文本,将$改为cogs:
This commit is contained in:
2026-07-10 13:25:54 +08:00
parent 2e113232d9
commit 8435717a58
7 changed files with 8 additions and 29 deletions
+1 -22
View File
@@ -12,8 +12,6 @@ local function jsonDecode(str)
end
local serverConnected = nil
local serverLastChangeTs = 0
local expectedMachineVersion = nil
local versionMismatch = nil
local function normalizeVersionTag(v)
@@ -1227,7 +1225,7 @@ local function showSingleSegmentSelection()
local x = colIdx == 0 and bx1 or bx2
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
local isSelected = (state.singleSegment == seg)
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)
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()
if state.productMode == 'card' then