You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

97 lines
2.5 KiB

class LiveMatchmaker {
final String? userId;
final String? remark;
final String? id;
final bool? enable;
final int? type;
LiveMatchmaker({
this.userId,
this.remark,
this.id,
this.enable,
this.type,
});
factory LiveMatchmaker.fromJson(Map<String, dynamic> json) {
return LiveMatchmaker(
userId: json['userId'] as String?,
remark: json['remark'] as String?,
id: json['id'] as String?,
enable: json['enable'] as bool?,
type: json['type'] as int?,
);
}
Map<String, dynamic> toJson() {
return {
'userId': userId,
'remark': remark,
'id': id,
'enable': enable,
'type': type,
};
}
}
// 用户基础信息实体类
class UserBaseData {
final bool matchmakerFlag;
final bool matchmakingCornerFlag;
final String nickName;
final String phone;
final String realName;
final String userId;
final LiveMatchmaker? liveMatchmaker;
final int matchmakerType;
final bool? isOnline; // 在线状态
UserBaseData({
required this.matchmakerFlag,
required this.matchmakingCornerFlag,
required this.nickName,
required this.phone,
required this.realName,
required this.userId,
required this.matchmakerType,
this.liveMatchmaker,
this.isOnline,
});
// 从JSON映射创建实例
factory UserBaseData.fromJson(Map<String, dynamic> json) {
return UserBaseData(
matchmakerFlag: json['matchmakerFlag'] ?? false,
matchmakerType: json['matchmakerType'] ?? 0,
matchmakingCornerFlag: json['matchmakingCornerFlag'] ?? false,
nickName: json['nickName'] ?? '',
phone: json['phone'] ?? '',
realName: json['realName'] ?? '',
userId: json['userId'] ?? '',
liveMatchmaker: json['liveMatchmaker'] != null ? LiveMatchmaker.fromJson(json['liveMatchmaker'] as Map<String, dynamic>) : null,
isOnline: json['isOnline'] as bool?,
);
}
// 转换为JSON映射
Map<String, dynamic> toJson() {
return {
'matchmakerFlag': matchmakerFlag,
'matchmakerType': matchmakerType,
'matchmakingCornerFlag': matchmakingCornerFlag,
'nickName': nickName,
'phone': phone,
'realName': realName,
'userId': userId,
'liveMatchmaker': liveMatchmaker?.toJson(),
'isOnline': isOnline,
};
}
@override
String toString() {
return 'UserBaseData(matchmakerFlag: $matchmakerFlag, matchmakingCornerFlag: $matchmakingCornerFlag, nickName: $nickName, phone: $phone, realName: $realName, userId: $userId)';
}
}