fix:修复发送注册卡片后不刷卡没有超时的回调

This commit is contained in:
liyi 2025-06-16 10:06:21 +08:00
parent 6613ad29d1
commit 5eaadc0e9a
3 changed files with 129 additions and 94 deletions

217
common.js
View File

@ -1011,26 +1011,31 @@ export async function parsingCharacteristicValue(binaryData) {
case subCmdIds.registerCardConfirm: case subCmdIds.registerCardConfirm:
// 收到锁版回复判断操作类型进行对应api操作 // 收到锁版回复判断操作类型进行对应api操作
if (decrypted[2] === Result.Success.code) { if (decrypted[2] === Result.Success.code) {
switch (this.requestParams.operate) { if (decrypted[5] === Result.Success.code) {
case 0: switch (this.requestParams.operate) {
// 注册 case 0:
const addResult = await addIcCardRequest({ // 注册
...this.requestParams, const addResult = await addIcCardRequest({
isCoerced: this.requestParams.isForce, ...this.requestParams,
cardRight: this.requestParams.isAdmin, isCoerced: this.requestParams.isForce,
lockId: this.lockInfo.lockId, cardRight: this.requestParams.isAdmin,
cardNumber: decrypted[6] * 256 + decrypted[7], lockId: this.lockInfo.lockId,
cardUserNo: this.requestParams.cardUserNo cardNumber: decrypted[6] * 256 + decrypted[7],
}) cardUserNo: this.requestParams.cardUserNo
if (addResult.code === Result.Success.code) { })
// 增加返回一个卡序号 if (addResult.code === Result.Success.code) {
addResult.data.cardNumber = decrypted[6] * 256 + decrypted[7]; // 增加返回一个卡序号
} addResult.data.cardNumber = decrypted[6] * 256 + decrypted[7];
// 触发卡片确认事件 }
emitRegisterCardConfirmEvent(addResult) // 触发卡片确认事件
// 断开蓝牙连接 emitRegisterCardConfirmEvent(addResult)
await this.disconnectDevice() // 断开蓝牙连接
break; await this.disconnectDevice()
break;
}
} else {
emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[5]))
this.characteristicValueCallback(new Result(decrypted[5]))
} }
} else { } else {
emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[2])) emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[2]))
@ -1092,24 +1097,34 @@ export async function parsingCharacteristicValue(binaryData) {
break; break;
case subCmdIds.registerFingerprintConfirm: case subCmdIds.registerFingerprintConfirm:
if (decrypted[2] === Result.Success.code) { if (decrypted[2] === Result.Success.code) {
if (this.requestParams.operate === 0) { if (decrypted[5] === Result.Success.code) {
const addResult = await addFingerprintRequest({ if (this.requestParams.operate === 0) {
...this.requestParams, switch (this.requestParams.operate) {
isCoerced: this.requestParams.isForce, case 0:
fingerRight: this.requestParams.isAdmin, const addResult = await addFingerprintRequest({
lockId: this.lockInfo.lockId, ...this.requestParams,
fingerprintNumber: decrypted[6] * 256 + decrypted[7], isCoerced: this.requestParams.isForce,
fingerprintUserNo: this.requestParams.fingerprintUserNo fingerRight: this.requestParams.isAdmin,
}) lockId: this.lockInfo.lockId,
if (addResult.code === Result.Success.code) { fingerprintNumber: decrypted[6] * 256 + decrypted[7],
// 增加返回一个指纹序号 fingerprintUserNo: this.requestParams.fingerprintUserNo
addResult.data.fingerprintNumber = decrypted[6] * 256 + decrypted[7]; })
if (addResult.code === Result.Success.code) {
// 增加返回一个指纹序号
addResult.data.fingerprintNumber = decrypted[6] * 256 + decrypted[7];
}
// 触发指纹确认事件
emitRegisterFingerprintConfirmEvent(addResult)
// 断开蓝牙连接
await this.disconnectDevice()
break;
}
} }
// 触发指纹确认事件 } else {
emitRegisterFingerprintConfirmEvent(addResult) emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[5]))
// 断开蓝牙连接 this.characteristicValueCallback(new Result(decrypted[5]))
await this.disconnectDevice()
} }
} else { } else {
emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[2])) emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[2]))
this.characteristicValueCallback(new Result(decrypted[2])) this.characteristicValueCallback(new Result(decrypted[2]))
@ -1168,22 +1183,31 @@ export async function parsingCharacteristicValue(binaryData) {
break; break;
case subCmdIds.registerFaceConfirm: case subCmdIds.registerFaceConfirm:
if (this.requestParams.operate === 0) { if (this.requestParams.operate === 0) {
const addResult = await addFaceRequest({ if (decrypted[5] === Result.Success.code) {
...this.requestParams, switch (this.requestParams.operate) {
isCoerced: this.requestParams.isForce, case 0:
fingerRight: this.requestParams.isAdmin, const addResult = await addFaceRequest({
lockId: this.lockInfo.lockId, ...this.requestParams,
faceNumber: decrypted[6] * 256 + decrypted[7], isCoerced: this.requestParams.isForce,
faceUserNo: this.requestParams.faceUserNo fingerRight: this.requestParams.isAdmin,
}) lockId: this.lockInfo.lockId,
if (addResult.code === Result.Success.code) { faceNumber: decrypted[6] * 256 + decrypted[7],
// 增加返回一个序号 faceUserNo: this.requestParams.faceUserNo
addResult.data.faceNumber = decrypted[6] * 256 + decrypted[7]; })
if (addResult.code === Result.Success.code) {
// 增加返回一个序号
addResult.data.faceNumber = decrypted[6] * 256 + decrypted[7];
}
// 触发事件
emitRegisterFaceConfirmEvent(addResult)
// 断开蓝牙连接
await this.disconnectDevice()
break;
}
} else {
emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[5]))
this.characteristicValueCallback(new Result(decrypted[5]))
} }
// 触发事件
emitRegisterFaceConfirmEvent(addResult)
// 断开蓝牙连接
await this.disconnectDevice()
} else { } else {
emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[2])) emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[2]))
this.characteristicValueCallback(new Result(decrypted[2])) this.characteristicValueCallback(new Result(decrypted[2]))
@ -1235,26 +1259,31 @@ export async function parsingCharacteristicValue(binaryData) {
case subCmdIds.registerPalmVeinConfirm: case subCmdIds.registerPalmVeinConfirm:
// 收到锁版回复判断操作类型进行对应api操作 // 收到锁版回复判断操作类型进行对应api操作
if (decrypted[2] === Result.Success.code) { if (decrypted[2] === Result.Success.code) {
switch (this.requestParams.operate) { if (decrypted[5] === Result.Success.code) {
case 0: switch (this.requestParams.operate) {
// 注册 case 0:
const addResult = await addPalmVeinRequest({ // 注册
...this.requestParams, const addResult = await addPalmVeinRequest({
isCoerced: this.requestParams.isForce, ...this.requestParams,
palmVeinRight: this.requestParams.isAdmin, isCoerced: this.requestParams.isForce,
lockId: this.lockInfo.lockId, palmVeinRight: this.requestParams.isAdmin,
palmVeinNumber: decrypted[6] * 256 + decrypted[7], lockId: this.lockInfo.lockId,
palmVeinUserNo: this.requestParams.palmVeinUserNo palmVeinNumber: decrypted[6] * 256 + decrypted[7],
}) palmVeinUserNo: this.requestParams.palmVeinUserNo
if (addResult.code === Result.Success.code) { })
// 增加返回一个卡序号 if (addResult.code === Result.Success.code) {
addResult.data.palmVeinNumber = decrypted[6] * 256 + decrypted[7]; // 增加返回一个卡序号
} addResult.data.palmVeinNumber = decrypted[6] * 256 + decrypted[7];
// 触发卡片确认事件 }
emitRegisterPalmVeinConfirmEvent(addResult) // 触发卡片确认事件
// 断开蓝牙连接 emitRegisterPalmVeinConfirmEvent(addResult)
await this.disconnectDevice() // 断开蓝牙连接
break; await this.disconnectDevice()
break;
}
} else {
emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[5]))
this.characteristicValueCallback(new Result(decrypted[5]))
} }
} else { } else {
emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[2])) emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[2]))
@ -1305,27 +1334,33 @@ export async function parsingCharacteristicValue(binaryData) {
case subCmdIds.registerRemoteConfirm: case subCmdIds.registerRemoteConfirm:
// 收到锁版回复判断操作类型进行对应api操作 // 收到锁版回复判断操作类型进行对应api操作
if (decrypted[2] === Result.Success.code) { if (decrypted[2] === Result.Success.code) {
switch (this.requestParams.operate) { if (decrypted[5] === Result.Success.code) {
case 0: switch (this.requestParams.operate) {
// 注册 case 0:
const addResult = await addRemoteRequest({ // 注册
...this.requestParams, const addResult = await addRemoteRequest({
isCoerced: this.requestParams.isForce, ...this.requestParams,
remoteRight: this.requestParams.isAdmin, isCoerced: this.requestParams.isForce,
lockId: this.lockInfo.lockId, remoteRight: this.requestParams.isAdmin,
remoteNumber: decrypted[6] * 256 + decrypted[7], lockId: this.lockInfo.lockId,
remoteUserNo: this.requestParams.remoteUserNo remoteNumber: decrypted[6] * 256 + decrypted[7],
}) remoteUserNo: this.requestParams.remoteUserNo
if (addResult.code === Result.Success.code) { })
// 增加返回一个卡序号 if (addResult.code === Result.Success.code) {
addResult.data.remoteNumber = decrypted[6] * 256 + decrypted[7]; // 增加返回一个卡序号
} addResult.data.remoteNumber = decrypted[6] * 256 + decrypted[7];
// 触发卡片确认事件 }
emitRegisterRemoteConfirmEvent(addResult) // 触发卡片确认事件
// 断开蓝牙连接 emitRegisterRemoteConfirmEvent(addResult)
await this.disconnectDevice() // 断开蓝牙连接
break; await this.disconnectDevice()
break;
}
} else {
emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[5]))
this.characteristicValueCallback(new Result(decrypted[5]))
} }
} else { } else {
emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[2])) emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[2]))
this.characteristicValueCallback(new Result(decrypted[2])) this.characteristicValueCallback(new Result(decrypted[2]))

4
env.js
View File

@ -1,7 +1,7 @@
// uni版本号 // uni版本号
export const uniVersion = '1.0.17' export const uniVersion = '1.0.18'
// uni构建号 // uni构建号
export const uniBuildNumber = 18 export const uniBuildNumber = 19
// web版本号 // web版本号
export const webVersion = '1.0.1' export const webVersion = '1.0.1'

View File

@ -1,6 +1,6 @@
{ {
"name": "star-cloud-uni", "name": "star-cloud-uni",
"version": "1.0.15", "version": "1.0.18",
"type": "module", "type": "module",
"main": "./uni/index.js", "main": "./uni/index.js",
"author": "zzc059", "author": "zzc059",