From f96e88b17bc5ef82f535ee9f680cd93ac3a6e39d Mon Sep 17 00:00:00 2001 From: iven Date: Sat, 30 May 2026 22:56:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(mp):=20=E6=A3=80=E6=9F=A5=20VPDeviceAck=20?= =?UTF-8?q?=E8=80=8C=E9=9D=9E=20VPDevicepassword=20=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E8=AE=A4=E8=AF=81=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SDK 认证回调结构: - VPDevicepassword = "0000"(设备密码原始值,不是认证状态) - VPDeviceAck = "successfulVerification"(认证结果) 之前代码错误检查 VPDevicepassword 的值,永远不匹配, 导致认证成功但代码未识别 → 超时。 同时修复 deviceChipStatus 轮询:SDK 可能写入布尔值 true 而非字符串。 --- apps/miniprogram/native/pkg-veepoo/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/miniprogram/native/pkg-veepoo/index.js b/apps/miniprogram/native/pkg-veepoo/index.js index 0938116..a66516e 100644 --- a/apps/miniprogram/native/pkg-veepoo/index.js +++ b/apps/miniprogram/native/pkg-veepoo/index.js @@ -241,7 +241,8 @@ Page({ try { // eslint-disable-next-line no-undef var status = wx.getStorageSync('deviceChipStatus'); - if (status === 'successfulVerification' || status === 'passTheVerification') { + // SDK 可能写入字符串或布尔值 true + if (status === 'successfulVerification' || status === 'passTheVerification' || status === true) { clearInterval(self._authTimer); self._authTimer = null; self._onReady(); @@ -279,10 +280,12 @@ Page({ var type = data.type; if (type === SDK_EVENT_AUTH) { - var password = (data.content || {}).VPDevicepassword; + var content = data.content || {}; // eslint-disable-next-line no-undef - console.log('[veepoo-native] 认证事件: VPDevicepassword=' + password); - if (password === 'passTheVerification' || password === 'successfulVerification') { + console.log('[veepoo-native] 认证事件: VPDeviceAck=' + content.VPDeviceAck + ' VPDevicepassword=' + content.VPDevicepassword); + // VPDeviceAck 是认证结果(successfulVerification/passTheVerification) + // VPDevicepassword 是设备密码原始值(如 "0000"),不是认证结果 + if (content.VPDeviceAck === 'successfulVerification' || content.VPDeviceAck === 'passTheVerification') { if (this._authTimer) { clearInterval(this._authTimer); this._authTimer = null; } if (this._authTimeout) { clearTimeout(this._authTimeout); this._authTimeout = null; } this._onReady();