# Debug Session: device-id-missing - **Status**: [OPEN] - **Issue**: 数据记录中的设备 ID 当前全部未显示,界面只看到“机器ID:”后没有具体值。 - **Debug Server**: http://127.0.0.1:7777/event - **Log File**: .dbg/trae-debug-log-device-id-missing.ndjson ## Reproduction Steps 1. 使用售票机完成一次售票。 2. 使用闸机完成一次进站或出站。 3. 打开后台或票据时间线页面查看“机器ID”字段。 4. 观察“机器ID:”后方是否为空。 ## Hypotheses & Verification | ID | Hypothesis | Likelihood | Effort | Evidence | |----|------------|------------|--------|----------| | A | 后端接口返回的事件对象里根本没有 `device` / `detail.device` 字段 | High | Low | Rejected | | B | 前端格式化函数读到了值,但后续字符串拼接或编码问题把值丢掉了 | High | Low | Rejected | | C | 售票与检票两类事件的数据结构不同,当前前端只兼容了其中一类 | Med | Low | Confirmed | | D | 设备端 Lua 确实上报了 ID,但服务端在写库或对外返回时被覆盖成空串 | Med | Med | Rejected | | E | 页面实际运行的不是当前工作区这份前端代码,导致本地修改未生效 | Med | Med | Pending | ## Log Evidence - 2026-07-10: 已启动 Debug Server `http://127.0.0.1:7777/event` - 2026-07-10: 已在 `[public.js]` 的票据时间线组装处添加 A/C 埋点 - 2026-07-10: 已在 `[index.js]` 与 `[ticket-board.html]` 的设备 ID 格式化处添加 B 埋点 - 2026-07-10: 本地运行时复现结果:`saleRawDevice="#0"` 但 `saleMappedDevice=null`;同时 `checkRawDevice="#1"` 且 `checkMappedDevice="#1"`,证明 `sale` 映射阶段丢失了 `device` ## Verification Conclusion - 已实施最小修复:在公开票据详情的 `sale` 事件映射中保留 `device`