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