2025-03-07 11:15:46 +08:00
|
|
|
|
import {searchAndConnectDevice, writeBLECharacteristicValue} from "../uni/basic.js";
|
2025-04-10 15:01:55 +08:00
|
|
|
|
import {cmdIds, Result, subCmdIds, supportFunctionsFeatureBit} from '../constant'
|
2025-04-15 15:21:17 +08:00
|
|
|
|
import {
|
|
|
|
|
|
convertWeekdaysToNumber,
|
|
|
|
|
|
createPackageEnd,
|
|
|
|
|
|
md5Encrypt,
|
|
|
|
|
|
parseTimeToList,
|
|
|
|
|
|
timestampToArray,
|
|
|
|
|
|
convertTimeToBytes,
|
|
|
|
|
|
convertWeekdayArrayToBit,
|
|
|
|
|
|
_convertToMilliseconds,
|
|
|
|
|
|
checkRequiredFields,
|
|
|
|
|
|
} from "../format.js";
|
2025-03-07 11:15:46 +08:00
|
|
|
|
import {sm4} from "sm-crypto";
|
|
|
|
|
|
import {
|
2025-03-08 10:50:25 +08:00
|
|
|
|
checkRepeatCardName,
|
|
|
|
|
|
checkRepeatFaceName,
|
|
|
|
|
|
checkRepeatFingerprintName,
|
|
|
|
|
|
checkRepeatPalmVeinName,
|
|
|
|
|
|
checkRepeatRemoteName,
|
2025-03-07 11:15:46 +08:00
|
|
|
|
clearAllIcCard,
|
2025-03-10 14:51:39 +08:00
|
|
|
|
deleteIcCardRequest, getFaceListRequest,
|
2025-03-08 10:50:25 +08:00
|
|
|
|
getFingerprintListRequest,
|
2025-04-10 15:01:55 +08:00
|
|
|
|
getIcCardListRequest, getLockSettingRequest, getPalmVeinListRequest, getRemoteListRequest,
|
2025-03-07 11:15:46 +08:00
|
|
|
|
updateIcCardRequest
|
|
|
|
|
|
} from "../api.js";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2025-03-08 16:33:45 +08:00
|
|
|
|
* 注册扩展产品(卡片、指纹、人脸、遥控、掌静脉等)
|
2025-03-07 11:15:46 +08:00
|
|
|
|
*
|
|
|
|
|
|
* @param {Object} params - 所需参数
|
2025-03-08 16:33:45 +08:00
|
|
|
|
* @param {string} params.type - 产品类型,['card','fingerprint','face','remote','palmVein']
|
2025-03-07 11:15:46 +08:00
|
|
|
|
* @param {string} params.keyId - 钥匙 ID
|
|
|
|
|
|
* @param {string} params.uid - 用户 ID
|
|
|
|
|
|
* @param {number} params.userCountLimit - 使用次数限制,整型,0xFFFF 表示不限次数
|
|
|
|
|
|
* @param {number} params.operate - 操作类型,整型,0: 注册, 1: 修改, 2: 删除, 3: 删除全部
|
|
|
|
|
|
* @param {number} params.isAdmin - 是否管理员,整型,1 表示是,0 表示否
|
|
|
|
|
|
* @param {number} params.isForce - 是否胁迫,整型,1 表示是,0 表示否
|
|
|
|
|
|
* @param {number} params.isRound - 是否循环,整型,1 表示是,0 表示否
|
2025-04-10 15:01:55 +08:00
|
|
|
|
* @param {array} params.weekDay - 循环周期,数组,Bit0 -- 6 置位分别代表周日 -- 周六,例如:循环星期一、星期二、星期四,对应为:[1,2,4]
|
2025-03-08 10:18:05 +08:00
|
|
|
|
* @param {number} params.startDate - 生效日期,时间戳,永久则填0
|
|
|
|
|
|
* @param {number} params.endDate - 失效日期,时间戳,永久则填0
|
2025-03-07 11:15:46 +08:00
|
|
|
|
* @param {string} params.startTime - 生效时间,字符串,例如:'00:00'
|
|
|
|
|
|
* @param {string} params.endTime - 失效时间,字符串,例如:'00:00'
|
2025-03-08 16:33:45 +08:00
|
|
|
|
* @param {number} params.cardId - 卡片Id,添加后由监听事件返回,仅当 type 为 'card' 且operate!=1 时需要
|
|
|
|
|
|
* @param {number} params.cardNumber - 卡片序号,仅当 type 为 'card' 时需要
|
2025-03-07 11:15:46 +08:00
|
|
|
|
* @param {string} params.cardName - 卡片名称,仅当 type 为 'card' 时需要
|
|
|
|
|
|
* @param {number} params.cardType - 卡片类型,1:永久,2:期限,4:循环,仅当 type 为 'card' 时需要
|
|
|
|
|
|
* @param {number} params.cardUserNo - 卡UserNo,仅当 type 为 'card' 时需要 (选填)
|
2025-03-08 16:33:45 +08:00
|
|
|
|
* @param {number} params.fingerprintId - 指纹id,添加后由监听事件返回,仅当 type 为 'fingerprint' 且operate!=1 时需要
|
2025-03-07 11:15:46 +08:00
|
|
|
|
* @param {number} params.fingerprintName - 指纹名,仅当 type 为 'fingerprint' 时需要
|
|
|
|
|
|
* @param {string} params.fingerprintNumber - 指纹序号,仅当 type 为 'fingerprint' 时需要
|
|
|
|
|
|
* @param {number} params.fingerprintType - 指纹类型,1:永久,2:期限,3:单次,4:循环,仅当 type 为 'fingerprint' 时需要
|
|
|
|
|
|
* @param {number} params.fingerprintUserNo - 指纹UserNo,仅当 type 为 'fingerprint' 时需要 (选填)
|
2025-03-08 16:33:45 +08:00
|
|
|
|
* @param {number} params.deleteType - 删除方式,仅当 type 为 'fingerprint' 时需要 删除方式:1-通过APP走蓝牙删除,必需先通过APP蓝牙删除后再调用该接口,2-通过网关或WiFi锁删除,如果是WiFi锁或有连接网关,则可以传2,直接调用该接口从锁里删除指纹
|
|
|
|
|
|
* @param {number} params.faceId - 人脸id,添加后由监听事件返回,仅当 type 为 'face' 且operate!=1 时需要
|
2025-03-08 10:18:05 +08:00
|
|
|
|
* @param {number} params.faceName - 人脸名,仅当 type 为 'face' 时需要
|
|
|
|
|
|
* @param {string} params.faceNumber - 指纹序号,仅当 type 为 'face' 时需要
|
|
|
|
|
|
* @param {number} params.faceType - 指纹类型,1:永久,2:期限,4:循环,仅当 type 为 'face' 时需要
|
|
|
|
|
|
* @param {number} params.faceUserNo - 指纹UserNo,仅当 type 为 'face' 时需要 (选填)
|
2025-03-08 16:33:45 +08:00
|
|
|
|
* @param {number} params.palmVeinId - 掌静脉id,添加后由监听事件返回,仅当 type 为 'palmVein' 且operate!=1 时需要
|
2025-03-08 10:50:25 +08:00
|
|
|
|
* @param {number} params.palmVeinName - 掌静脉名,仅当 type 为 'palmVein' 时需要
|
|
|
|
|
|
* @param {string} params.palmVeinNumber - 掌静脉序号,仅当 type 为 'palmVein' 时需要
|
|
|
|
|
|
* @param {number} params.palmVeinType - 掌静脉类型,1:永久,2:期限,4:循环,仅当 type 为 'palmVein' 时需要
|
|
|
|
|
|
* @param {number} params.palmVeinUserNo - 掌静脉UserNo,仅当 type 为 'palmVein' 时需要 (选填)
|
2025-03-08 16:33:45 +08:00
|
|
|
|
* @param {number} params.remoteId - 遥控名,添加后由监听事件返回,仅当 type 为 'remote' 且operate!=1 时需要
|
2025-03-08 10:50:25 +08:00
|
|
|
|
* @param {number} params.remoteName - 遥控名,仅当 type 为 'remote' 时需要
|
|
|
|
|
|
* @param {string} params.remoteNumber - 遥控序号,仅当 type 为 'remote' 时需要
|
|
|
|
|
|
* @param {number} params.remoteType - 遥控类型,1:永久,2:期限,4:循环,仅当 type 为 'remote' 时需要
|
|
|
|
|
|
* @param {number} params.remoteUserNo - 遥控UserNo,仅当 type 为 'remote' 时需要 (选填)
|
2025-03-07 11:15:46 +08:00
|
|
|
|
* @returns {Promise<Result>} - 返回注册结果的 Promise 对象
|
|
|
|
|
|
*/
|
|
|
|
|
|
export async function registerExtendedProducts(params) {
|
|
|
|
|
|
|
2025-04-15 15:21:17 +08:00
|
|
|
|
const cardRequiredFields = ['type', 'userCountLimit', 'operate', 'isAdmin', 'isForce', 'isRound', 'startDate', 'endDate'];
|
2025-04-10 15:01:55 +08:00
|
|
|
|
const missingField = checkRequiredFields(params, cardRequiredFields);
|
2025-03-10 14:31:17 +08:00
|
|
|
|
if (missingField) {
|
2025-04-15 15:21:17 +08:00
|
|
|
|
return new Result(Result.codes.NotMoreData, null, `参数信息不完整: ${missingField}`);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 循环类型参数校验
|
|
|
|
|
|
if (params.isRound && params.isRound === 1) {
|
|
|
|
|
|
const roundRequiredFields = ['startTime', 'endTime', 'weekDay'];
|
|
|
|
|
|
const missingField = checkRequiredFields(params, roundRequiredFields);
|
|
|
|
|
|
if (missingField) {
|
|
|
|
|
|
return new Result(Result.codes.NotMoreData, null, `参数信息不完整: ${missingField}`);
|
|
|
|
|
|
}
|
2025-03-07 11:15:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 如果是卡片的话需要增加的参数
|
|
|
|
|
|
if (params.type === 'card') {
|
|
|
|
|
|
// 注册卡片时的参数校验
|
|
|
|
|
|
if (params.operate === 0) {
|
2025-03-08 16:33:45 +08:00
|
|
|
|
const cardRequiredFields = ['cardName', 'cardType', 'cardNumber'];
|
2025-04-10 15:01:55 +08:00
|
|
|
|
const missingField = checkRequiredFields(params, cardRequiredFields);
|
2025-03-07 11:15:46 +08:00
|
|
|
|
if (missingField) {
|
2025-04-15 15:21:17 +08:00
|
|
|
|
return new Result(Result.codes.NotMoreData, null, `卡片信息不完整: ${missingField}`);
|
2025-03-07 11:15:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 检查卡昵称是否重复
|
|
|
|
|
|
const checkRepeatCardNameResult = await checkRepeatCardName({
|
|
|
|
|
|
lockId: this.lockInfo.lockId,
|
|
|
|
|
|
cardName: params.cardName
|
|
|
|
|
|
})
|
|
|
|
|
|
if (checkRepeatCardNameResult.code !== Result.Success.code) {
|
|
|
|
|
|
return checkRepeatCardNameResult
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 修改卡片时的参数校验
|
|
|
|
|
|
if (params.operate === 1 || params.operate === 2) {
|
|
|
|
|
|
let cardRequiredFields = ['cardId'];
|
|
|
|
|
|
if (params.operate === 1) {
|
|
|
|
|
|
cardRequiredFields.push('cardType')
|
|
|
|
|
|
}
|
|
|
|
|
|
if (params.operate === 2) {
|
2025-03-08 16:33:45 +08:00
|
|
|
|
cardRequiredFields.push('cardNumber')
|
2025-03-07 11:15:46 +08:00
|
|
|
|
}
|
2025-04-10 15:01:55 +08:00
|
|
|
|
const missingField = checkRequiredFields(params, cardRequiredFields);
|
2025-03-07 11:15:46 +08:00
|
|
|
|
if (missingField) {
|
2025-04-15 15:21:17 +08:00
|
|
|
|
return new Result(Result.codes.NotMoreData, null, `卡片信息不完整: ${missingField}`);
|
2025-03-07 11:15:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 如果是指纹的话需要增加的参数
|
|
|
|
|
|
if (params.type === 'fingerprint') {
|
2025-03-07 18:10:32 +08:00
|
|
|
|
if (params.operate === 0) {
|
|
|
|
|
|
const cardRequiredFields = ['fingerprintName', 'fingerprintNumber', 'fingerprintType'];
|
2025-04-10 15:01:55 +08:00
|
|
|
|
const missingField = checkRequiredFields(params, cardRequiredFields);
|
2025-03-07 18:10:32 +08:00
|
|
|
|
if (missingField) {
|
2025-04-15 15:21:17 +08:00
|
|
|
|
return new Result(Result.codes.NotMoreData, null, `指纹信息不完整: ${missingField}`);
|
2025-03-07 18:10:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 检查卡昵称是否重复
|
2025-03-08 10:18:05 +08:00
|
|
|
|
const checkRepeatFingerprintNameResult = await checkRepeatFingerprintName({
|
2025-03-07 18:10:32 +08:00
|
|
|
|
lockId: this.lockInfo.lockId,
|
|
|
|
|
|
fingerprintName: params.fingerprintName
|
|
|
|
|
|
})
|
2025-03-08 10:18:05 +08:00
|
|
|
|
if (checkRepeatFingerprintNameResult.code !== Result.Success.code) {
|
|
|
|
|
|
return checkRepeatFingerprintNameResult
|
2025-03-07 18:10:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 修改指纹时的参数校验
|
|
|
|
|
|
if (params.operate === 1 || params.operate === 2) {
|
|
|
|
|
|
let cardRequiredFields = ['fingerprintId'];
|
|
|
|
|
|
if (params.operate === 1) {
|
|
|
|
|
|
cardRequiredFields.push('fingerprintType')
|
|
|
|
|
|
}
|
|
|
|
|
|
if (params.operate === 2) {
|
2025-03-08 16:33:45 +08:00
|
|
|
|
cardRequiredFields.push('deleteType')
|
2025-03-07 18:10:32 +08:00
|
|
|
|
cardRequiredFields.push('fingerprintNumber')
|
|
|
|
|
|
}
|
2025-04-10 15:01:55 +08:00
|
|
|
|
const missingField = checkRequiredFields(params, cardRequiredFields);
|
2025-03-07 18:10:32 +08:00
|
|
|
|
if (missingField) {
|
2025-04-15 15:21:17 +08:00
|
|
|
|
return new Result(Result.codes.NotMoreData, null, `指纹信息不完整: ${missingField}`);
|
2025-03-07 18:10:32 +08:00
|
|
|
|
}
|
2025-03-07 11:15:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-08 10:18:05 +08:00
|
|
|
|
// 如果是人脸的话需要增加的参数
|
|
|
|
|
|
if (params.type === 'face') {
|
|
|
|
|
|
if (params.operate === 0) {
|
|
|
|
|
|
const cardRequiredFields = ['faceName', 'faceNumber', 'faceType'];
|
2025-04-10 15:01:55 +08:00
|
|
|
|
const missingField = checkRequiredFields(params, cardRequiredFields);
|
2025-03-08 10:18:05 +08:00
|
|
|
|
if (missingField) {
|
2025-04-15 15:21:17 +08:00
|
|
|
|
return new Result(Result.codes.NotMoreData, null, `人脸信息不完整: ${missingField}`);
|
2025-03-08 10:18:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 检查卡昵称是否重复
|
|
|
|
|
|
const checkRepeatFaceNameResult = await checkRepeatFaceName({
|
|
|
|
|
|
lockId: this.lockInfo.lockId,
|
|
|
|
|
|
faceName: params.faceName
|
|
|
|
|
|
})
|
|
|
|
|
|
if (checkRepeatFaceNameResult.code !== Result.Success.code) {
|
|
|
|
|
|
return checkRepeatFaceNameResult
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 修改指纹时的参数校验
|
|
|
|
|
|
if (params.operate === 1 || params.operate === 2) {
|
|
|
|
|
|
let cardRequiredFields = ['faceId'];
|
|
|
|
|
|
if (params.operate === 1) {
|
|
|
|
|
|
cardRequiredFields.push('faceType')
|
|
|
|
|
|
}
|
|
|
|
|
|
if (params.operate === 2) {
|
|
|
|
|
|
cardRequiredFields.push('faceNumber')
|
|
|
|
|
|
}
|
2025-04-10 15:01:55 +08:00
|
|
|
|
const missingField = checkRequiredFields(params, cardRequiredFields);
|
2025-03-08 10:18:05 +08:00
|
|
|
|
if (missingField) {
|
2025-04-15 15:21:17 +08:00
|
|
|
|
return new Result(Result.codes.NotMoreData, null, `人脸信息不完整: ${missingField}`);
|
2025-03-08 10:18:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-08 10:38:30 +08:00
|
|
|
|
// 如果是掌静脉的话需要增加的参数
|
|
|
|
|
|
if (params.type === 'palmVein') {
|
|
|
|
|
|
if (params.operate === 0) {
|
|
|
|
|
|
const cardRequiredFields = ['palmVeinName', 'palmVeinNumber', 'palmVeinType'];
|
2025-04-10 15:01:55 +08:00
|
|
|
|
const missingField = checkRequiredFields(params, cardRequiredFields);
|
2025-03-08 10:38:30 +08:00
|
|
|
|
if (missingField) {
|
2025-04-15 15:21:17 +08:00
|
|
|
|
return new Result(Result.codes.NotMoreData, null, `掌静脉信息不完整: ${missingField}`);
|
2025-03-08 10:38:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 检查卡昵称是否重复
|
|
|
|
|
|
const checkRepeatFaceNameResult = await checkRepeatPalmVeinName({
|
|
|
|
|
|
lockId: this.lockInfo.lockId,
|
|
|
|
|
|
palmVeinName: params.palmVeinName
|
|
|
|
|
|
})
|
|
|
|
|
|
if (checkRepeatFaceNameResult.code !== Result.Success.code) {
|
|
|
|
|
|
return checkRepeatFaceNameResult
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 修改指纹时的参数校验
|
|
|
|
|
|
if (params.operate === 1 || params.operate === 2) {
|
|
|
|
|
|
let cardRequiredFields = ['palmVeinId'];
|
|
|
|
|
|
if (params.operate === 1) {
|
|
|
|
|
|
cardRequiredFields.push('palmVeinType')
|
|
|
|
|
|
}
|
|
|
|
|
|
if (params.operate === 2) {
|
|
|
|
|
|
cardRequiredFields.push('palmVeinNumber')
|
|
|
|
|
|
}
|
2025-04-10 15:01:55 +08:00
|
|
|
|
const missingField = checkRequiredFields(params, cardRequiredFields);
|
2025-03-08 10:38:30 +08:00
|
|
|
|
if (missingField) {
|
2025-04-15 15:21:17 +08:00
|
|
|
|
return new Result(Result.codes.NotMoreData, null, `掌静脉信息不完整: ${missingField}`);
|
2025-03-08 10:38:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-08 10:50:25 +08:00
|
|
|
|
// 如果是遥控的话需要增加的参数
|
|
|
|
|
|
if (params.type === 'remote') {
|
|
|
|
|
|
if (params.operate === 0) {
|
|
|
|
|
|
const cardRequiredFields = ['remoteName', 'remoteNumber', 'remoteType'];
|
2025-04-10 15:01:55 +08:00
|
|
|
|
const missingField = checkRequiredFields(params, cardRequiredFields);
|
2025-03-08 10:50:25 +08:00
|
|
|
|
if (missingField) {
|
2025-04-15 15:21:17 +08:00
|
|
|
|
return new Result(Result.codes.NotMoreData, null, `遥控信息不完整: ${missingField}`);
|
2025-03-08 10:50:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 检查卡昵称是否重复
|
|
|
|
|
|
const checkRepeatFaceNameResult = await checkRepeatRemoteName({
|
|
|
|
|
|
lockId: this.lockInfo.lockId,
|
|
|
|
|
|
remoteName: params.remoteName
|
|
|
|
|
|
})
|
|
|
|
|
|
if (checkRepeatFaceNameResult.code !== Result.Success.code) {
|
|
|
|
|
|
return checkRepeatFaceNameResult
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 修改指纹时的参数校验
|
|
|
|
|
|
if (params.operate === 1 || params.operate === 2) {
|
|
|
|
|
|
let cardRequiredFields = ['remoteId'];
|
|
|
|
|
|
if (params.operate === 1) {
|
|
|
|
|
|
cardRequiredFields.push('remoteType')
|
|
|
|
|
|
}
|
|
|
|
|
|
if (params.operate === 2) {
|
|
|
|
|
|
cardRequiredFields.push('remoteNumber')
|
|
|
|
|
|
}
|
2025-04-10 15:01:55 +08:00
|
|
|
|
const missingField = checkRequiredFields(params, cardRequiredFields);
|
2025-03-08 10:50:25 +08:00
|
|
|
|
if (missingField) {
|
2025-04-15 15:21:17 +08:00
|
|
|
|
return new Result(Result.codes.NotMoreData, null, `遥控信息不完整: ${missingField}`);
|
2025-03-08 10:50:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-07 11:15:46 +08:00
|
|
|
|
// 添加类型:1蓝牙,2远程,3发卡器
|
|
|
|
|
|
params.addType = 1;
|
|
|
|
|
|
// 操作后不断开蓝牙
|
|
|
|
|
|
params.disconnect = false;
|
|
|
|
|
|
|
|
|
|
|
|
let {
|
|
|
|
|
|
type,
|
|
|
|
|
|
operate,
|
|
|
|
|
|
isAdmin,
|
|
|
|
|
|
userCountLimit,
|
|
|
|
|
|
isForce,
|
|
|
|
|
|
isRound,
|
2025-04-10 15:01:55 +08:00
|
|
|
|
weekDay,
|
2025-03-07 11:15:46 +08:00
|
|
|
|
startDate,
|
|
|
|
|
|
endDate,
|
|
|
|
|
|
startTime,
|
|
|
|
|
|
endTime,
|
|
|
|
|
|
} = params
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-15 15:21:17 +08:00
|
|
|
|
const uid = this.accountInfo.uid.toString()
|
|
|
|
|
|
const keyId = this.lockInfo.keyId.toString()
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-07 11:15:46 +08:00
|
|
|
|
// 设置执行账号
|
|
|
|
|
|
const result = await this.login(uid)
|
|
|
|
|
|
if (result.code !== Result.Success.code) {
|
|
|
|
|
|
return result
|
|
|
|
|
|
}
|
|
|
|
|
|
// 确认设备连接正常
|
|
|
|
|
|
if (!params.connected) {
|
|
|
|
|
|
const searchResult = await searchAndConnectDevice(this.lockInfo.bluetooth.bluetoothDeviceName)
|
|
|
|
|
|
if (searchResult.code !== Result.Success.code) {
|
|
|
|
|
|
return searchResult
|
|
|
|
|
|
}
|
|
|
|
|
|
this.updateLockInfo(searchResult.data)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 检查是否已添加为用户
|
|
|
|
|
|
const checkResult = await this.checkLockUser()
|
|
|
|
|
|
if (!checkResult) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
code: -1
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.requestParams = params
|
|
|
|
|
|
|
2025-04-07 11:18:38 +08:00
|
|
|
|
// 处理时间戳
|
|
|
|
|
|
if (this.requestParams.startDate !== undefined && this.requestParams.startDate !== null) {
|
|
|
|
|
|
// 确保转换为数字类型
|
|
|
|
|
|
const startDate = Number(this.requestParams.startDate);
|
|
|
|
|
|
if (!isNaN(startDate)) {
|
|
|
|
|
|
this.requestParams.startDate = _convertToMilliseconds(startDate);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.requestParams.endDate !== undefined && this.requestParams.endDate !== null) {
|
|
|
|
|
|
// 确保转换为数字类型
|
|
|
|
|
|
const endDate = Number(this.requestParams.endDate);
|
|
|
|
|
|
if (!isNaN(endDate)) {
|
|
|
|
|
|
this.requestParams.endDate = _convertToMilliseconds(endDate);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-07 11:15:46 +08:00
|
|
|
|
startDate = Math.floor(startDate / 1000)
|
|
|
|
|
|
endDate = Math.floor(endDate / 1000)
|
|
|
|
|
|
|
|
|
|
|
|
const length = 2 + 1 + 1 + 40 + 20 + 2 + 2 + 1 + 1 + 1 + 4 + 1 + 1 + 4 + 4 + 4 + 4 + 1 + 16
|
|
|
|
|
|
const headArray = this.createPackageHeader(3, length)
|
|
|
|
|
|
const contentArray = new Uint8Array(length)
|
|
|
|
|
|
|
|
|
|
|
|
contentArray[0] = cmdIds.expandCmd / 256
|
|
|
|
|
|
contentArray[1] = cmdIds.expandCmd % 256
|
|
|
|
|
|
// 子命令
|
|
|
|
|
|
if (type === 'card') {
|
|
|
|
|
|
contentArray[2] = subCmdIds.registerCard
|
|
|
|
|
|
} else if (type === 'fingerprint') {
|
|
|
|
|
|
contentArray[2] = subCmdIds.registerFingerprint
|
|
|
|
|
|
} else if (type === 'face') {
|
|
|
|
|
|
contentArray[2] = subCmdIds.registerFace
|
|
|
|
|
|
} else if (type === 'remote') {
|
|
|
|
|
|
contentArray[2] = subCmdIds.registerRemote
|
|
|
|
|
|
} else if (type === 'palmVein') {
|
|
|
|
|
|
contentArray[2] = subCmdIds.registerPalmVein
|
|
|
|
|
|
}
|
|
|
|
|
|
contentArray[3] = length - 3
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < keyId.length; i++) {
|
|
|
|
|
|
contentArray[i + 4] = keyId.charCodeAt(i)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < uid.length; i++) {
|
|
|
|
|
|
contentArray[i + 44] = uid.charCodeAt(i)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-08 16:33:45 +08:00
|
|
|
|
// 子命令
|
|
|
|
|
|
if (type === 'card') {
|
|
|
|
|
|
contentArray[64] = (params.cardNumber || 0) / 256
|
|
|
|
|
|
contentArray[65] = (params.cardNumber || 0) % 256
|
|
|
|
|
|
} else if (type === 'fingerprint') {
|
|
|
|
|
|
contentArray[64] = (params.fingerprintNumber || 0) / 256
|
|
|
|
|
|
contentArray[65] = (params.fingerprintNumber || 0) % 256
|
|
|
|
|
|
} else if (type === 'face') {
|
|
|
|
|
|
contentArray[64] = (params.faceNumber || 0) / 256
|
|
|
|
|
|
contentArray[65] = (params.faceNumber || 0) % 256
|
|
|
|
|
|
} else if (type === 'remote') {
|
|
|
|
|
|
contentArray[64] = (params.remoteNumber || 0) / 256
|
|
|
|
|
|
contentArray[65] = (params.remoteNumber || 0) % 256
|
|
|
|
|
|
} else if (type === 'palmVein') {
|
|
|
|
|
|
contentArray[64] = (params.palmVeinNumber || 0) / 256
|
|
|
|
|
|
contentArray[65] = (params.palmVeinNumber || 0) % 256
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-07 11:15:46 +08:00
|
|
|
|
contentArray[66] = (userCountLimit || 0xffff) / 256
|
|
|
|
|
|
contentArray[67] = (userCountLimit || 0xffff) % 256
|
|
|
|
|
|
contentArray[68] = operate
|
|
|
|
|
|
contentArray[69] = isAdmin || 0
|
|
|
|
|
|
contentArray[70] = isForce || 0
|
|
|
|
|
|
|
|
|
|
|
|
contentArray.set(this.lockInfo.token || new Uint8Array([0, 0, 0, 0]), 71)
|
|
|
|
|
|
|
|
|
|
|
|
contentArray[75] = isRound
|
2025-04-10 15:01:55 +08:00
|
|
|
|
contentArray[76] = convertWeekdaysToNumber(weekDay)
|
2025-03-07 11:15:46 +08:00
|
|
|
|
|
|
|
|
|
|
contentArray.set(timestampToArray(startDate), 77)
|
|
|
|
|
|
contentArray.set(timestampToArray(endDate), 81)
|
|
|
|
|
|
|
|
|
|
|
|
if (isRound) {
|
|
|
|
|
|
contentArray.set(parseTimeToList(startTime), 85)
|
|
|
|
|
|
contentArray.set(parseTimeToList(endTime), 89)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
contentArray.set(new Uint8Array([0, 0, 0, 0]), 85)
|
|
|
|
|
|
contentArray.set(new Uint8Array([0, 0, 0, 0]), 89)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
contentArray[93] = 16
|
|
|
|
|
|
|
|
|
|
|
|
const md5Array = md5Encrypt(
|
|
|
|
|
|
keyId + uid,
|
|
|
|
|
|
this.lockInfo.token || new Uint8Array([0, 0, 0, 0]),
|
|
|
|
|
|
this.lockInfo.bluetooth.signKey
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
contentArray.set(md5Array, 94)
|
|
|
|
|
|
|
2025-04-15 15:21:17 +08:00
|
|
|
|
console.log('加密前:', Array.from(contentArray))
|
2025-03-07 11:15:46 +08:00
|
|
|
|
const cebArray = sm4.encrypt(contentArray, this.lockInfo.bluetooth.privateKey, {
|
|
|
|
|
|
mode: 'ecb',
|
|
|
|
|
|
output: 'array'
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const packageArray = createPackageEnd(headArray, cebArray)
|
|
|
|
|
|
|
|
|
|
|
|
const writeResult = await writeBLECharacteristicValue(this.lockInfo.deviceId,
|
|
|
|
|
|
this.lockInfo.serviceId,
|
|
|
|
|
|
this.lockInfo.writeCharacteristicId,
|
|
|
|
|
|
packageArray)
|
|
|
|
|
|
if (writeResult.code !== Result.Success.code) {
|
|
|
|
|
|
return writeResult
|
|
|
|
|
|
}
|
|
|
|
|
|
return this.getWriteResult(this.registerExtendedProducts, params)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 取消注册扩展产品
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param {Object} params - 所需参数
|
|
|
|
|
|
* @param {string} params.Type - 产品类型,['card','fingerprint','face','remote','palmVein']
|
|
|
|
|
|
* @param {string} params.KeyID - 钥匙 ID
|
|
|
|
|
|
* @param {string} params.uid - 用户 ID
|
|
|
|
|
|
*/
|
|
|
|
|
|
export async function registerExtendedProductsCancel(params) {
|
|
|
|
|
|
const {type, keyId, uid} = params
|
|
|
|
|
|
// 设置执行账号
|
|
|
|
|
|
const result = await this.login(uid)
|
|
|
|
|
|
if (result.code !== Result.Success.code) {
|
|
|
|
|
|
return result
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 确认设备连接正常
|
|
|
|
|
|
if (!params.connected) {
|
|
|
|
|
|
const searchResult = await searchAndConnectDevice(this.lockInfo.bluetooth.bluetoothDeviceName)
|
|
|
|
|
|
if (searchResult.code !== Result.Success.code) {
|
|
|
|
|
|
return searchResult
|
|
|
|
|
|
}
|
|
|
|
|
|
this.updateLockInfo(searchResult.data)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 检查是否已添加为用户
|
|
|
|
|
|
const checkResult = await this.checkLockUser()
|
|
|
|
|
|
if (!checkResult) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
code: -1
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.requestParams = params
|
|
|
|
|
|
const length = 2 + 1 + 1 + 40 + 20 + 4 + 1 + 16
|
|
|
|
|
|
const headArray = this.createPackageHeader(3, length)
|
|
|
|
|
|
const contentArray = new Uint8Array(length)
|
|
|
|
|
|
|
|
|
|
|
|
contentArray[0] = cmdIds.expandCmd / 256
|
|
|
|
|
|
contentArray[1] = cmdIds.expandCmd % 256
|
|
|
|
|
|
|
|
|
|
|
|
// 子命令
|
|
|
|
|
|
if (type === 'card') {
|
|
|
|
|
|
contentArray[2] = subCmdIds.registerCardCancel
|
|
|
|
|
|
} else if (type === 'fingerprint') {
|
|
|
|
|
|
contentArray[2] = subCmdIds.registerFingerprintCancel
|
|
|
|
|
|
} else if (type === 'face') {
|
|
|
|
|
|
contentArray[2] = subCmdIds.registerFaceCancel
|
|
|
|
|
|
} else if (type === 'remote') {
|
|
|
|
|
|
contentArray[2] = subCmdIds.registerRemoteCancel
|
|
|
|
|
|
} else if (type === 'palmVein') {
|
|
|
|
|
|
contentArray[2] = subCmdIds.registerPalmVeinCancel
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
contentArray[3] = length - 3
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < keyId.length; i++) {
|
|
|
|
|
|
contentArray[i + 4] = keyId.charCodeAt(i)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < uid.length; i++) {
|
|
|
|
|
|
contentArray[i + 44] = uid.charCodeAt(i)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
contentArray.set(this.lockInfo.token || new Uint8Array([0, 0, 0, 0]), 64)
|
|
|
|
|
|
|
|
|
|
|
|
contentArray[68] = 16
|
|
|
|
|
|
|
|
|
|
|
|
const md5Array = md5Encrypt(
|
|
|
|
|
|
keyId + uid,
|
|
|
|
|
|
this.lockInfo.token || new Uint8Array([0, 0, 0, 0]),
|
|
|
|
|
|
this.lockInfo.bluetooth.signKey
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
contentArray.set(md5Array, 69)
|
|
|
|
|
|
|
|
|
|
|
|
const cebArray = sm4.encrypt(contentArray, this.lockInfo.bluetooth.privateKey, {
|
|
|
|
|
|
mode: 'ecb',
|
|
|
|
|
|
output: 'array'
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const packageArray = createPackageEnd(headArray, cebArray)
|
|
|
|
|
|
|
|
|
|
|
|
await writeBLECharacteristicValue(this.lockInfo.deviceId,
|
|
|
|
|
|
this.lockInfo.serviceId,
|
|
|
|
|
|
this.lockInfo.writeCharacteristicId,
|
|
|
|
|
|
packageArray)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-10 15:01:55 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 更新支持功能项设置(带参数)
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param {Object} params - 所需参数
|
|
|
|
|
|
* @param {Object} params.accountInfo - 用户信息
|
|
|
|
|
|
* @param {Number} params.featureBit - 支持功能对应的位
|
|
|
|
|
|
* @param {boolean} params.withParams - 是否携带参数
|
|
|
|
|
|
* @param {Object} params.data - 是否携带参数
|
|
|
|
|
|
* @param {Number} params.featureEnable - 不携带参数时的开关:1-开,0-关
|
|
|
|
|
|
*/
|
|
|
|
|
|
export async function updateSupportFunctionsWithParams(params) {
|
|
|
|
|
|
// 需要校验的参数
|
|
|
|
|
|
const baseRequiredFields = [
|
|
|
|
|
|
'accountInfo',
|
|
|
|
|
|
'featureBit',
|
|
|
|
|
|
'withParams',
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
// 定义功能位对应的必填字段映射
|
|
|
|
|
|
const featureBitFields = {
|
|
|
|
|
|
[supportFunctionsFeatureBit.passageMode]: [
|
|
|
|
|
|
'passageMode',
|
2025-04-15 15:21:17 +08:00
|
|
|
|
'startDate',
|
|
|
|
|
|
'endDate',
|
2025-04-10 15:01:55 +08:00
|
|
|
|
'isAllDay',
|
|
|
|
|
|
'weekDay',
|
|
|
|
|
|
'autoUnlock'
|
|
|
|
|
|
]
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 根据operate值动态添加必填字段
|
|
|
|
|
|
let cardRequiredFields = [...baseRequiredFields];
|
|
|
|
|
|
if (params && params.withParams && params.withParams === true) {
|
|
|
|
|
|
cardRequiredFields.push('data');
|
|
|
|
|
|
// 如果存在对应的功能位字段配置,则添加相应字段
|
|
|
|
|
|
if (featureBitFields[params.featureBit]) {
|
|
|
|
|
|
const dataFields = featureBitFields[params.featureBit];
|
|
|
|
|
|
for (const field of dataFields) {
|
|
|
|
|
|
if (params.data === undefined || params.data[field] === undefined) {
|
2025-04-15 15:21:17 +08:00
|
|
|
|
return new Result(Result.codes.NotMoreData, null, `data参数信息不完整: ${field}`);
|
2025-04-10 15:01:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (params && params.withParams && params.withParams === false) {
|
|
|
|
|
|
cardRequiredFields.push('featureEnable');
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const missingField = checkRequiredFields(params, cardRequiredFields);
|
|
|
|
|
|
if (missingField) {
|
2025-04-15 15:21:17 +08:00
|
|
|
|
return new Result(Result.codes.NotMoreData, null, `参数信息不完整: ${missingField}`);
|
2025-04-10 15:01:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 深拷贝一份参数赋值
|
|
|
|
|
|
this.requestParams = JSON.parse(JSON.stringify(params))
|
|
|
|
|
|
|
|
|
|
|
|
// 转换参数
|
|
|
|
|
|
if (params && params.withParams && params.withParams === true && params.data) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
switch (params.featureBit) {
|
|
|
|
|
|
case supportFunctionsFeatureBit.passageMode:
|
2025-04-15 15:21:17 +08:00
|
|
|
|
const {passageMode, startDate, endDate, isAllDay, weekDay, autoUnlock} = params.data
|
|
|
|
|
|
const startDateBytes = convertTimeToBytes(startDate);
|
|
|
|
|
|
const endDateBytes = convertTimeToBytes(endDate);
|
2025-04-10 15:01:55 +08:00
|
|
|
|
const weekDayBit = parseInt(String(convertWeekdayArrayToBit(weekDay)), 2);
|
|
|
|
|
|
params.data = [
|
|
|
|
|
|
passageMode,
|
2025-04-15 15:21:17 +08:00
|
|
|
|
...startDateBytes,
|
|
|
|
|
|
...endDateBytes,
|
2025-04-10 15:01:55 +08:00
|
|
|
|
isAllDay,
|
|
|
|
|
|
weekDayBit,
|
|
|
|
|
|
autoUnlock
|
|
|
|
|
|
]
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
params.data = [params.data]
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
console.log('转换后的参数:', params.data)
|
|
|
|
|
|
} catch (e) {
|
2025-04-15 15:21:17 +08:00
|
|
|
|
return new Result(Result.codes.NotMoreData, null, `参数转换时异常,请检查参数格式: ${e}`);
|
2025-04-10 15:01:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置执行账号
|
|
|
|
|
|
const result = await this.login(params.uid)
|
|
|
|
|
|
if (result.code !== Result.Success.code) {
|
|
|
|
|
|
return result
|
|
|
|
|
|
}
|
|
|
|
|
|
// 确认设备连接正常
|
|
|
|
|
|
if (!params.connected) {
|
|
|
|
|
|
const searchResult = await searchAndConnectDevice(this.lockInfo.bluetooth.bluetoothDeviceName)
|
|
|
|
|
|
if (searchResult.code !== Result.Success.code) {
|
|
|
|
|
|
return searchResult
|
|
|
|
|
|
}
|
|
|
|
|
|
this.updateLockInfo(searchResult.data)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 检查是否已添加为用户
|
|
|
|
|
|
const checkResult = await this.checkLockUser()
|
|
|
|
|
|
if (checkResult.code !== Result.Success.code) {
|
|
|
|
|
|
return checkResult
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let {featureBit, data, withParams, featureEnable} = params
|
|
|
|
|
|
|
|
|
|
|
|
const uid = this.accountInfo.uid.toString()
|
|
|
|
|
|
const keyId = this.lockInfo.keyId.toString()
|
|
|
|
|
|
|
|
|
|
|
|
// 确保data是数组形式
|
|
|
|
|
|
let dataArray = Array.isArray(data) ? data : [data]
|
|
|
|
|
|
|
|
|
|
|
|
let length = 2 + 1 + 1 + 40 + 20 + 4 + 1 + 16
|
|
|
|
|
|
|
|
|
|
|
|
if (withParams) {
|
|
|
|
|
|
length += 2 + dataArray.length
|
|
|
|
|
|
} else {
|
|
|
|
|
|
length += 2
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const headArray = this.createPackageHeader(3, length)
|
|
|
|
|
|
const contentArray = new Uint8Array(length)
|
|
|
|
|
|
|
|
|
|
|
|
contentArray[0] = cmdIds.expandCmd / 256
|
|
|
|
|
|
contentArray[1] = cmdIds.expandCmd % 256
|
|
|
|
|
|
|
|
|
|
|
|
contentArray[2] = withParams ? subCmdIds.supportFunctionsWithParams : subCmdIds.supportFunctions
|
|
|
|
|
|
|
|
|
|
|
|
contentArray[3] = length - 3
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < keyId.length; i++) {
|
|
|
|
|
|
contentArray[i + 4] = keyId.charCodeAt(i)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < uid.length; i++) {
|
|
|
|
|
|
contentArray[i + 44] = uid.charCodeAt(i)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
contentArray[64] = featureBit
|
|
|
|
|
|
|
|
|
|
|
|
if (withParams) {
|
|
|
|
|
|
contentArray[65] = dataArray.length
|
|
|
|
|
|
contentArray.set(new Uint8Array(dataArray), 66)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
contentArray[65] = featureEnable
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
contentArray.set(
|
|
|
|
|
|
this.lockInfo.token || new Uint8Array([0, 0, 0, 0]),
|
|
|
|
|
|
withParams ? 66 + dataArray.length : 66
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
contentArray[withParams ? 70 + dataArray.length : 70] = 16
|
|
|
|
|
|
|
|
|
|
|
|
const md5Array = md5Encrypt(
|
|
|
|
|
|
keyId + uid,
|
|
|
|
|
|
this.lockInfo.token || new Uint8Array([0, 0, 0, 0]),
|
|
|
|
|
|
this.lockInfo.bluetooth.signKey
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
contentArray.set(md5Array, withParams ? 71 + dataArray.length : 71)
|
|
|
|
|
|
console.log('加密前:', Array.from(contentArray))
|
|
|
|
|
|
|
|
|
|
|
|
const cebArray = sm4.encrypt(contentArray, this.lockInfo.bluetooth.privateKey, {
|
|
|
|
|
|
mode: 'ecb',
|
|
|
|
|
|
output: 'array'
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const packageArray = createPackageEnd(headArray, cebArray)
|
|
|
|
|
|
|
|
|
|
|
|
await writeBLECharacteristicValue(this.lockInfo.deviceId,
|
|
|
|
|
|
this.lockInfo.serviceId,
|
|
|
|
|
|
this.lockInfo.writeCharacteristicId,
|
|
|
|
|
|
packageArray)
|
|
|
|
|
|
|
|
|
|
|
|
return this.getWriteResult(this.updateSupportFunctionsWithParams, params)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 读取支持功能项设置
|
|
|
|
|
|
* @param params
|
|
|
|
|
|
* @param {Number} params.lockId 锁id (必填)
|
|
|
|
|
|
* @returns {Promise<void>}
|
|
|
|
|
|
*/
|
2025-04-15 15:21:17 +08:00
|
|
|
|
export async function readSupportFunctionsSetting(params) {
|
2025-04-10 15:01:55 +08:00
|
|
|
|
return await getLockSettingRequest(params)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-07 11:15:46 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 获取Ic卡列表
|
|
|
|
|
|
* @param params.lockId 锁id (必填)
|
|
|
|
|
|
* @param params.pageNo 页码(选填)
|
|
|
|
|
|
* @param params.pageSize 每页显示数(选填)
|
|
|
|
|
|
* @returns {Promise<unknown>}
|
|
|
|
|
|
*/
|
|
|
|
|
|
export async function getIcCardList(params) {
|
|
|
|
|
|
return await getIcCardListRequest(params)
|
2025-03-07 18:10:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取指纹列表
|
|
|
|
|
|
* @param params.lockId 锁id (必填)
|
|
|
|
|
|
* @param params.pageNo 页码(选填)
|
|
|
|
|
|
* @param params.pageSize 每页显示数(选填)
|
|
|
|
|
|
* @returns {Promise<unknown>}
|
|
|
|
|
|
*/
|
|
|
|
|
|
export async function getFingerprintList(params) {
|
|
|
|
|
|
return await getFingerprintListRequest(params)
|
2025-03-08 16:33:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取掌静脉列表
|
|
|
|
|
|
* @param params.lockId 锁id (必填)
|
|
|
|
|
|
* @param params.pageNo 页码(选填)
|
|
|
|
|
|
* @param params.pageSize 每页显示数(选填)
|
|
|
|
|
|
* @returns {Promise<unknown>}
|
|
|
|
|
|
*/
|
|
|
|
|
|
export async function getPalmVeinList(params) {
|
|
|
|
|
|
return await getPalmVeinListRequest(params)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取掌静脉列表
|
|
|
|
|
|
* @param params.lockId 锁id (必填)
|
|
|
|
|
|
* @param params.pageNo 页码(选填)
|
|
|
|
|
|
* @param params.pageSize 每页显示数(选填)
|
|
|
|
|
|
* @returns {Promise<unknown>}
|
|
|
|
|
|
*/
|
|
|
|
|
|
export async function getRemoteList(params) {
|
|
|
|
|
|
return await getRemoteListRequest(params)
|
2025-03-10 14:51:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取人脸列表
|
|
|
|
|
|
* @param params.lockId 锁id (必填)
|
|
|
|
|
|
* @param params.pageNo 页码(选填)
|
|
|
|
|
|
* @param params.pageSize 每页显示数(选填)
|
|
|
|
|
|
* @returns {Promise<unknown>}
|
|
|
|
|
|
*/
|
|
|
|
|
|
export async function getFaceList(params) {
|
|
|
|
|
|
return await getFaceListRequest(params)
|
2025-03-07 11:15:46 +08:00
|
|
|
|
}
|