Browse Source

feat(home): 添加 miUserId 字段以支持 IM 系统用户标识

- 在 UserInfoData 模型中新增 miUserId 属性
- 更新模型序列化逻辑以包含 miUserId 字段
- 简化用户信息页面中的目标用户 ID 获取逻辑,直接使用 miUserId
- 移除原有的多层级用户 ID 查找逻辑,提高代码可读性
ios
Jolie 3 months ago
parent
commit
f918fc9b8f
2 changed files with 5 additions and 5 deletions
  1. 4
      lib/model/home/user_info_data.dart
  2. 6
      lib/pages/home/user_information_page.dart

4
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;

6
lib/pages/home/user_information_page.dart

@ -462,11 +462,7 @@ class UserInformationPage extends StatelessWidget {
// IM系统需要使用userId或accountIdmiId
// 使userIdIM系统的用户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,无法跳转');

Loading…
Cancel
Save