feat:增加获取锁列表接口;修复从服务器获取的时差属性为undefined时导致同步给锁的时间错误
This commit is contained in:
parent
7eff56b2a0
commit
013ffcfbe8
16
api.js
16
api.js
@ -778,4 +778,18 @@ export function updateLockSettingRequest(data) {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取名下锁列表
|
||||||
|
* @param data.lockId 锁id
|
||||||
|
* @returns {Promise<unknown>}
|
||||||
|
*/
|
||||||
|
export function getUserLockListRequest(data) {
|
||||||
|
return request({
|
||||||
|
url: '/v1/lock/list',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
4
env.js
4
env.js
@ -1,7 +1,7 @@
|
|||||||
// uni版本号
|
// uni版本号
|
||||||
export const uniVersion = '1.0.13'
|
export const uniVersion = '1.0.14'
|
||||||
// uni构建号
|
// uni构建号
|
||||||
export const uniBuildNumber = 14
|
export const uniBuildNumber = 15
|
||||||
|
|
||||||
// web版本号
|
// web版本号
|
||||||
export const webVersion = '1.0.1'
|
export const webVersion = '1.0.1'
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "star-cloud-uni",
|
"name": "star-cloud-uni",
|
||||||
"version": "1.0.12",
|
"version": "1.0.14",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./uni/index.js",
|
"main": "./uni/index.js",
|
||||||
"author": "zzc059",
|
"author": "zzc059",
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import {sm4} from 'sm-crypto'
|
|||||||
import {cmdIds, Result} from '../constant'
|
import {cmdIds, Result} from '../constant'
|
||||||
import {searchAndConnectDevice, writeBLECharacteristicValue} from '../uni/basic'
|
import {searchAndConnectDevice, writeBLECharacteristicValue} from '../uni/basic'
|
||||||
import {createPackageEnd, md5Encrypt, timestampToArray, checkRequiredFields} from '../format'
|
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 {getStorage, setStorage} from '../export'
|
||||||
import log from '../log'
|
import log from '../log'
|
||||||
|
|
||||||
@ -177,6 +177,10 @@ export async function openDoor(params) {
|
|||||||
|
|
||||||
const name = this.lockInfo.bluetooth.bluetoothDeviceName
|
const name = this.lockInfo.bluetooth.bluetoothDeviceName
|
||||||
const uid = this.accountInfo.uid.toString()
|
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 openTime = Math.ceil(new Date().getTime() / 1000) + this.timeDifference
|
||||||
|
|
||||||
const length = 2 + 40 + 20 + 1 + 4 + 4 + 1 + 16 + 16
|
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列表
|
* 搜索wifi列表
|
||||||
* @param params
|
* @param params
|
||||||
@ -433,4 +452,6 @@ export async function searchWifiList(params) {
|
|||||||
packageArray)
|
packageArray)
|
||||||
|
|
||||||
return this.getWriteResult(this.searchWifiList, params)
|
return this.getWriteResult(this.searchWifiList, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -404,4 +404,13 @@ export const getRemoteList = async params => {
|
|||||||
*/
|
*/
|
||||||
export const remoteUnLock = async params => {
|
export const remoteUnLock = async params => {
|
||||||
return await starCloudInstance.remoteUnLock(params)
|
return await starCloudInstance.remoteUnLock(params)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取锁列表
|
||||||
|
* @param params
|
||||||
|
* @returns {Promise<*>}
|
||||||
|
*/
|
||||||
|
export const getLockList = async params => {
|
||||||
|
return await starCloudInstance.getLockList(params)
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user