From f65e04313054324f86e1551872a1d173fea2c333 Mon Sep 17 00:00:00 2001 From: HenryDu8133 <813367384@qq.com> Date: Fri, 10 Jul 2026 13:37:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(web):=20=E4=BF=AE=E5=A4=8D=E8=AE=BE?= =?UTF-8?q?=E5=A4=87ID=E8=8E=B7=E5=8F=96=E4=B8=8D=E5=85=A8=E4=B8=8E?= =?UTF-8?q?=E7=A9=BA=E5=80=BC=E5=A4=84=E7=90=86=E4=B8=8D=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 补充从ev.detail中提取设备ID的逻辑,同时新增对空字符串和'---'格式设备ID的统一处理 --- web/ic-card-admin.js | 4 ++-- web/ic-card-search.js | 4 ++-- web/index.js | 8 ++++---- web/ticket-board.html | 4 ++-- web/ticket-route.js | 4 ++-- web/ticket-search.js | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/web/ic-card-admin.js b/web/ic-card-admin.js index f54d7c9..8c64240 100644 --- a/web/ic-card-admin.js +++ b/web/ic-card-admin.js @@ -191,14 +191,14 @@ const formatIcCardEventUnified = (ev) => { const type = String(ev?.type || '').toLowerCase(); const action = String(ev?.action || '').toLowerCase(); - let deviceId = String(ev?.device || ev?.device_id || ev?.["设备编号"] || ev?.["机器ID"] || '---').trim(); + let deviceId = String(ev?.device || ev?.device_id || ev?.detail?.device || ev?.detail?.device_id || ev?.["设备编号"] || ev?.["机器ID"] || '---').trim(); const dStr = deviceId.toLowerCase(); if (dStr === 'gate') { deviceId = '闸机'; } else if (dStr === 'refill_machine') { deviceId = '充值机'; - } else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown') { + } else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown' || dStr === '---' || dStr === '') { if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') { deviceId = '闸机'; } else if (type === 'topup' || type === 'refill' || action === 'topup' || type === '充值') { diff --git a/web/ic-card-search.js b/web/ic-card-search.js index 3bd6537..0bac366 100644 --- a/web/ic-card-search.js +++ b/web/ic-card-search.js @@ -90,14 +90,14 @@ const formatIcCardEventUnified = (ev) => { const type = String(ev?.type || '').toLowerCase(); const action = String(ev?.action || '').toLowerCase(); - let deviceId = String(ev?.device || ev?.device_id || ev?.["设备编号"] || ev?.["机器ID"] || '---').trim(); + let deviceId = String(ev?.device || ev?.device_id || ev?.detail?.device || ev?.detail?.device_id || ev?.["设备编号"] || ev?.["机器ID"] || '---').trim(); const dStr = deviceId.toLowerCase(); if (dStr === 'gate') { deviceId = '闸机'; } else if (dStr === 'refill_machine') { deviceId = '充值机'; - } else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown') { + } else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown' || dStr === '---' || dStr === '') { if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') { deviceId = '闸机'; } else if (type === 'topup' || type === 'refill' || action === 'topup' || type === '充值') { diff --git a/web/index.js b/web/index.js index 1dd3c5f..ce5d1cd 100644 --- a/web/index.js +++ b/web/index.js @@ -348,14 +348,14 @@ createApp({ const formatTicketEventUnified = (ev) => { const type = getTicketEventType(ev); const action = getTicketEventAction(ev); - let deviceId = String(ev?.device || ev?.device_id || ev?.["设备编号"] || ev?.["机器ID"] || '---').trim(); + let deviceId = String(ev?.device || ev?.device_id || ev?.detail?.device || ev?.detail?.device_id || ev?.["设备编号"] || ev?.["机器ID"] || '---').trim(); const dStr = deviceId.toLowerCase(); if (dStr === 'gate') { deviceId = '闸机'; } else if (dStr === 'refill_machine') { deviceId = '充值机'; - } else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown') { + } else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown' || dStr === '---' || dStr === '') { if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') { deviceId = '闸机'; } else { @@ -464,14 +464,14 @@ createApp({ const formatIcEventDetail = (ev) => { const type = String(ev?.type || '').toLowerCase(); const action = String(ev?.action || '').toLowerCase(); - let deviceId = String(ev?.device || ev?.device_id || ev?.["设备编号"] || ev?.["机器ID"] || '---').trim(); + let deviceId = String(ev?.device || ev?.device_id || ev?.detail?.device || ev?.detail?.device_id || ev?.["设备编号"] || ev?.["机器ID"] || '---').trim(); const dStr = deviceId.toLowerCase(); if (dStr === 'gate') { deviceId = '闸机'; } else if (dStr === 'refill_machine') { deviceId = '充值机'; - } else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown') { + } else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown' || dStr === '---' || dStr === '') { if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') { deviceId = '闸机'; } else if (type === 'topup' || type === 'refill' || action === 'topup' || type === '充值') { diff --git a/web/ticket-board.html b/web/ticket-board.html index e364487..1248f6f 100644 --- a/web/ticket-board.html +++ b/web/ticket-board.html @@ -320,14 +320,14 @@ } const stationEn = event.station_en || event['站点英文'] || ''; - let deviceId = String(event.device || event.device_id || event['设备编号'] || event['机器ID'] || '').trim(); + let deviceId = String(event.device || event.device_id || event.detail?.device || event.detail?.device_id || event['设备编号'] || event['机器ID'] || '').trim(); const dStr = deviceId.toLowerCase(); if (dStr === 'gate') { deviceId = '闸机'; } else if (dStr === 'refill_machine') { deviceId = '充值机'; - } else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown') { + } else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown' || dStr === '---' || dStr === '') { if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') { deviceId = '闸机'; } else if (type === 'topup' || type === 'refill' || action === 'topup' || type === '充值') { diff --git a/web/ticket-route.js b/web/ticket-route.js index 0b9a4e1..a23fa9f 100644 --- a/web/ticket-route.js +++ b/web/ticket-route.js @@ -228,14 +228,14 @@ createApp({ const formatTicketEventUnified = (ev) => { const type = getTicketEventType(ev); const action = getTicketEventAction(ev); - let deviceId = String(ev?.device || ev?.device_id || ev?.["设备编号"] || ev?.["机器ID"] || '---').trim(); + let deviceId = String(ev?.device || ev?.device_id || ev?.detail?.device || ev?.detail?.device_id || ev?.["设备编号"] || ev?.["机器ID"] || '---').trim(); const dStr = deviceId.toLowerCase(); if (dStr === 'gate') { deviceId = '闸机'; } else if (dStr === 'refill_machine') { deviceId = '充值机'; - } else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown') { + } else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown' || dStr === '---' || dStr === '') { if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') { deviceId = '闸机'; } else { diff --git a/web/ticket-search.js b/web/ticket-search.js index 4244654..2fdbeb0 100644 --- a/web/ticket-search.js +++ b/web/ticket-search.js @@ -110,14 +110,14 @@ const formatTicketEventUnified = (ev) => { const type = getEventType(ev); const action = String(ev.action || ev["动作"] || '').toLowerCase(); - let deviceId = String(ev.device || ev.device_id || ev["设备编号"] || ev["机器ID"] || '---').trim(); + let deviceId = String(ev.device || ev.device_id || ev.detail?.device || ev.detail?.device_id || ev["设备编号"] || ev["机器ID"] || '---').trim(); const dStr = deviceId.toLowerCase(); if (dStr === 'gate') { deviceId = '闸机'; } else if (dStr === 'refill_machine') { deviceId = '充值机'; - } else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown') { + } else if (dStr === 'ticket_machine' || dStr === 'ticket_vending_machine' || /^#?\d+$/.test(dStr) || dStr.includes('computer') || dStr === 'unknown' || dStr === '---' || dStr === '') { if (type === 'entry' || action === 'entry' || type === 'exit' || action === 'exit' || type === 'check') { deviceId = '闸机'; } else {