From 5eaadc0e9a4e566b9ab1d8be5d1f534544982eec Mon Sep 17 00:00:00 2001 From: liyi Date: Mon, 16 Jun 2025 10:06:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E5=8F=91=E9=80=81?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E5=8D=A1=E7=89=87=E5=90=8E=E4=B8=8D=E5=88=B7?= =?UTF-8?q?=E5=8D=A1=E6=B2=A1=E6=9C=89=E8=B6=85=E6=97=B6=E7=9A=84=E5=9B=9E?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common.js | 217 ++++++++++++++++++++++++++++++--------------------- env.js | 4 +- package.json | 2 +- 3 files changed, 129 insertions(+), 94 deletions(-) diff --git a/common.js b/common.js index 004a91b..59efa69 100644 --- a/common.js +++ b/common.js @@ -1011,26 +1011,31 @@ export async function parsingCharacteristicValue(binaryData) { case subCmdIds.registerCardConfirm: // 收到锁版回复判断操作类型进行对应api操作 if (decrypted[2] === Result.Success.code) { - switch (this.requestParams.operate) { - case 0: - // 注册 - const addResult = await addIcCardRequest({ - ...this.requestParams, - isCoerced: this.requestParams.isForce, - cardRight: this.requestParams.isAdmin, - lockId: this.lockInfo.lockId, - cardNumber: decrypted[6] * 256 + decrypted[7], - cardUserNo: this.requestParams.cardUserNo - }) - if (addResult.code === Result.Success.code) { - // 增加返回一个卡序号 - addResult.data.cardNumber = decrypted[6] * 256 + decrypted[7]; - } - // 触发卡片确认事件 - emitRegisterCardConfirmEvent(addResult) - // 断开蓝牙连接 - await this.disconnectDevice() - break; + if (decrypted[5] === Result.Success.code) { + switch (this.requestParams.operate) { + case 0: + // 注册 + const addResult = await addIcCardRequest({ + ...this.requestParams, + isCoerced: this.requestParams.isForce, + cardRight: this.requestParams.isAdmin, + lockId: this.lockInfo.lockId, + cardNumber: decrypted[6] * 256 + decrypted[7], + cardUserNo: this.requestParams.cardUserNo + }) + if (addResult.code === Result.Success.code) { + // 增加返回一个卡序号 + addResult.data.cardNumber = decrypted[6] * 256 + decrypted[7]; + } + // 触发卡片确认事件 + emitRegisterCardConfirmEvent(addResult) + // 断开蓝牙连接 + await this.disconnectDevice() + break; + } + } else { + emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[5])) + this.characteristicValueCallback(new Result(decrypted[5])) } } else { emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[2])) @@ -1092,24 +1097,34 @@ export async function parsingCharacteristicValue(binaryData) { break; case subCmdIds.registerFingerprintConfirm: if (decrypted[2] === Result.Success.code) { - if (this.requestParams.operate === 0) { - const addResult = await addFingerprintRequest({ - ...this.requestParams, - isCoerced: this.requestParams.isForce, - fingerRight: this.requestParams.isAdmin, - lockId: this.lockInfo.lockId, - fingerprintNumber: decrypted[6] * 256 + decrypted[7], - fingerprintUserNo: this.requestParams.fingerprintUserNo - }) - if (addResult.code === Result.Success.code) { - // 增加返回一个指纹序号 - addResult.data.fingerprintNumber = decrypted[6] * 256 + decrypted[7]; + if (decrypted[5] === Result.Success.code) { + if (this.requestParams.operate === 0) { + switch (this.requestParams.operate) { + case 0: + const addResult = await addFingerprintRequest({ + ...this.requestParams, + isCoerced: this.requestParams.isForce, + fingerRight: this.requestParams.isAdmin, + lockId: this.lockInfo.lockId, + fingerprintNumber: decrypted[6] * 256 + decrypted[7], + fingerprintUserNo: this.requestParams.fingerprintUserNo + }) + if (addResult.code === Result.Success.code) { + // 增加返回一个指纹序号 + addResult.data.fingerprintNumber = decrypted[6] * 256 + decrypted[7]; + } + // 触发指纹确认事件 + emitRegisterFingerprintConfirmEvent(addResult) + // 断开蓝牙连接 + await this.disconnectDevice() + break; + } } - // 触发指纹确认事件 - emitRegisterFingerprintConfirmEvent(addResult) - // 断开蓝牙连接 - await this.disconnectDevice() + } else { + emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[5])) + this.characteristicValueCallback(new Result(decrypted[5])) } + } else { emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[2])) this.characteristicValueCallback(new Result(decrypted[2])) @@ -1168,22 +1183,31 @@ export async function parsingCharacteristicValue(binaryData) { break; case subCmdIds.registerFaceConfirm: if (this.requestParams.operate === 0) { - const addResult = await addFaceRequest({ - ...this.requestParams, - isCoerced: this.requestParams.isForce, - fingerRight: this.requestParams.isAdmin, - lockId: this.lockInfo.lockId, - faceNumber: decrypted[6] * 256 + decrypted[7], - faceUserNo: this.requestParams.faceUserNo - }) - if (addResult.code === Result.Success.code) { - // 增加返回一个序号 - addResult.data.faceNumber = decrypted[6] * 256 + decrypted[7]; + if (decrypted[5] === Result.Success.code) { + switch (this.requestParams.operate) { + case 0: + const addResult = await addFaceRequest({ + ...this.requestParams, + isCoerced: this.requestParams.isForce, + fingerRight: this.requestParams.isAdmin, + lockId: this.lockInfo.lockId, + faceNumber: decrypted[6] * 256 + decrypted[7], + faceUserNo: this.requestParams.faceUserNo + }) + 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 { emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[2])) this.characteristicValueCallback(new Result(decrypted[2])) @@ -1235,26 +1259,31 @@ export async function parsingCharacteristicValue(binaryData) { case subCmdIds.registerPalmVeinConfirm: // 收到锁版回复判断操作类型进行对应api操作 if (decrypted[2] === Result.Success.code) { - switch (this.requestParams.operate) { - case 0: - // 注册 - const addResult = await addPalmVeinRequest({ - ...this.requestParams, - isCoerced: this.requestParams.isForce, - palmVeinRight: this.requestParams.isAdmin, - lockId: this.lockInfo.lockId, - palmVeinNumber: decrypted[6] * 256 + decrypted[7], - palmVeinUserNo: this.requestParams.palmVeinUserNo - }) - if (addResult.code === Result.Success.code) { - // 增加返回一个卡序号 - addResult.data.palmVeinNumber = decrypted[6] * 256 + decrypted[7]; - } - // 触发卡片确认事件 - emitRegisterPalmVeinConfirmEvent(addResult) - // 断开蓝牙连接 - await this.disconnectDevice() - break; + if (decrypted[5] === Result.Success.code) { + switch (this.requestParams.operate) { + case 0: + // 注册 + const addResult = await addPalmVeinRequest({ + ...this.requestParams, + isCoerced: this.requestParams.isForce, + palmVeinRight: this.requestParams.isAdmin, + lockId: this.lockInfo.lockId, + palmVeinNumber: decrypted[6] * 256 + decrypted[7], + palmVeinUserNo: this.requestParams.palmVeinUserNo + }) + if (addResult.code === Result.Success.code) { + // 增加返回一个卡序号 + addResult.data.palmVeinNumber = decrypted[6] * 256 + decrypted[7]; + } + // 触发卡片确认事件 + emitRegisterPalmVeinConfirmEvent(addResult) + // 断开蓝牙连接 + await this.disconnectDevice() + break; + } + } else { + emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[5])) + this.characteristicValueCallback(new Result(decrypted[5])) } } else { emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[2])) @@ -1305,27 +1334,33 @@ export async function parsingCharacteristicValue(binaryData) { case subCmdIds.registerRemoteConfirm: // 收到锁版回复判断操作类型进行对应api操作 if (decrypted[2] === Result.Success.code) { - switch (this.requestParams.operate) { - case 0: - // 注册 - const addResult = await addRemoteRequest({ - ...this.requestParams, - isCoerced: this.requestParams.isForce, - remoteRight: this.requestParams.isAdmin, - lockId: this.lockInfo.lockId, - remoteNumber: decrypted[6] * 256 + decrypted[7], - remoteUserNo: this.requestParams.remoteUserNo - }) - if (addResult.code === Result.Success.code) { - // 增加返回一个卡序号 - addResult.data.remoteNumber = decrypted[6] * 256 + decrypted[7]; - } - // 触发卡片确认事件 - emitRegisterRemoteConfirmEvent(addResult) - // 断开蓝牙连接 - await this.disconnectDevice() - break; + if (decrypted[5] === Result.Success.code) { + switch (this.requestParams.operate) { + case 0: + // 注册 + const addResult = await addRemoteRequest({ + ...this.requestParams, + isCoerced: this.requestParams.isForce, + remoteRight: this.requestParams.isAdmin, + lockId: this.lockInfo.lockId, + remoteNumber: decrypted[6] * 256 + decrypted[7], + remoteUserNo: this.requestParams.remoteUserNo + }) + if (addResult.code === Result.Success.code) { + // 增加返回一个卡序号 + addResult.data.remoteNumber = decrypted[6] * 256 + decrypted[7]; + } + // 触发卡片确认事件 + emitRegisterRemoteConfirmEvent(addResult) + // 断开蓝牙连接 + await this.disconnectDevice() + break; + } + } else { + emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[5])) + this.characteristicValueCallback(new Result(decrypted[5])) } + } else { emitRegisterCardConfirmEvent(new Result(Result.Fail.code, null, decrypted[2])) this.characteristicValueCallback(new Result(decrypted[2])) diff --git a/env.js b/env.js index 3fdcc18..6d05d5d 100644 --- a/env.js +++ b/env.js @@ -1,7 +1,7 @@ // uni版本号 -export const uniVersion = '1.0.17' +export const uniVersion = '1.0.18' // uni构建号 -export const uniBuildNumber = 18 +export const uniBuildNumber = 19 // web版本号 export const webVersion = '1.0.1' diff --git a/package.json b/package.json index 1c9cb65..359df6b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "star-cloud-uni", - "version": "1.0.15", + "version": "1.0.18", "type": "module", "main": "./uni/index.js", "author": "zzc059",