fix(web): 修复设备ID获取不全与空值处理不完善的问题
补充从ev.detail中提取设备ID的逻辑,同时新增对空字符串和'---'格式设备ID的统一处理
This commit is contained in:
@@ -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 === '充值') {
|
||||
|
||||
@@ -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 === '充值') {
|
||||
|
||||
+4
-4
@@ -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 === '充值') {
|
||||
|
||||
@@ -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 === '充值') {
|
||||
|
||||
+2
-2
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user