feat: 新增设备位置追踪与网页管理页面
- 更新服务端默认Lua版本与客户端程序版本至 v1.5.16 - 新增后端API接口用于提交和查询设备位置数据 - 为售票机和检票机添加后台GPS位置同步任务,定期上报设备坐标 - 服务端新增设备位置缓存,并自动清理超过5分钟未更新的过期数据 - 新增网页端设备位置地图页面,支持实时展示、点击查看详情与每分钟自动刷新
This commit is contained in:
+12
-3
@@ -22,8 +22,8 @@ const pool = mysql.createPool({
|
||||
});
|
||||
|
||||
const DEFAULT_LUA_VERSIONS = {
|
||||
ticketmachine: 'v1.5.8',
|
||||
gate: 'v1.5.8'
|
||||
ticketmachine: 'v1.5.16',
|
||||
gate: 'v1.5.16'
|
||||
};
|
||||
|
||||
function normalizeLuaVersions(input) {
|
||||
@@ -64,7 +64,8 @@ const cache = {
|
||||
icCardIndex: {},
|
||||
icCardEvents: [],
|
||||
statsTicket: [],
|
||||
statsGate: []
|
||||
statsGate: [],
|
||||
machineLocations: {}
|
||||
};
|
||||
|
||||
const DataService = {
|
||||
@@ -522,6 +523,14 @@ const DataService = {
|
||||
}),
|
||||
saveExport: () => {
|
||||
try { fs.writeFileSync(paths.export, JSON.stringify(DataService.buildExportPayload(), null, 2)); } catch(e){}
|
||||
},
|
||||
|
||||
getMachineLocations: () => cache.machineLocations,
|
||||
updateMachineLocation: (deviceId, data) => {
|
||||
cache.machineLocations[deviceId] = {
|
||||
...data,
|
||||
last_update_ts: Date.now()
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user