From 013ffcfbe81a8fd5c1613b38cd2aece82fe6b275 Mon Sep 17 00:00:00 2001 From: liyi Date: Fri, 18 Apr 2025 15:34:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E9=94=81=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3;=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=BB=8E=E6=9C=8D=E5=8A=A1=E5=99=A8=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=B7=AE=E5=B1=9E=E6=80=A7=E4=B8=BAundefined?= =?UTF-8?q?=E6=97=B6=E5=AF=BC=E8=87=B4=E5=90=8C=E6=AD=A5=E7=BB=99=E9=94=81?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E9=97=B4=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api.js | 16 +++++++++++++++- env.js | 4 ++-- package.json | 2 +- star-cloud/lock.js | 25 +++++++++++++++++++++++-- uni/index.js | 9 +++++++++ 5 files changed, 50 insertions(+), 6 deletions(-) diff --git a/api.js b/api.js index 60dd44b..eb704a2 100644 --- a/api.js +++ b/api.js @@ -778,4 +778,18 @@ export function updateLockSettingRequest(data) { method: 'POST', data }) -} \ No newline at end of file +} + +/** + * 获取名下锁列表 + * @param data.lockId 锁id + * @returns {Promise} + */ +export function getUserLockListRequest(data) { + return request({ + url: '/v1/lock/list', + method: 'POST', + data + }) +} + diff --git a/env.js b/env.js index 0afa5f8..550b534 100644 --- a/env.js +++ b/env.js @@ -1,7 +1,7 @@ // uni版本号 -export const uniVersion = '1.0.13' +export const uniVersion = '1.0.14' // uni构建号 -export const uniBuildNumber = 14 +export const uniBuildNumber = 15 // web版本号 export const webVersion = '1.0.1' diff --git a/package.json b/package.json index 72155fb..ec173c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "star-cloud-uni", - "version": "1.0.12", + "version": "1.0.14", "type": "module", "main": "./uni/index.js", "author": "zzc059", diff --git a/star-cloud/lock.js b/star-cloud/lock.js index d926751..39bd62c 100644 --- a/star-cloud/lock.js +++ b/star-cloud/lock.js @@ -2,7 +2,7 @@ import {sm4} from 'sm-crypto' import {cmdIds, Result} from '../constant' import {searchAndConnectDevice, writeBLECharacteristicValue} from '../uni/basic' import {createPackageEnd, md5Encrypt, timestampToArray, checkRequiredFields} from '../format' -import {getLockDetailRequest, getLockSettingDataRequest, remoteUnLockRequest} from '../api' +import {getLockDetailRequest, getLockSettingDataRequest, getUserLockListRequest, remoteUnLockRequest} from '../api' import {getStorage, setStorage} from '../export' import log from '../log' @@ -177,6 +177,10 @@ export async function openDoor(params) { const name = this.lockInfo.bluetooth.bluetoothDeviceName const uid = this.accountInfo.uid.toString() + + if (this.timeDifference === null || this.timeDifference === undefined) { + this.timeDifference = 0; + } const openTime = Math.ceil(new Date().getTime() / 1000) + this.timeDifference const length = 2 + 40 + 20 + 1 + 4 + 4 + 1 + 16 + 16 @@ -384,6 +388,21 @@ export async function remoteUnLock(params) { }) } +/** + * 获取名下锁列表 + * @param params + * @returns {Promise<*>} + */ +export async function getLockList(params) { + // 设置执行账号 + const result = await this.login(params.uid) + if (result.code !== Result.Success.code) { + return result + } + return await getUserLockListRequest(params); +} + + /** * 搜索wifi列表 * @param params @@ -433,4 +452,6 @@ export async function searchWifiList(params) { packageArray) return this.getWriteResult(this.searchWifiList, params) -} \ No newline at end of file +} + + diff --git a/uni/index.js b/uni/index.js index de6966d..170ce84 100644 --- a/uni/index.js +++ b/uni/index.js @@ -404,4 +404,13 @@ export const getRemoteList = async params => { */ export const remoteUnLock = async params => { return await starCloudInstance.remoteUnLock(params) +} + +/** + * 获取锁列表 + * @param params + * @returns {Promise<*>} + */ +export const getLockList = async params => { + return await starCloudInstance.getLockList(params) } \ No newline at end of file