From db607aa35a52ed018d99f04be26bfca873e34001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E9=B9=8F?= Date: Tue, 11 Feb 2025 15:45:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=93=8D=E4=BD=9C=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/record.js | 48 ++ pages.json | 21 + pages/adminDetail/adminDetail.vue | 16 +- pages/bindFace/bindFace.vue | 1 + pages/bindFingerprint/bindFingerprint.vue | 1 + pages/bindPalmVein/bindPalmVein.vue | 1 + pages/cardDetail/cardDetail.vue | 18 +- pages/faceDetail/faceDetail.vue | 19 +- pages/fingerprintDetail/fingerprintDetail.vue | 19 +- pages/keyDetail/keyDetail.vue | 16 +- pages/lockDetail/lockDetail.vue | 12 +- pages/palmVeinDetail/palmVeinDetail.vue | 18 +- pages/passwordDetail/passwordDetail.vue | 16 +- pages/recordDetail/recordDetail.vue | 32 ++ pages/recordList/recordList.vue | 448 ++++++++++++++++++ pages/remoteDetail/remoteDetail.vue | 18 +- pages/typeRecordList/typeRecordList.vue | 272 +++++++++++ static/images/icon_sync.png | Bin 0 -> 923 bytes static/images/img.png | Bin 0 -> 1562 bytes stores/basic.js | 15 + stores/bluetooth.js | 160 ++++++- 21 files changed, 1136 insertions(+), 15 deletions(-) create mode 100644 api/record.js create mode 100644 pages/recordDetail/recordDetail.vue create mode 100644 pages/recordList/recordList.vue create mode 100644 pages/typeRecordList/typeRecordList.vue create mode 100644 static/images/icon_sync.png create mode 100644 static/images/img.png diff --git a/api/record.js b/api/record.js new file mode 100644 index 0000000..a7c5fd3 --- /dev/null +++ b/api/record.js @@ -0,0 +1,48 @@ +import request from '../utils/request' + +// record 记录模块 + +// 获取事件记录列表 +export function getEventRecordListRequest(data) { + return request({ + url: '/lockRecords/lockEventList', + method: 'POST', + data + }) +} + +// 获取操作记录列表 +export function getRecordListRequest(data) { + return request({ + url: '/lockRecords/list', + method: 'POST', + data + }) +} + +// 清空操作记录 +export function clearRecordRequest(data) { + return request({ + url: '/lockRecords/clear', + method: 'POST', + data + }) +} + +// 查询最后一条记录时间 +export function getLastRecordTimeRequest(data) { + return request({ + url: '/lockRecords/getLastRecordTime', + method: 'POST', + data + }) +} + +// 锁记录上传 +export function uploadRecordRequest(data) { + return request({ + url: '/lockRecords/fromLock', + method: 'POST', + data + }) +} diff --git a/pages.json b/pages.json index f57c9d0..ff05c2b 100644 --- a/pages.json +++ b/pages.json @@ -302,6 +302,27 @@ "navigationBarTitleText": "授权管理员", "disableScroll": true } + }, + { + "path": "pages/recordList/recordList", + "style": { + "navigationBarTitleText": "操作记录", + "disableScroll": true + } + }, + { + "path": "pages/recordDetail/recordDetail", + "style": { + "navigationBarTitleText": "操作记录详情", + "disableScroll": true + } + }, + { + "path": "pages/typeRecordList/typeRecordList", + "style": { + "navigationBarTitleText": "操作记录", + "disableScroll": true + } } ], "globalStyle": { diff --git a/pages/adminDetail/adminDetail.vue b/pages/adminDetail/adminDetail.vue index e126d56..d16d1c6 100644 --- a/pages/adminDetail/adminDetail.vue +++ b/pages/adminDetail/adminDetail.vue @@ -25,7 +25,10 @@ 发送时间 {{ timeFormat(info.sendDate, 'yyyy-mm-dd h:M') }} - + + 操作记录 + + 删除 { + $basic.routeJump({ + name: 'typeRecordList', + params: { + name: info.value.keyName, + key: 'keyId', + id: info.value.keyId + } + }) + } + const confirmModal = async () => { uni.showLoading({ title: '删除中', diff --git a/pages/bindFace/bindFace.vue b/pages/bindFace/bindFace.vue index 51837ab..a717da0 100644 --- a/pages/bindFace/bindFace.vue +++ b/pages/bindFace/bindFace.vue @@ -55,6 +55,7 @@ endDate: params.value.endDate, faceName: params.value.faceName, faceNumber: String(data.faceNumber), + faceUserNo: String(data.faceNumber), faceType: params.value.faceType, addType: 1, fingerRight: params.value.isAdmin, diff --git a/pages/bindFingerprint/bindFingerprint.vue b/pages/bindFingerprint/bindFingerprint.vue index 4fd79bb..5764617 100644 --- a/pages/bindFingerprint/bindFingerprint.vue +++ b/pages/bindFingerprint/bindFingerprint.vue @@ -59,6 +59,7 @@ endDate: params.endDate, fingerprintName: params.fingerprintName, fingerprintNumber: String(data.fingerprintNumber), + fingerprintUserNo: String(data.fingerprintNumber), fingerprintType: params.fingerprintType, addType: 1, fingerRight: params.isAdmin, diff --git a/pages/bindPalmVein/bindPalmVein.vue b/pages/bindPalmVein/bindPalmVein.vue index 96b0465..48680b4 100644 --- a/pages/bindPalmVein/bindPalmVein.vue +++ b/pages/bindPalmVein/bindPalmVein.vue @@ -53,6 +53,7 @@ endDate: params.endDate, palmVeinName: params.palmVeinName, palmVeinNumber: String(data.palmVeinNumber), + palmVeinUserNo: String(data.palmVeinNumber), palmVeinType: params.palmVeinType, addType: 1, palmVeinRight: params.isAdmin, diff --git a/pages/cardDetail/cardDetail.vue b/pages/cardDetail/cardDetail.vue index e5ad46d..f8038c1 100644 --- a/pages/cardDetail/cardDetail.vue +++ b/pages/cardDetail/cardDetail.vue @@ -39,7 +39,10 @@ 添加时间 {{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }} - + + 操作记录 + + 删除 @@ -50,11 +53,13 @@ import { onLoad } from '@dcloudio/uni-app' import { timeFormat } from 'uview-plus' import { useLockStore } from '@/stores/lock' + import { useBasicStore } from '@/stores/basic' const instance = getCurrentInstance().proxy const eventChannel = instance.getOpenerEventChannel() const $lock = useLockStore() + const $basic = useBasicStore() const info = ref(null) @@ -65,6 +70,17 @@ } }) + const toRecordList = async () => { + $basic.routeJump({ + name: 'typeRecordList', + params: { + name: info.value.cardName, + key: 'cardId', + id: info.value.cardId + } + }) + } + const deletePassword = async () => { eventChannel.emit('delete', {}) } diff --git a/pages/faceDetail/faceDetail.vue b/pages/faceDetail/faceDetail.vue index 7fdcf3d..df2e70c 100644 --- a/pages/faceDetail/faceDetail.vue +++ b/pages/faceDetail/faceDetail.vue @@ -39,7 +39,10 @@ 添加时间 {{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }} - + + 操作记录 + + 删除 @@ -50,21 +53,33 @@ import { onLoad } from '@dcloudio/uni-app' import { timeFormat } from 'uview-plus' import { useLockStore } from '@/stores/lock' + import { useBasicStore } from '@/stores/basic' const instance = getCurrentInstance().proxy const eventChannel = instance.getOpenerEventChannel() const $lock = useLockStore() + const $basic = useBasicStore() const info = ref(null) onLoad(options => { if (options.info) { info.value = JSON.parse(options.info) - console.log(info.value) } }) + const toRecordList = async () => { + $basic.routeJump({ + name: 'typeRecordList', + params: { + name: info.value.faceName, + key: 'faceId', + id: info.value.faceId + } + }) + } + const deletePassword = async () => { eventChannel.emit('delete', {}) } diff --git a/pages/fingerprintDetail/fingerprintDetail.vue b/pages/fingerprintDetail/fingerprintDetail.vue index 2246aa2..4e3ad61 100644 --- a/pages/fingerprintDetail/fingerprintDetail.vue +++ b/pages/fingerprintDetail/fingerprintDetail.vue @@ -39,7 +39,10 @@ 添加时间 {{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }} - + + 操作记录 + + 删除 @@ -50,6 +53,9 @@ import { onLoad } from '@dcloudio/uni-app' import { timeFormat } from 'uview-plus' import { useLockStore } from '@/stores/lock' + import { useBasicStore } from '@/stores/basic' + + const $basic = useBasicStore() const instance = getCurrentInstance().proxy const eventChannel = instance.getOpenerEventChannel() @@ -58,6 +64,17 @@ const info = ref(null) + const toRecordList = async () => { + $basic.routeJump({ + name: 'typeRecordList', + params: { + name: info.value.fingerprintName, + key: 'fingerprintId', + id: info.value.fingerprintId + } + }) + } + onLoad(options => { if (options.info) { info.value = JSON.parse(options.info) diff --git a/pages/keyDetail/keyDetail.vue b/pages/keyDetail/keyDetail.vue index 4a7b498..131ceae 100644 --- a/pages/keyDetail/keyDetail.vue +++ b/pages/keyDetail/keyDetail.vue @@ -45,6 +45,10 @@ 发送时间 {{ timeFormat(currentKeyInfo.sendDate, 'yyyy-mm-dd h:M') }} + + 操作记录 + + 删除 授权管理员 - + 操作记录 @@ -196,7 +196,8 @@ ...mapActions(useBluetoothStore, [ 'openDoor', 'updateServerTimestamp', - 'closeBluetoothConnection' + 'closeBluetoothConnection', + 'syncRecord' ]), ...mapActions(useBasicStore, ['routeJump', 'backAndToast', 'getNetworkType']), closePopup() { @@ -285,7 +286,12 @@ openTime: parseInt(new Date().getTime() / 1000, 10) + this.time, onlineToken: this.onlineToken }) - this.closeBluetoothConnection() + this.syncRecord({ + keyId: this.currentLockInfo.toString(), + uid: this.userInfo.uid.toString() + }).then(() => { + this.closeBluetoothConnection() + }) if (type === 'open') { uni.reportEvent('open_door', { result: code, diff --git a/pages/palmVeinDetail/palmVeinDetail.vue b/pages/palmVeinDetail/palmVeinDetail.vue index 7ba2db4..e68de89 100644 --- a/pages/palmVeinDetail/palmVeinDetail.vue +++ b/pages/palmVeinDetail/palmVeinDetail.vue @@ -39,7 +39,10 @@ 添加时间 {{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }} - + + 操作记录 + + 删除 @@ -50,11 +53,13 @@ import { onLoad } from '@dcloudio/uni-app' import { timeFormat } from 'uview-plus' import { useLockStore } from '@/stores/lock' + import { useBasicStore } from '@/stores/basic' const instance = getCurrentInstance().proxy const eventChannel = instance.getOpenerEventChannel() const $lock = useLockStore() + const $basic = useBasicStore() const info = ref(null) @@ -65,6 +70,17 @@ } }) + const toRecordList = async () => { + $basic.routeJump({ + name: 'typeRecordList', + params: { + name: info.value.palmVeinName, + key: 'palmVeinId', + id: info.value.palmVeinId + } + }) + } + const deletePassword = async () => { eventChannel.emit('delete', {}) } diff --git a/pages/passwordDetail/passwordDetail.vue b/pages/passwordDetail/passwordDetail.vue index e39bbe5..734e9eb 100644 --- a/pages/passwordDetail/passwordDetail.vue +++ b/pages/passwordDetail/passwordDetail.vue @@ -33,6 +33,10 @@ timeFormat(currentPasswordInfo.sendDate, 'yyyy-mm-dd h:M') }} + + 操作记录 + + 删除 @@ -59,7 +63,17 @@ timeFormat, ...mapActions(useBluetoothStore, ['setLockPassword', 'closeBluetoothConnection']), ...mapActions(useLockStore, ['updatePasswordSearch', 'getPasswordList']), - ...mapActions(useBasicStore, ['backAndToast', 'getNetworkType']), + ...mapActions(useBasicStore, ['backAndToast', 'getNetworkType', 'routeJump']), + async toRecordList() { + this.routeJump({ + name: 'typeRecordList', + params: { + name: this.currentPasswordInfo.keyboardPwdName, + key: 'keyboardPwdId', + id: this.currentPasswordInfo.keyboardPwdId + } + }) + }, async deletePassword() { const netWork = await this.getNetworkType() if (!netWork) { diff --git a/pages/recordDetail/recordDetail.vue b/pages/recordDetail/recordDetail.vue new file mode 100644 index 0000000..2079ffe --- /dev/null +++ b/pages/recordDetail/recordDetail.vue @@ -0,0 +1,32 @@ + + + + + diff --git a/pages/recordList/recordList.vue b/pages/recordList/recordList.vue new file mode 100644 index 0000000..2ecd987 --- /dev/null +++ b/pages/recordList/recordList.vue @@ -0,0 +1,448 @@ + + + + + + + diff --git a/pages/remoteDetail/remoteDetail.vue b/pages/remoteDetail/remoteDetail.vue index 3ae130f..ca9b62f 100644 --- a/pages/remoteDetail/remoteDetail.vue +++ b/pages/remoteDetail/remoteDetail.vue @@ -39,7 +39,10 @@ 添加时间 {{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }} - + + 操作记录 + + 删除 @@ -50,11 +53,13 @@ import { onLoad } from '@dcloudio/uni-app' import { timeFormat } from 'uview-plus' import { useLockStore } from '@/stores/lock' + import { useBasicStore } from '@/stores/basic' const instance = getCurrentInstance().proxy const eventChannel = instance.getOpenerEventChannel() const $lock = useLockStore() + const $basic = useBasicStore() const info = ref(null) @@ -65,6 +70,17 @@ } }) + const toRecordList = async () => { + $basic.routeJump({ + name: 'typeRecordList', + params: { + name: info.value.remoteName, + key: 'remoteId', + id: info.value.remoteId + } + }) + } + const deletePassword = async () => { eventChannel.emit('delete', {}) } diff --git a/pages/typeRecordList/typeRecordList.vue b/pages/typeRecordList/typeRecordList.vue new file mode 100644 index 0000000..93a9a72 --- /dev/null +++ b/pages/typeRecordList/typeRecordList.vue @@ -0,0 +1,272 @@ + + + + + + + diff --git a/static/images/icon_sync.png b/static/images/icon_sync.png new file mode 100644 index 0000000000000000000000000000000000000000..0473a4030450a738d4d693c25b1f40b1e42319c9 GIT binary patch literal 923 zcmV;M17!S(P)5g+pNh zcESP(cmWP%0k-k}*K`9ZkwKDwa;G!xO!U;^@yF4TEEsb7#3%kjO!_}I*HU@!hj+JE zt$)Nu_$pQ+{VTfV|GrR3>w^%BAV26r`4CR8NT*BOS0TZ!63Pg*IwsMspn^28ghGN3 zqx&{?ezy>A>4h~JPVl+k#p906Q9}JB(Q)_tu+JMp*i{qX+R7i|2=HR_Rm2j8&`<`D z@cIKsLn%NKT3$l!_u(+WY&qDR92^#97XU8-XMD%DoZ4&&^8#>JIo+fRTA_(Z_(A{) zClhjrNH{vCVQG9`ghbQL*zMQGO}UENhyg%=PGEDW835?BP}`)78sQbV$mGx>0Ll;m zHr33Uyn%pPrTTz28Oq>Ayo!$QRRf6{JW`T?Dg;>8g4l5h>gZEPfryhSpa=#1HewO5Su#!U*59+)qsWsz-3zi=%~wc z3UDt5@N>gZT>I02+P@8Goz4Nc$gM5Z8v&X$;92-41@LSK;&;D}1ZWnpN>B^{QWG2i z=3N}nMO%2{02MeB1-K9(NPtbA0n#oo#}xwby2u8gSs4YiXuo4lnau@QCkq0Bqo3?V_J0EQ5$1A^0`g9t!Y>RZ)_36l6gK_1v4{D$R*mo}RRXkOk;{m!R$ zCIB7T1>k-?O>liCCYoc0&OmShfL+9;8uVemVgQyqvhIR9&@Aeb5}*hA>E*x2MoJpM4_}oFaJ__G2?=2zxc(|7v^nPj zu6QkBU;YQ_m6T9!gBx@`P18+EDReo3KZE6jYe^P3Y=IXe(GHg~ xE6)esCQ!8k66s7y`k$VD1#Gm|&!!o9iglr_4FQ1U4LGg3}DF8#R*{sz3l^ z?nN62CovHrC=tw^$q_~c>sQkt@C0Hw;Q))Vw?U}j2|5-u3mM>`5mx~pbL0WN9g(3K z+gt*n0uuOpOuV|7EcymrEeC$MxWex#*&G(U8*K;#jZ7Q?lPH6rX5>|F!w9`}n$M0j zO3s8Vw}jbSr50}+Ml1r8v^*$D<{pUZJ!^P=x0Uru(hvHgL(~2{z7RN(#if5N!~jL}hr# zqgxcp3rH>VZz4emr1+-V2qfr2lCDc;3cq-S$Obpc%y4L>Kx{C~F3>l&4WxfQju#GD za&bsLg+u*Cf)2k*wsWK0=4s57Z{$=+fLlrGGF+51Dx}kWaGAeW`lTL?*hU2mdq^Z> z)6CO0r(PP66lvHD2NV7^FWq>CQEG%h%-kTE?CMX=Pj~JJ%^qGMnjWfA>{`t5(=#TL zT{z&z`GK8U?Pk(5WPZ$$yJLIscm3Y@6RMpWGpqVpLEVPu94@gDsh2RazU$sC%-wqQ z%HKFhh6hp`ac$Io9l2DP!lhmcvAU{ppDEE3zA=o3s+BKrZ9PzKzj?_yHfp9hl#Aka;nJ%qI(0) zt_g2$4VM%Cf3}zfuAslazYpcXAWM}WNIR@utE2`#p*fykNl8RX@F^WI)NTgSi5ktQ zm7>-AZ~hwFs)D}d*_I*5F$Cy{aHJ;aLD>HW7%tvQNsge%(9P2SapX)en52h$t3Pt3 zQX+t6kDac;h0lG7B7vrOu{?3D%SD|V++q!ZfjMQ&oO(av5nmks2kstRoY;qig#Z8m M07*qoM6N<$f}%3hE&u=k literal 0 HcmV?d00001 diff --git a/stores/basic.js b/stores/basic.js index b561d81..b5a94fc 100644 --- a/stores/basic.js +++ b/stores/basic.js @@ -226,6 +226,21 @@ const pages = [ name: 'adminList', path: '/pages/adminList/adminList', tabBar: false + }, + { + name: 'recordList', + path: '/pages/recordList/recordList', + tabBar: false + }, + { + name: 'recordDetail', + path: '/pages/recordDetail/recordDetail', + tabBar: false + }, + { + name: 'typeRecordList', + path: '/pages/typeRecordList/typeRecordList', + tabBar: false } ] diff --git a/stores/bluetooth.js b/stores/bluetooth.js index b55e1ce..c223b7f 100644 --- a/stores/bluetooth.js +++ b/stores/bluetooth.js @@ -12,6 +12,7 @@ import { reportOpenDoorRequest } from '@/api/lockRecords' import { updateTimezoneOffsetRequest } from '@/api/user' import log from '@/utils/log' import { useUserStore } from '@/stores/user' +import { getLastRecordTimeRequest, uploadRecordRequest } from '@/api/record' // 定时器 let timer @@ -81,7 +82,9 @@ const subCmdIds = { // 注册掌纹确认 registerPalmVeinConfirm: 43, // 注册掌纹取消 - registerPalmVeinCancel: 44 + registerPalmVeinCancel: 44, + // 同步操作记录 + syncRecord: 41 } export const useBluetoothStore = defineStore('ble', { @@ -264,7 +267,7 @@ export const useBluetoothStore = defineStore('ble', { }) }, // 解析特征值 - parsingCharacteristicValue(binaryData) { + async parsingCharacteristicValue(binaryData) { const $user = useUserStore() const that = this // 0x20 明文 0x22 SM4(事先约定密钥) 0x23 SM4(设备指定密钥) @@ -375,7 +378,6 @@ export const useBluetoothStore = defineStore('ble', { break case cmdIds.expandCmd: const subCmdId = decrypted[3] - // eslint-disable-next-line default-case switch (subCmdId) { case subCmdIds.resetLockPassword: that.updateCurrentLockInfo({ @@ -473,6 +475,37 @@ export const useBluetoothStore = defineStore('ble', { process: decrypted[6] }) break + case subCmdIds.syncRecord: + if (decrypted[2] === 0 && decrypted[6] > 0) { + const records = [] + const count = decrypted[6] || 0 + for (let i = 0; i < count; i++) { + let password = decrypted.slice(14 + 17 * i, 14 + 17 * i + 10) + if (password.every(item => item === 0)) { + password = null + } else { + password = this.uint8ArrayToString(password) + } + const record = { + type: decrypted[7 + 17 * i], + user: decrypted[8 + 17 * i] * 256 + decrypted[9 + 17 * i], + date: this.arrayToTimestamp(decrypted.slice(10 + 17 * i, 14 + 17 * i)) * 1000, + success: 1, + password + } + records.push(record) + } + const { code, message } = await uploadRecordRequest({ + records, + lockId: this.currentLockInfo.lockId + }) + characteristicValueCallback({ code, data: { count }, message }) + } else { + characteristicValueCallback({ code: decrypted[2] }) + } + break + default: + break } break case cmdIds.openDoor: @@ -2454,6 +2487,127 @@ export const useBluetoothStore = defineStore('ble', { await this.writeBLECharacteristicValue(packageArray) return this.getWriteResult(this.registerAuthenticationCancel, data) + }, + // 获取操作记录 + async syncRecord(params) { + const { uid, keyId } = params + + const { code, data, message } = await this.syncSingleRecord({ + uid, + keyId + }) + + if (code === 0) { + if (data?.count === 10) { + return await this.syncSingleRecord({ + uid, + keyId + }) + } + return { code, data, message } + } + return { code, data, message } + }, + // 获取单次操作记录 + async syncSingleRecord(data) { + // 确认蓝牙状态正常 + if (this.bluetoothStatus !== 0) { + console.log('写入未执行', this.bluetoothStatus) + this.getBluetoothStatus() + return { + code: -1 + } + } + + // 确认设备连接正常 + if (!this.currentLockInfo.connected) { + const searchResult = await this.searchAndConnectDevice() + if (searchResult.code !== 0) { + return searchResult + } + this.updateCurrentLockInfo({ + ...this.currentLockInfo, + deviceId: searchResult.data.deviceId + }) + console.log('设备ID:', this.currentLockInfo.deviceId) + const result = await this.connectBluetoothDevice() + console.log('连接结果', result) + if (!result) { + return { + code: -1 + } + } + } + + // 检查是否已添加为用户 + const checkResult = await this.checkLockUser() + if (!checkResult) { + return { + code: -1 + } + } + + const { keyId, uid } = data + + const logsCount = 10 + + const timeResult = await getLastRecordTimeRequest({ + lockId: this.currentLockInfo.lockId + }) + + if (timeResult.code !== 0) { + return timeResult + } + + const operateDate = Math.ceil(timeResult.data.operateDate / 1000) + const currentDate = Math.ceil(timeResult.data.currentDate / 1000) + + const length = 2 + 1 + 1 + 40 + 20 + 2 + 4 + 4 + 1 + 16 + const headArray = this.createPackageHeader(3, length) + + const contentArray = new Uint8Array(length) + contentArray[0] = cmdIds.expandCmd / 256 + contentArray[1] = cmdIds.expandCmd % 256 + + // 子命令 + contentArray[2] = subCmdIds.syncRecord + + contentArray[3] = length - 3 + + for (let i = 0; i < keyId.length; i++) { + contentArray[i + 4] = keyId.charCodeAt(i) + } + + for (let i = 0; i < uid.length; i++) { + contentArray[i + 44] = uid.charCodeAt(i) + } + + contentArray[64] = logsCount / 256 + contentArray[65] = logsCount % 256 + + contentArray.set(this.timestampToArray(operateDate), 66) + contentArray.set(this.timestampToArray(currentDate), 70) + + contentArray[74] = 16 + + const md5Array = this.md5Encrypte( + uid + keyId, + this.currentLockInfo.token || new Uint8Array([0, 0, 0, 0]), + this.currentLockInfo.bluetooth.publicKey + ) + + contentArray.set(md5Array, 75) + + const cebArray = sm4.encrypt(contentArray, this.currentLockInfo.bluetooth.privateKey, { + mode: 'ecb', + output: 'array' + }) + + const packageArray = this.createPackageEnd(headArray, cebArray) + + await this.writeBLECharacteristicValue(packageArray) + + return this.getWriteResult(this.syncSingleRecord, data) } } })