lgq
2026-03-31 e491cdb48129752324c4e3764f99bd9203c56dec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
 * NFC服务模块
 * 处理NFC卡片相关的业务逻辑,包括身份证卡和云证的处理
 */
import log from '../../dxmodules/dxLogger.js'
import dxMap from '../../dxmodules/dxMap.js'
import accessService from '../service/accessService.js'
import config from '../../dxmodules/dxConfig.js'
import driver from '../driver.js';
 
const nfcService = {}
 
/**
 * 接收NFC卡片消息并处理
 * @param {object} data - NFC卡片数据
 * @param {string} [data.card_type] - 卡片类型
 * @param {string} [data.id] - 身份证物理卡号
 * @param {string} [data.name] - 姓名(云证)
 * @param {string} [data.sex] - 性别(云证)
 * @param {string} [data.idCardNo] - 身份证号码(云证)
 */
nfcService.receiveMsg = function (data) {
    // log.info('[nfcService] receiveMsg :' + JSON.stringify(data))
 
    // 首先判断是否是身份证卡
    if (data.card_type && data.id) {
        if (dxMap.get("UI").get("getCardStart")) {
            driver.screen.getCard(data.id)
            return
        }
        // 身份证物理卡号/普通卡
        accessService.access({ type: "200", code: data.id })
    } else if (data.name && data.sex && data.idCardNo) {
        if (dxMap.get("UI").get("getCardStart")) {
            driver.screen.getCard(data.idCardNo)
            return
        }
        // 云证
        accessService.access({ type: "200", code: data.idCardNo });
    }
 
}
 
export default nfcService