[AI Generated]: fix(*): 修复蓝牙权限授权、bus订阅泄漏、OTA重复回调、WiFi列表容错及用户同步字段映射问题
This commit is contained in:
@@ -66,6 +66,10 @@ Component({
|
||||
content: "确定要初始化设备吗?将清除设备中的所有数据(用户信息、历史数据、配网数据、设置信息)。",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
if (!app.globalData.ppScale.activeProtocol) {
|
||||
wx.showToast({ title: "设备未连接,请重试", icon: "none" });
|
||||
return;
|
||||
}
|
||||
wx.showLoading({ title: "正在初始化设备...", mask: true });
|
||||
app.globalData.ppScale.activeProtocol.codeClearDeviceData("00", (status) => {
|
||||
wx.hideLoading();
|
||||
@@ -190,18 +194,19 @@ Component({
|
||||
}
|
||||
|
||||
let rawList = deviceUserIds;
|
||||
// 兼容对象数组和纯ID数组,统一转为字符串比对
|
||||
// SDK 返回的是 userID 数组,统一转为对象方便后续操作
|
||||
let deviceIds = rawList.map(item => ({
|
||||
id: item,
|
||||
userID: String(item),
|
||||
memberID: ""
|
||||
}));
|
||||
let localIds = userList.map(user => user.userId);
|
||||
// 本地列表的 userId 统一转字符串,与 SDK 侧类型对齐
|
||||
let localIds = userList.map(user => String(user.userId));
|
||||
|
||||
// 秤有、列表没有 → 需要从秤删除
|
||||
let needDeleteList = deviceIds.filter(d => !localIds.includes(d.userId));
|
||||
|
||||
let needDeleteList = deviceIds.filter(d => !localIds.includes(d.userID));
|
||||
|
||||
// 秤没有、列表有 → 需要下发到秤
|
||||
let needSyncList = userList.filter(user => !deviceIds.some(d => d.userID == user.userId));
|
||||
let needSyncList = userList.filter(user => !deviceIds.some(d => d.userID === String(user.userId)));
|
||||
|
||||
console.log("需删除", needDeleteList, "需下发", needSyncList);
|
||||
|
||||
@@ -268,7 +273,7 @@ Component({
|
||||
wx.showLoading({ title: "正在删除第" + (delIndex + 1) + "/" + needDeleteList.length + "个多余用户...", mask: true });
|
||||
let item = needDeleteList[delIndex];
|
||||
app.globalData.ppScale.activeProtocol.dataDeleteUser({
|
||||
userID: item.userId,
|
||||
userID: item.userID,
|
||||
memberID: ""
|
||||
}, (status) => {
|
||||
if (status == 0) {
|
||||
|
||||
Reference in New Issue
Block a user