diff --git a/nkebao/src/api/wechat-accounts.ts b/nkebao/src/api/wechat-accounts.ts index 53a1a527..1bb8e353 100644 --- a/nkebao/src/api/wechat-accounts.ts +++ b/nkebao/src/api/wechat-accounts.ts @@ -92,18 +92,12 @@ export const transferWechatFriends = async (sourceId: string | number, targetId: */ export const transformWechatAccount = (serverAccount: any): any => { // 从deviceInfo中提取设备信息 - let deviceId = ''; let deviceName = ''; if (serverAccount.deviceInfo) { // 尝试解析设备信息字符串 const deviceInfo = serverAccount.deviceInfo.split(' '); if (deviceInfo.length > 0) { - // 提取数字部分作为设备ID,确保是整数 - const possibleId = deviceInfo[0].trim(); - // 验证是否为数字 - deviceId = /^\d+$/.test(possibleId) ? possibleId : ''; - // 提取设备名称 if (deviceInfo.length > 1) { deviceName = deviceInfo[1] ? deviceInfo[1].replace(/[()]/g, '').trim() : ''; @@ -111,16 +105,7 @@ export const transformWechatAccount = (serverAccount: any): any => { } } - // 如果从deviceInfo无法获取有效的设备ID,使用imei作为备选 - if (!deviceId && serverAccount.imei) { - deviceId = serverAccount.imei; - } - - // 如果仍然没有设备ID,使用微信账号的ID作为最后的备选 - if (!deviceId && serverAccount.id) { - deviceId = serverAccount.id.toString(); - } - + // 如果没有设备名称,使用备用名称 if (!deviceName) { deviceName = serverAccount.deviceMemo || '未命名设备'; @@ -135,7 +120,7 @@ export const transformWechatAccount = (serverAccount: any): any => { avatar: serverAccount.avatar || '', nickname: serverAccount.nickname || serverAccount.accountNickname || '未命名', wechatId: serverAccount.wechatId || '', - deviceId, + deviceId: serverAccount.deviceId || '', deviceName, friendCount: serverAccount.totalFriend || 0, todayAdded,