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 {