feat:增加时间戳判断转换
This commit is contained in:
parent
6cee1c9dad
commit
bff152bedc
23
common.js
23
common.js
@ -787,6 +787,16 @@ export async function parsingCharacteristicValue(binaryData) {
|
|||||||
|
|
||||||
const cmdId = decrypted[0] * 256 + decrypted[1]
|
const cmdId = decrypted[0] * 256 + decrypted[1]
|
||||||
|
|
||||||
|
// 处理时间戳
|
||||||
|
if (this.requestParams.startDate) {
|
||||||
|
// 判断是否为秒级时间戳(10位)
|
||||||
|
this.requestParams.startDate = _convertToMilliseconds(this.requestParams.startDate)
|
||||||
|
}
|
||||||
|
if (this.requestParams.endDate) {
|
||||||
|
// 判断是否为秒级时间戳(10位)
|
||||||
|
this.requestParams.startDate = _convertToMilliseconds(this.requestParams.startDate)
|
||||||
|
}
|
||||||
|
|
||||||
switch (cmdId) {
|
switch (cmdId) {
|
||||||
case cmdIds.getLockStatus:
|
case cmdIds.getLockStatus:
|
||||||
if (decrypted[2] === Result.Success.code) {
|
if (decrypted[2] === Result.Success.code) {
|
||||||
@ -1082,7 +1092,7 @@ export async function parsingCharacteristicValue(binaryData) {
|
|||||||
})
|
})
|
||||||
if (addResult.code === Result.Success.code) {
|
if (addResult.code === Result.Success.code) {
|
||||||
// 增加返回一个指纹序号
|
// 增加返回一个指纹序号
|
||||||
addResult.data.fingerprintNumber = decrypted[6] * 256 + decrypted[7];
|
addResult.data.fingerprintNumber = decrypted[6] * 256 + decrypted[7];
|
||||||
}
|
}
|
||||||
console.log('registerFingerprintConfirm', decrypted)
|
console.log('registerFingerprintConfirm', decrypted)
|
||||||
// 触发指纹确认事件
|
// 触发指纹确认事件
|
||||||
@ -1416,3 +1426,14 @@ export function createPackageHeader(encryptionType, originalLength) {
|
|||||||
export async function disconnectDevice() {
|
export async function disconnectDevice() {
|
||||||
return await closeBLEConnection(this.lockInfo.deviceId)
|
return await closeBLEConnection(this.lockInfo.deviceId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于判断时间戳是否是秒级别的,如果是的话则补充到毫秒级别
|
||||||
|
* @param timestamp 时间戳
|
||||||
|
* @returns {number|*}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
export function _convertToMilliseconds(timestamp) {
|
||||||
|
if (!timestamp) return timestamp;
|
||||||
|
return timestamp.toString().length === 10 ? timestamp * 1000 : timestamp;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user