功能(设备ID调试): 添加调试埋点与文档以定位设备ID缺失问题

创建调试环境配置文件与调试会话记录文档,在前端页面、票据面板以及后端公共接口的设备ID解析各阶段添加调试埋点,收集原始设备数据与处理后的结果,用于验证相关假设以定位设备ID不显示的根因。
This commit is contained in:
2026-07-10 21:07:37 +08:00
parent 4daa0b6185
commit 5f184bf184
5 changed files with 210 additions and 2 deletions
+43
View File
@@ -350,6 +350,29 @@ createApp({
const action = getTicketEventAction(ev);
let deviceId = String(ev?.device || ev?.device_id || ev?.detail?.device || ev?.detail?.device_id || ev?.["设备编号"] || ev?.["机器ID"] || '---').trim();
const dStr = deviceId.toLowerCase();
// #region debug-point B:index-ticket-device-before-map
fetch('http://127.0.0.1:7777/event', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
sessionId: 'device-id-missing',
runId: 'pre-fix',
hypothesisId: 'B',
location: 'web/index.js:351',
msg: '[DEBUG] admin ticket formatter raw device',
data: {
type,
action,
raw_device: ev?.device ?? null,
raw_device_id: ev?.device_id ?? null,
raw_detail_device: ev?.detail?.device ?? null,
resolved_before_map: deviceId
},
ts: Date.now()
})
}).catch(() => {});
// #endregion
if (dStr === 'gate') {
deviceId = '闸机';
@@ -364,6 +387,26 @@ createApp({
deviceId = '售票机';
}
}
// #region debug-point B:index-ticket-device-after-map
fetch('http://127.0.0.1:7777/event', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
sessionId: 'device-id-missing',
runId: 'pre-fix',
hypothesisId: 'B',
location: 'web/index.js:373',
msg: '[DEBUG] admin ticket formatter mapped device',
data: {
type,
action,
mapped_device: deviceId
},
ts: Date.now()
})
}).catch(() => {});
// #endregion
const timeStr = formatTime(ev?.ts || ev?.["时间戳"]);
if (type === 'sale' || type === '售票') {
+43
View File
@@ -322,6 +322,29 @@
const stationEn = event.station_en || event['站点英文'] || '';
let deviceId = String(event.device || event.device_id || event.detail?.device || event.detail?.device_id || event['设备编号'] || event['机器ID'] || '').trim();
const dStr = deviceId.toLowerCase();
// #region debug-point B:ticket-board-device-before-map
fetch('http://127.0.0.1:7777/event', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
sessionId: 'device-id-missing',
runId: 'pre-fix',
hypothesisId: 'B',
location: 'web/ticket-board.html:323',
msg: '[DEBUG] public ticket formatter raw device',
data: {
type,
action,
raw_device: event.device ?? null,
raw_device_id: event.device_id ?? null,
raw_detail_device: event.detail?.device ?? null,
resolved_before_map: deviceId
},
ts: Date.now()
})
}).catch(() => {});
// #endregion
if (dStr === 'gate') {
deviceId = '闸机';
@@ -338,6 +361,26 @@
deviceId = '售票机';
}
}
// #region debug-point B:ticket-board-device-after-map
fetch('http://127.0.0.1:7777/event', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
sessionId: 'device-id-missing',
runId: 'pre-fix',
hypothesisId: 'B',
location: 'web/ticket-board.html:345',
msg: '[DEBUG] public ticket formatter mapped device',
data: {
type,
action,
mapped_device: deviceId
},
ts: Date.now()
})
}).catch(() => {});
// #endregion
if (stationEn && deviceId) return `${stationEn} (${deviceId})`;
if (deviceId) return `设备:${deviceId}`;