feat: 1. 完成开门电量上报 2. 完成通知列表相关功能

This commit is contained in:
范鹏 2024-11-25 18:08:19 +08:00
parent 778172cf7f
commit 1d00c0f535
3 changed files with 37 additions and 3 deletions

View File

@ -123,4 +123,20 @@ await $starCloud.stopSearchDevice()
* @returns {Promise<Result>}
*/
const data = await $starCloud.bindDevice(params)
/**
* 移除坏锁
* @param params
* @param {AccountInfo} params.accountInfo 账号信息
* @param {List[int]} params.lockIds 锁Id列表
* @returns {Promise<Result>}
*/
const data = await $starCloud.removeBadLock(params)
/**
* 删除锁
* @param params
* @param {AccountInfo} params.accountInfo 账号信息
*/
const data = await $starCloud.deleteLock(params)
```

9
api.js
View File

@ -125,3 +125,12 @@ export function deleteLockRequest(data) {
data
})
}
// 删除锁
export function updateElectricQuantityRequest(data) {
return request({
url: '/v1/lock/updateElectricQuantity',
method: 'POST',
data
})
}

View File

@ -14,6 +14,7 @@ import {
getUserNoListRequest,
removeBadLockRequest,
starCloudCreateUser,
updateElectricQuantityRequest,
updateLockUserNoRequest,
updatePasswordRequest
} from '@/starCloud/api'
@ -1493,10 +1494,18 @@ export const useStarCloudStore = defineStore('starCloud', {
break
case cmdIds.openDoor:
this.updateLockInfo({
token: decrypted.slice(2, 6)
token: decrypted.slice(2, 6),
electricQuantity: decrypted[7],
electricQuantityStandby: decrypted[9]
})
console.log('开门', decrypted[6], this.lockInfo.token)
characteristicValueCallback(new Result(decrypted[6]))
if (decrypted[6] === Result.Success.code) {
updateElectricQuantityRequest({
lockId: this.lockInfo.lockId,
electricQuantity: decrypted[7],
electricQuantityStandby: decrypted[9]
})
}
characteristicValueCallback(new Result(decrypted[6], { lock: this.lockInfo }))
break
case cmdIds.resetDevice:
this.updateLockInfo({