fix(mp): 检查 VPDeviceAck 而非 VPDevicepassword 判断认证结果
SDK 认证回调结构: - VPDevicepassword = "0000"(设备密码原始值,不是认证状态) - VPDeviceAck = "successfulVerification"(认证结果) 之前代码错误检查 VPDevicepassword 的值,永远不匹配, 导致认证成功但代码未识别 → 超时。 同时修复 deviceChipStatus 轮询:SDK 可能写入布尔值 true 而非字符串。
This commit is contained in:
@@ -241,7 +241,8 @@ Page({
|
|||||||
try {
|
try {
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
var status = wx.getStorageSync('deviceChipStatus');
|
var status = wx.getStorageSync('deviceChipStatus');
|
||||||
if (status === 'successfulVerification' || status === 'passTheVerification') {
|
// SDK 可能写入字符串或布尔值 true
|
||||||
|
if (status === 'successfulVerification' || status === 'passTheVerification' || status === true) {
|
||||||
clearInterval(self._authTimer);
|
clearInterval(self._authTimer);
|
||||||
self._authTimer = null;
|
self._authTimer = null;
|
||||||
self._onReady();
|
self._onReady();
|
||||||
@@ -279,10 +280,12 @@ Page({
|
|||||||
var type = data.type;
|
var type = data.type;
|
||||||
|
|
||||||
if (type === SDK_EVENT_AUTH) {
|
if (type === SDK_EVENT_AUTH) {
|
||||||
var password = (data.content || {}).VPDevicepassword;
|
var content = data.content || {};
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
console.log('[veepoo-native] 认证事件: VPDevicepassword=' + password);
|
console.log('[veepoo-native] 认证事件: VPDeviceAck=' + content.VPDeviceAck + ' VPDevicepassword=' + content.VPDevicepassword);
|
||||||
if (password === 'passTheVerification' || password === 'successfulVerification') {
|
// VPDeviceAck 是认证结果(successfulVerification/passTheVerification)
|
||||||
|
// VPDevicepassword 是设备密码原始值(如 "0000"),不是认证结果
|
||||||
|
if (content.VPDeviceAck === 'successfulVerification' || content.VPDeviceAck === 'passTheVerification') {
|
||||||
if (this._authTimer) { clearInterval(this._authTimer); this._authTimer = null; }
|
if (this._authTimer) { clearInterval(this._authTimer); this._authTimer = null; }
|
||||||
if (this._authTimeout) { clearTimeout(this._authTimeout); this._authTimeout = null; }
|
if (this._authTimeout) { clearTimeout(this._authTimeout); this._authTimeout = null; }
|
||||||
this._onReady();
|
this._onReady();
|
||||||
|
|||||||
Reference in New Issue
Block a user