From 2f97d501d805934c2c166c6449f8f5963df94b73 Mon Sep 17 00:00:00 2001 From: liyi Date: Mon, 7 Apr 2025 11:18:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E8=B0=83=E6=8D=A2=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=88=B3=E5=A4=84=E7=90=86=E5=87=BD=E6=95=B0=E3=80=81=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=AE=BE=E7=BD=AE=E5=AF=86=E7=A0=81=E6=97=B6=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=AF=86=E7=A0=81=E7=9A=84=E6=93=8D=E4=BD=9C=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common.js | 12 ++---------- star-cloud/generalExtend.js | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/common.js b/common.js index 593c6df..fd3fc14 100644 --- a/common.js +++ b/common.js @@ -787,15 +787,7 @@ export async function parsingCharacteristicValue(binaryData) { 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) { case cmdIds.getLockStatus: @@ -907,7 +899,7 @@ export async function parsingCharacteristicValue(binaryData) { new Result(updateResult.code, updateResult.data, updateResult.message) ) } - } else if (this.requestParams.operate === 3) { + } else if (this.requestParams.operate === 2 || this.requestParams.operate === 3) { const deleteResult = await deletePasswordRequest(this.requestParams) if (deleteResult.code === Result.Success.code) { this.characteristicValueCallback(new Result(deleteResult.code)) diff --git a/star-cloud/generalExtend.js b/star-cloud/generalExtend.js index 38c4887..539354b 100644 --- a/star-cloud/generalExtend.js +++ b/star-cloud/generalExtend.js @@ -14,6 +14,7 @@ import { getIcCardListRequest, getPalmVeinListRequest, getRemoteListRequest, updateIcCardRequest } from "../api.js"; +import {_convertToMilliseconds} from "../common.js"; /** @@ -305,6 +306,23 @@ export async function registerExtendedProducts(params) { this.requestParams = params + // 处理时间戳 + 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); + } + } + startDate = Math.floor(startDate / 1000) endDate = Math.floor(endDate / 1000)