feat: 新增设备位置追踪与网页管理页面

- 更新服务端默认Lua版本与客户端程序版本至 v1.5.16
- 新增后端API接口用于提交和查询设备位置数据
- 为售票机和检票机添加后台GPS位置同步任务,定期上报设备坐标
- 服务端新增设备位置缓存,并自动清理超过5分钟未更新的过期数据
- 新增网页端设备位置地图页面,支持实时展示、点击查看详情与每分钟自动刷新
This commit is contained in:
2026-07-11 14:58:30 +08:00
parent 2eddb8b84c
commit efc061e471
6 changed files with 211 additions and 19 deletions
+22 -3
View File
@@ -1,6 +1,6 @@
local CURRENT_STATION_CODE = 'Ticket-Machine'
local API_BASE = 'http://ticket.fse-media.group/api'
local VERSION = 'v1.5.15'
local VERSION = 'v1.5.16'
local UPDATE_CHECK_INTERVAL = 5
-- ###########################
@@ -775,7 +775,26 @@ local function backgroundTicketUploadTask()
end
end
local function backgroundLocationSyncTask()
while true do
if gps and type(gps.locate) == "function" then
local x, y, z = gps.locate(2)
if x and y and z then
local payload = {
device_id = currentDeviceId(),
type = "TicketMachine",
station = (CFG.current_station and (CFG.current_station.en_name or CFG.current_station.name)) or state.stationName,
station_code = state.stationCode or CURRENT_STATION_CODE,
x = x,
y = y,
z = z
}
postJSONResult(API_BASE .. '/machine-location', payload)
end
end
sleep(60)
end
end
-- ###########################
-- Data logic & Config
@@ -2528,4 +2547,4 @@ local function mainPageLoop()
end
end
parallel.waitForAny(mainPageLoop, backgroundSyncTask, backgroundTicketUploadTask, backgroundPeripheralTask)
parallel.waitForAny(mainPageLoop, backgroundSyncTask, backgroundTicketUploadTask, backgroundPeripheralTask, backgroundLocationSyncTask)