From f918fc9b8f873bf463544f47cd58e67635be8887 Mon Sep 17 00:00:00 2001 From: Jolie <412895109@qq.com> Date: Wed, 10 Dec 2025 10:41:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(home):=20=E6=B7=BB=E5=8A=A0=20miUserId=20?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=BB=A5=E6=94=AF=E6=8C=81=20IM=20=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E7=94=A8=E6=88=B7=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 UserInfoData 模型中新增 miUserId 属性 - 更新模型序列化逻辑以包含 miUserId 字段 - 简化用户信息页面中的目标用户 ID 获取逻辑,直接使用 miUserId - 移除原有的多层级用户 ID 查找逻辑,提高代码可读性 --- lib/model/home/user_info_data.dart | 4 ++++ lib/pages/home/user_information_page.dart | 6 +----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/model/home/user_info_data.dart b/lib/model/home/user_info_data.dart index 5e22462..78119e2 100644 --- a/lib/model/home/user_info_data.dart +++ b/lib/model/home/user_info_data.dart @@ -5,6 +5,7 @@ class UserInfoData { String? updateTime; Null? event; String? accountId; + String? miUserId; String? userId; String? nickName; String? name; @@ -150,6 +151,7 @@ class UserInfoData { this.accountTypeName, this.nationalityCode, this.nationality, + this.miUserId, this.nativePlaceCode, this.nativePlaceName, this.industryCode, @@ -200,6 +202,7 @@ class UserInfoData { userId = json['userId']; nickName = json['nickName']; name = json['name']; + miUserId = json['miUserId']; profilePhoto = json['profilePhoto']; hasUploadProfilePhoto = json['hasUploadProfilePhoto']; photoDisplay = json['photoDisplay']; @@ -310,6 +313,7 @@ class UserInfoData { data['userId'] = this.userId; data['nickName'] = this.nickName; data['name'] = this.name; + data['miUserId'] = this.miUserId; data['profilePhoto'] = this.profilePhoto; data['hasUploadProfilePhoto'] = this.hasUploadProfilePhoto; data['photoDisplay'] = this.photoDisplay; diff --git a/lib/pages/home/user_information_page.dart b/lib/pages/home/user_information_page.dart index c941479..bfd02d8 100644 --- a/lib/pages/home/user_information_page.dart +++ b/lib/pages/home/user_information_page.dart @@ -462,11 +462,7 @@ class UserInformationPage extends StatelessWidget { // IM系统需要使用userId或accountId,而不是miId // 优先使用userId(这是IM系统的用户ID),如果没有则使用accountId,最后才使用miId - String? targetUserId = (userInfo.userId?.isNotEmpty == true ? userInfo.userId : - (userInfo.accountId?.isNotEmpty == true ? userInfo.accountId : - (userInfo.miId?.isNotEmpty == true ? userInfo.miId : - (userInfo.id?.isNotEmpty == true ? userInfo.id : - (miId.isNotEmpty ? miId : null))))); + String? targetUserId = userInfo.miUserId; if (targetUserId == null || targetUserId.isEmpty) { print('❌ [UserInformationPage] 无法获取用户ID,无法跳转');