feat(lefu): 配网状态码描述映射,失败按状态码返回对应提示

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
17792275749
2026-08-24 10:31:28 +08:00
co-authored by Claude Sonnet 4.6
parent 31b745f2ab
commit 9911dea32f
2 changed files with 40 additions and 1 deletions
+6 -1
View File
@@ -1,5 +1,6 @@
import { LEFU_CONFIG } from './config'
import { DEVICE_SETTINGS } from './deviceSettings'
import { WIFI_CONFIG_STATE_TEXT } from './types'
import type {
RawDevice,
LeFuPlugin,
@@ -322,7 +323,11 @@ class LeFuService {
if (settled) return
settled = true
clearTimeout(timer)
res === 23 ? resolve() : reject(new Error(`配网失败,错误码:${res}`))
if (res === 23) {
resolve()
return
}
reject(new Error(WIFI_CONFIG_STATE_TEXT[res] || `配网失败,错误码:${res}`))
}
if (version === 'domain1') {
this._activeProtocol.dataConfigNetWork({ domain: LEFU_CONFIG.domain1, ssid, password }, callback)