class LiveMatchmaker { final String? userId; final String? remark; final String? code; final String? id; final bool? enable; final int? type; LiveMatchmaker({ this.userId, this.remark, this.code, this.id, this.enable, this.type, }); factory LiveMatchmaker.fromJson(Map json) { return LiveMatchmaker( userId: json['userId'] as String?, remark: json['remark'] as String?, code: json['code'] as String?, id: json['id'] as String?, enable: json['enable'] as bool?, type: json['type'] as int?, ); } Map toJson() { return { 'userId': userId, 'remark': remark, 'code': code, '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; // 在线状态 final bool? isForbidden; final String? forbiddenEndTime; final int forbiddenCycle; 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, this.isForbidden, required this.forbiddenEndTime, required this.forbiddenCycle, }); // 从JSON映射创建实例 factory UserBaseData.fromJson(Map 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) : null, isOnline: json['isOnline'] as bool?, isForbidden: json['isForbidden'] as bool?, forbiddenCycle: json['forbiddenCycle'] ?? 0, forbiddenEndTime: json['forbiddenEndTime'] ?? '', ); } // 转换为JSON映射 Map toJson() { return { 'matchmakerFlag': matchmakerFlag, 'matchmakerType': matchmakerType, 'matchmakingCornerFlag': matchmakingCornerFlag, 'nickName': nickName, 'phone': phone, 'realName': realName, 'userId': userId, 'liveMatchmaker': liveMatchmaker?.toJson(), 'isOnline': isOnline, 'isForbidden': isForbidden, 'forbiddenCycle': forbiddenCycle, 'forbiddenEndTime': forbiddenEndTime, }; } @override String toString() { return 'UserBaseData(matchmakerFlag: $matchmakerFlag, matchmakingCornerFlag: $matchmakingCornerFlag, nickName: $nickName, phone: $phone, realName: $realName, userId: $userId)'; } }