feat(ticketmachine, gate): 新增单程票购票功能并优化自动更新逻辑

- 新增完整的单程票购票流程,包含线路票价数据构建、选择页面与订单适配逻辑
- 将版本检查间隔从60秒调整为5秒,新增版本不匹配时自动运行对应更新脚本并重启的逻辑
- 修正列车类型标签格式,将'single'统一为'Single'
- 优化主页按钮布局,新增单程票购票入口
- 完善终端显示与订单成本计算逻辑,适配单程票场景
- 调整gate.lua的终端标题文字显示位置
This commit is contained in:
2026-07-10 08:16:54 +08:00
parent 52ac98bead
commit c80ebba3ec
2 changed files with 169 additions and 22 deletions
+17 -2
View File
@@ -2,7 +2,7 @@ local DEFAULT_SERVER_BASE = "http://ticket.fse-media.group"
local DEFAULT_SERVER_PATH = "/api/tickets/check"
local GATE_OPEN_SECONDS = 2
local VERSION = "v1.5.8"
local VERSION_CHECK_INTERVAL = 60
local VERSION_CHECK_INTERVAL = 5
local CONFIG_PATH = "gate_config.json"
@@ -158,7 +158,7 @@ end
local function draw(statusLine1, statusLine2, statusColor)
clear()
local w, h = termDev.getSize()
centerText(1, "GATE", colors.cyan)
centerText(2, "GATE", colors.cyan)
drawVersionIndicator(w)
drawServerStatusIndicator(w)
if statusLine1 and #statusLine1 > 0 then
@@ -1352,6 +1352,21 @@ while true do
pcall(function()
refreshRemoteLuaVersion(guessBaseFromStatusURL(serverURL))
end)
if versionMismatch == true then
pcall(function()
clear()
local w, h = termDev.getSize()
centerText(math.floor(h / 2), "Auto Updating...", colors.yellow)
end)
pcall(function()
if shell and type(shell.run) == "function" then
shell.run("update_gate.lua")
else
os.run(getfenv and getfenv() or _ENV, "update_gate.lua")
end
end)
os.reboot()
end
drawReadyScreen()
versionTimer = os.startTimer(VERSION_CHECK_INTERVAL)
end