/**
|
* 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
|