new_version1

This commit is contained in:
hrxiang
2022-02-16 15:36:37 +08:00
parent cd0865853b
commit f3261d2ce4
99 changed files with 4404 additions and 3093 deletions

View File

@@ -10,16 +10,16 @@ class ConversationInfo {
String? userID;
String? groupID;
String? showName;
String? faceUrl;
String? faceURL;
int? recvMsgOpt;
int? unreadCount;
int? groupAtType;
Message? latestMsg;
int? latestMsgSendTime;
String? draftText;
int? draftTimestamp;
/// pinned value is 1
dynamic isPinned;
int? draftTextTime;
bool? isPinned;
String? ext;
ConversationInfo(
{required this.conversationID,
@@ -27,13 +27,13 @@ class ConversationInfo {
this.userID,
this.groupID,
this.showName,
this.faceUrl,
this.faceURL,
this.recvMsgOpt,
this.unreadCount,
this.latestMsg,
this.latestMsgSendTime,
this.draftText,
this.draftTimestamp,
this.draftTextTime,
this.isPinned});
ConversationInfo.fromJson(Map<String, dynamic> json)
@@ -43,7 +43,7 @@ class ConversationInfo {
userID = json['userID'];
groupID = json['groupID'];
showName = json['showName'];
faceUrl = json['faceUrl'];
faceURL = json['faceURL'];
recvMsgOpt = json['recvMsgOpt'];
unreadCount = json['unreadCount'];
// latestMsg = json['latestMsg'];
@@ -60,7 +60,7 @@ class ConversationInfo {
latestMsgSendTime = json['latestMsgSendTime'];
draftText = json['draftText'];
draftTimestamp = json['draftTimestamp'];
draftTextTime = json['draftTextTime'];
isPinned = json['isPinned'];
}
@@ -71,13 +71,13 @@ class ConversationInfo {
data['userID'] = this.userID;
data['groupID'] = this.groupID;
data['showName'] = this.showName;
data['faceUrl'] = this.faceUrl;
data['faceURL'] = this.faceURL;
data['recvMsgOpt'] = this.recvMsgOpt;
data['unreadCount'] = this.unreadCount;
data['latestMsg'] = this.latestMsg?.toJson();
data['latestMsgSendTime'] = this.latestMsgSendTime;
data['draftText'] = this.draftText;
data['draftTimestamp'] = this.draftTimestamp;
data['draftTextTime'] = this.draftTextTime;
data['isPinned'] = this.isPinned;
return data;
}
@@ -86,7 +86,6 @@ class ConversationInfo {
bool get isGroupChat => conversationType == ConversationType.group_chat;
bool get isTop => isPinned == 1;
@override
bool operator ==(Object other) =>

View File

@@ -3,30 +3,43 @@ class GroupInfo {
String? groupName;
String? notification;
String? introduction;
String? faceUrl;
String? ownerId;
String? faceURL;
String? ownerUserID;
int? createTime;
int? memberCount;
int? status;
String? creatorUserID;
int? groupType;
String? ex;
GroupInfo(
{required this.groupID,
this.groupName,
this.notification,
this.introduction,
this.faceUrl,
this.ownerId,
this.createTime,
this.memberCount});
GroupInfo({
required this.groupID,
this.groupName,
this.notification,
this.introduction,
this.faceURL,
this.ownerUserID,
this.createTime,
this.memberCount,
this.status,
this.creatorUserID,
this.groupType,
this.ex,
});
GroupInfo.fromJson(Map<String, dynamic> json) : groupID = json['groupID'] {
/*groupID = json['groupID'];*/
groupName = json['groupName'];
notification = json['notification'];
introduction = json['introduction'];
faceUrl = json['faceUrl'];
ownerId = json['ownerId'];
faceURL = json['faceURL'];
ownerUserID = json['ownerUserID'];
createTime = json['createTime'];
memberCount = json['memberCount'];
status = json['status'];
creatorUserID = json['creatorUserID'];
groupType = json['groupType'];
ex = json['ex'];
}
Map<String, dynamic> toJson() {
@@ -35,217 +48,257 @@ class GroupInfo {
data['groupName'] = this.groupName;
data['notification'] = this.notification;
data['introduction'] = this.introduction;
data['faceUrl'] = this.faceUrl;
data['ownerId'] = this.ownerId;
data['faceURL'] = this.faceURL;
data['ownerUserID'] = this.ownerUserID;
data['createTime'] = this.createTime;
data['memberCount'] = this.memberCount;
return data;
}
}
class GroupMembersList {
int? nextSeq;
List<GroupMembersInfo>? data;
GroupMembersList({this.nextSeq, this.data});
GroupMembersList.fromJson(Map<String, dynamic> json) {
nextSeq = json['nextSeq'];
if (json['data'] is List) {
data = (json['data'] as List)
.map((e) => GroupMembersInfo.fromJson(e))
.toList();
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['nextSeq'] = this.nextSeq;
if (this.data != null) {
data['data'] = this.data!.map((v) => v.toJson()).toList();
}
data['status'] = this.status;
data['creatorUserID'] = this.creatorUserID;
data['groupType'] = this.groupType;
data['ex'] = this.ex;
return data;
}
}
class GroupMembersInfo {
String? groupID;
String? userId;
int? role;
String? userID;
String? nickname;
String? faceURL;
int? roleLevel;
int? joinTime;
String? nickName;
String? faceUrl;
dynamic ext;
int? joinSource;
String? operatorUserID;
String? ext;
GroupMembersInfo({
this.groupID,
this.userId,
this.role,
this.userID,
this.roleLevel,
this.joinTime,
this.nickName,
this.faceUrl,
this.nickname,
this.faceURL,
this.ext,
this.joinSource,
this.operatorUserID,
});
GroupMembersInfo.fromJson(Map<String, dynamic> json) {
groupID = json['groupID'];
userId = json['userId'];
role = json['role'];
userID = json['userID'];
roleLevel = json['roleLevel'];
joinTime = json['joinTime'];
nickName = json['nickName'];
faceUrl = json['faceUrl'];
nickname = json['nickname'];
faceURL = json['faceURL'];
ext = json['ext'];
joinSource = json['joinSource'];
operatorUserID = json['operatorUserID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['groupID'] = this.groupID;
data['userId'] = this.userId;
data['role'] = this.role;
data['userID'] = this.userID;
data['roleLevel'] = this.roleLevel;
data['joinTime'] = this.joinTime;
data['nickName'] = this.nickName;
data['faceUrl'] = this.faceUrl;
data['nickname'] = this.nickname;
data['faceURL'] = this.faceURL;
data['ext'] = this.ext;
return data;
}
}
class GroupInviteResult {
String? uid;
int? result;
GroupInviteResult({this.uid, this.result});
GroupInviteResult.fromJson(Map<String, dynamic> json) {
uid = json['uid'];
result = json['result'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['uid'] = this.uid;
data['result'] = this.result;
data['joinSource'] = this.joinSource;
data['operatorUserID'] = this.operatorUserID;
return data;
}
}
class GroupMemberRole {
String? uid;
int? setRole;
String? userID;
GroupMemberRole({this.uid, this.setRole});
/// 1 ordinary member, 2 group owners, 3 administrators
/// 1普通成员, 2群主3管理员
int? roleLevel;
GroupMemberRole({this.userID, this.roleLevel = 1});
GroupMemberRole.fromJson(Map<String, dynamic> json) {
uid = json['uid'];
setRole = json['setRole'];
userID = json['userID'];
roleLevel = json['roleLevel'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['uid'] = this.uid;
data['setRole'] = this.setRole;
data['userID'] = this.userID;
data['roleLevel'] = this.roleLevel;
return data;
}
}
class GroupApplicationInfo {
String? id;
String? groupID;
String? fromUserID;
String? toUserID;
int? flag; //INIT = 0, REFUSE = -1, AGREE = 1
String? groupName;
String? notification;
String? introduction;
String? groupFaceURL;
int? createTime;
int? status;
String? creatorUserID;
int? groupType;
String? ownerUserID;
int? memberCount;
String? userID;
String? nickname;
String? userFaceURL;
int? gender;
int? handleResult; //REFUSE = -1, AGREE = 1
String? reqMsg;
String? handledMsg;
int? createTime;
String? fromUserNickName;
String? toUserNickName;
String? fromUserFaceURL;
String? toUserFaceURL;
String? handledUser;
int? type; //APPLICATION = 0, INVITE = 1
int? handleStatus; //UNHANDLED = 0, BY_OTHER = 1, BY_SELF = 2
int? handleResult; //REFUSE = 0, AGREE = 1
int? reqTime;
String? handleUserID;
int? handledTime;
String? ex;
GroupApplicationInfo(
{this.id,
this.groupID,
this.fromUserID,
this.toUserID,
this.flag,
this.reqMsg,
this.handledMsg,
this.createTime,
this.fromUserNickName,
this.toUserNickName,
this.fromUserFaceURL,
this.toUserFaceURL,
this.handledUser,
this.type,
this.handleStatus,
this.handleResult});
GroupApplicationInfo({
this.groupID,
this.groupName,
this.notification,
this.introduction,
this.groupFaceURL,
this.createTime,
this.status,
this.creatorUserID,
this.groupType,
this.ownerUserID,
this.memberCount,
this.userID,
this.nickname,
this.userFaceURL,
this.gender,
this.handleResult,
this.reqMsg,
this.handledMsg,
this.reqTime,
this.handleUserID,
this.handledTime,
this.ex,
});
GroupApplicationInfo.fromJson(Map<String, dynamic> json) {
id = json['id'];
groupID = json['groupID'];
fromUserID = json['fromUserID'];
toUserID = json['toUserID'];
flag = json['flag'];
groupName = json['groupName'];
notification = json['notification'];
introduction = json['introduction'];
groupFaceURL = json['groupFaceURL'];
createTime = json['createTime'];
status = json['status'];
creatorUserID = json['creatorUserID'];
groupType = json['groupType'];
ownerUserID = json['ownerUserID'];
memberCount = json['memberCount'];
userID = json['userID'];
nickname = json['nickname'];
userFaceURL = json['userFaceURL'];
gender = json['gender'];
handleResult = json['handleResult'];
reqMsg = json['reqMsg'];
handledMsg = json['handledMsg'];
createTime = json['createTime'];
fromUserNickName = json['fromUserNickName'];
toUserNickName = json['toUserNickName'];
fromUserFaceURL = json['fromUserFaceURL'];
toUserFaceURL = json['toUserFaceURL'];
handledUser = json['handledUser'];
type = json['type'];
handleStatus = json['handleStatus'];
handleResult = json['handleResult'];
reqTime = json['reqTime'];
handleUserID = json['handleUserID'];
handledTime = json['handledTime'];
ex = json['ex'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
final data = Map<String, dynamic>();
data['groupID'] = this.groupID;
data['fromUserID'] = this.fromUserID;
data['toUserID'] = this.toUserID;
data['flag'] = this.flag;
data['groupName'] = this.groupName;
data['notification'] = this.notification;
data['introduction'] = this.introduction;
data['groupFaceURL'] = this.groupFaceURL;
data['createTime'] = this.createTime;
data['status'] = this.status;
data['creatorUserID'] = this.creatorUserID;
data['groupType'] = this.groupType;
data['ownerUserID'] = this.ownerUserID;
data['memberCount'] = this.memberCount;
data['userID'] = this.userID;
data['nickname'] = this.nickname;
data['userFaceURL'] = this.userFaceURL;
data['gender'] = this.gender;
data['handleResult'] = this.handleResult;
data['reqMsg'] = this.reqMsg;
data['handledMsg'] = this.handledMsg;
data['createTime'] = this.createTime;
data['fromUserNickName'] = this.fromUserNickName;
data['toUserNickName'] = this.toUserNickName;
data['fromUserFaceURL'] = this.fromUserFaceURL;
data['toUserFaceURL'] = this.toUserFaceURL;
data['handledUser'] = this.handledUser;
data['type'] = this.type;
data['handleStatus'] = this.handleStatus;
data['handleResult'] = this.handleResult;
data['reqTime'] = this.reqTime;
data['handleUserID'] = this.handleUserID;
data['handledTime'] = this.handledTime;
data['ex'] = this.ex;
return data;
}
}
class GroupApplicationList {
int? count;
List<GroupApplicationInfo>? user;
class GroupInviteResult {
String? userID;
int? result;
GroupApplicationList({this.count, this.user});
GroupInviteResult({this.userID, this.result});
GroupApplicationList.fromJson(Map<String, dynamic> json) {
count = json['count'];
if (json['user'] is List) {
user = (json['user'] as List)
.map((e) => GroupApplicationInfo.fromJson(e))
.toList();
}
GroupInviteResult.fromJson(Map<String, dynamic> json) {
userID = json['userID'];
result = json['result'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['count'] = this.count;
if (this.user != null) {
data['user'] = this.user!.map((v) => v.toJson()).toList();
}
data['userID'] = this.userID;
data['result'] = this.result;
return data;
}
}
// class GroupMembersList {
// int? nextSeq;
// List<GroupMembersInfo>? data;
//
// GroupMembersList({this.nextSeq, this.data});
//
// GroupMembersList.fromJson(Map<String, dynamic> json) {
// nextSeq = json['nextSeq'];
// if (json['data'] is List) {
// data = (json['data'] as List)
// .map((e) => GroupMembersInfo.fromJson(e))
// .toList();
// }
// }
//
// Map<String, dynamic> toJson() {
// final Map<String, dynamic> data = new Map<String, dynamic>();
// data['nextSeq'] = this.nextSeq;
// if (this.data != null) {
// data['data'] = this.data!.map((v) => v.toJson()).toList();
// }
// return data;
// }
// }
//
// class GroupApplicationList {
// int? count;
// List<GroupApplicationInfo>? user;
//
// GroupApplicationList({this.count, this.user});
//
// GroupApplicationList.fromJson(Map<String, dynamic> json) {
// count = json['count'];
// if (json['user'] is List) {
// user = (json['user'] as List)
// .map((e) => GroupApplicationInfo.fromJson(e))
// .toList();
// }
// }
//
// Map<String, dynamic> toJson() {
// final Map<String, dynamic> data = new Map<String, dynamic>();
// data['count'] = this.count;
// if (this.user != null) {
// data['user'] = this.user!.map((v) => v.toJson()).toList();
// }
// return data;
// }
// }

View File

@@ -3,6 +3,9 @@ class Message {
String? serverMsgID;
int? createTime;
int? sendTime;
/// [ConversationType]
int? sessionType;
String? sendID;
String? recvID;
int? msgFrom;
@@ -10,8 +13,7 @@ class Message {
/// [MessageType]
int? contentType;
int? platformID;
List<String>? forceList;
String? senderNickName;
String? senderNickname;
String? senderFaceUrl;
String? groupID;
String? content;
@@ -20,11 +22,10 @@ class Message {
/// [MessageStatus]
int? status;
String? remark;
OfflinePushInfo? offlinePush;
String? attachedInfo;
String? ex;
dynamic ext;
/// [ConversationType]
int? sessionType;
PictureElem? pictureElem;
SoundElem? soundElem;
VideoElem? videoElem;
@@ -34,28 +35,30 @@ class Message {
CustomElem? customElem;
QuoteElem? quoteElem;
MergeElem? mergeElem;
NotificationElem? notificationElem;
Message({
this.clientMsgID,
this.serverMsgID,
this.createTime,
this.sendTime,
this.sessionType,
this.sendID,
this.recvID,
this.msgFrom,
this.contentType,
this.platformID,
this.forceList,
this.senderNickName,
this.senderNickname,
this.senderFaceUrl,
this.groupID,
this.content,
this.seq,
this.isRead,
this.status,
this.remark,
this.offlinePush,
this.attachedInfo,
this.ex,
this.ext,
this.sessionType,
this.pictureElem,
this.soundElem,
this.videoElem,
@@ -65,6 +68,7 @@ class Message {
this.customElem,
this.quoteElem,
this.mergeElem,
this.notificationElem,
});
Message.fromJson(
@@ -78,17 +82,18 @@ class Message {
msgFrom = json['msgFrom'];
contentType = json['contentType'];
platformID = json['platformID'];
if (json['forceList'] is List) {
forceList = (json['forceList'] as List).map((e) => '$e').toList();
}
senderNickName = json['senderNickName'];
senderNickname = json['senderNickname'];
senderFaceUrl = json['senderFaceUrl'];
groupID = json['groupID'];
content = json['content'];
seq = json['seq'];
isRead = json['isRead'];
status = json['status'];
remark = json['remark'];
offlinePush = json['offlinePush'] != null
? OfflinePushInfo.fromJson(json['offlinePush'])
: null;
attachedInfo = json['attachedInfo'];
ex = json['ex'];
ext = json['ext'];
sessionType = json['sessionType'];
pictureElem = json['pictureElem'] != null
@@ -116,6 +121,9 @@ class Message {
mergeElem = json['mergeElem'] != null
? MergeElem.fromJson(json['mergeElem'])
: null;
notificationElem = json['notificationElem'] != null
? NotificationElem.fromJson(json['notificationElem'])
: null;
}
Map<String, dynamic> toJson() {
@@ -129,15 +137,16 @@ class Message {
data['msgFrom'] = this.msgFrom;
data['contentType'] = this.contentType;
data['platformID'] = this.platformID;
data['forceList'] = this.forceList;
data['senderNickName'] = this.senderNickName;
data['senderNickname'] = this.senderNickname;
data['senderFaceUrl'] = this.senderFaceUrl;
data['groupID'] = this.groupID;
data['content'] = this.content;
data['seq'] = this.seq;
data['isRead'] = this.isRead;
data['status'] = this.status;
data['remark'] = this.remark;
data['offlinePush'] = this.offlinePush?.toJson();
data['attachedInfo'] = this.attachedInfo;
data['ex'] = this.ex;
data['ext'] = this.ext;
data['sessionType'] = this.sessionType;
data['pictureElem'] = this.pictureElem?.toJson();
@@ -149,6 +158,7 @@ class Message {
data['customElem'] = this.customElem?.toJson();
data['quoteElem'] = this.quoteElem?.toJson();
data['mergeElem'] = this.mergeElem?.toJson();
data['notificationElem'] = this.notificationElem?.toJson();
return data;
}
@@ -205,7 +215,7 @@ class PictureElem {
}
class PictureInfo {
String? uuID;
String? uuid;
String? type;
int? size;
int? width;
@@ -213,10 +223,10 @@ class PictureInfo {
String? url;
PictureInfo(
{this.uuID, this.type, this.size, this.width, this.height, this.url});
{this.uuid, this.type, this.size, this.width, this.height, this.url});
PictureInfo.fromJson(Map<String, dynamic> json) {
uuID = json['uuID'];
uuid = json['uuid'];
type = json['type'];
size = json['size'];
width = json['width'];
@@ -226,7 +236,7 @@ class PictureInfo {
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['uuID'] = this.uuID;
data['uuid'] = this.uuid;
data['type'] = this.type;
data['size'] = this.size;
data['width'] = this.width;
@@ -237,21 +247,21 @@ class PictureInfo {
}
class SoundElem {
String? uuID;
String? uuid;
String? soundPath;
String? sourceUrl;
int? dataSize;
int? duration;
SoundElem(
{this.uuID,
{this.uuid,
this.soundPath,
this.sourceUrl,
this.dataSize,
this.duration});
SoundElem.fromJson(Map<String, dynamic> json) {
uuID = json['uuID'];
uuid = json['uuid'];
soundPath = json['soundPath'];
sourceUrl = json['sourceUrl'];
dataSize = json['dataSize'];
@@ -260,7 +270,7 @@ class SoundElem {
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['uuID'] = this.uuID;
data['uuid'] = this.uuid;
data['soundPath'] = this.soundPath;
data['sourceUrl'] = this.sourceUrl;
data['dataSize'] = this.dataSize;
@@ -332,17 +342,17 @@ class VideoElem {
class FileElem {
String? filePath;
String? uuID;
String? uuid;
String? sourceUrl;
String? fileName;
int? fileSize;
FileElem(
{this.filePath, this.uuID, this.sourceUrl, this.fileName, this.fileSize});
{this.filePath, this.uuid, this.sourceUrl, this.fileName, this.fileSize});
FileElem.fromJson(Map<String, dynamic> json) {
filePath = json['filePath'];
uuID = json['uuID'];
uuid = json['uuid'];
sourceUrl = json['sourceUrl'];
fileName = json['fileName'];
fileSize = json['fileSize'];
@@ -351,7 +361,7 @@ class FileElem {
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['filePath'] = this.filePath;
data['uuID'] = this.uuID;
data['uuid'] = this.uuid;
data['sourceUrl'] = this.sourceUrl;
data['fileName'] = this.fileName;
data['fileSize'] = this.fileSize;
@@ -485,6 +495,25 @@ class MergeElem {
}
}
class NotificationElem {
String? detail;
String? defaultTips;
NotificationElem({this.detail, this.defaultTips});
NotificationElem.fromJson(Map<String, dynamic> json) {
detail = json['detail'];
defaultTips = json['defaultTips'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['detail'] = this.detail;
data['defaultTips'] = this.defaultTips;
return data;
}
}
class HaveReadInfo {
String? uid;
List<String>? msgIDList;
@@ -523,3 +552,32 @@ class HaveReadInfo {
return data;
}
}
class OfflinePushInfo {
String? title;
String? desc;
String? ex;
String? iOSPushSound;
bool? iOSBadgeCount;
OfflinePushInfo(
{this.title, this.desc, this.ex, this.iOSPushSound, this.iOSBadgeCount});
OfflinePushInfo.fromJson(Map<String, dynamic> json) {
title = json['title'];
desc = json['desc'];
ex = json['ex'];
iOSPushSound = json['iOSPushSound'];
iOSBadgeCount = json['iOSBadgeCount'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['title'] = this.title;
data['desc'] = this.desc;
data['ex'] = this.ex;
data['iOSPushSound'] = this.iOSPushSound;
data['iOSBadgeCount'] = this.iOSBadgeCount;
return data;
}
}

View File

@@ -1,91 +1,388 @@
/// Is a friend not in the blacklist
/// 是好友不在黑名单
/// Not a friend on the blacklist
/// 不是好友在黑名单
/// Not a friend is not on the blacklist
/// 不是好友不在黑名单
class UserInfo {
String uid;
String? name;
String? icon;
String? userID;
String? nickname;
String? faceURL;
int? gender;
String? mobile;
String? birth;
String? phoneNumber;
int? birth;
String? email;
String? ex;
String? comment;
int? isInBlackList;
String? reqMessage;
String? applyTime;
int? flag;
int? createTime;
String? remark;
UserInfo(
{required this.uid,
this.name,
this.icon,
this.gender,
this.mobile,
this.birth,
this.email,
this.ex,
this.comment,
this.isInBlackList,
this.reqMessage,
this.applyTime,
this.flag});
PublicUserInfo? publicInfo;
FriendInfo? friendInfo;
BlacklistInfo? blackInfo;
UserInfo.fromJson(Map<String, dynamic> json) : uid = json['uid'] {
name = json['name'];
icon = json['icon'];
bool? isFriendship;
bool? isBlacklist;
UserInfo({
this.publicInfo,
this.friendInfo,
this.blackInfo,
this.isFriendship,
this.isBlacklist,
//
this.userID,
this.nickname,
this.faceURL,
this.phoneNumber,
this.birth,
this.gender,
this.email,
this.ex,
this.createTime,
this.remark,
});
// UserInfo.self(Map<String, dynamic> json) {
// userID = json['userID'];
// nickname = json['nickname'];
// faceURL = json['faceURL'];
// gender = json['gender'];
// phoneNumber = json['phoneNumber'];
// birth = json['birth'];
// email = json['email'];
// ex = json['ex'];
// createTime = json['createTime'];
// }
UserInfo.fromJson(Map<String, dynamic> json) {
publicInfo = json['publicInfo'] != null
? PublicUserInfo.fromJson(json['publicInfo'])
: null;
friendInfo = json['friendInfo'] != null
? FriendInfo.fromJson(json['friendInfo'])
: null;
blackInfo = json['blackInfo'] != null
? BlacklistInfo.fromJson(json['blackInfo'])
: null;
//
isFriendship = friendInfo != null;
isBlacklist = blackInfo != null;
userID = json['userID'] ?? _userID;
nickname = json['nickname'] ?? _nickname;
faceURL = json['faceURL'] ?? _faceUrl;
gender = json['gender'] ?? _gender;
phoneNumber = json['phoneNumber'] ?? _phoneNumber;
birth = json['birth'] ?? _birth;
email = json['email'] ?? _email;
remark = json['remark'] ?? _remark;
ex = json['ex'];
createTime = json['createTime'];
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
data['publicInfo'] = this.publicInfo?.toJson();
data['friendInfo'] = this.friendInfo?.toJson();
data['blackInfo'] = this.blackInfo?.toJson();
//
data['isFriendship'] = this.isFriendship;
data['isBlacklist'] = this.isBlacklist;
data['userID'] = this.userID;
data['nickname'] = this.nickname;
data['faceURL'] = this.faceURL;
data['gender'] = this.gender;
data['phoneNumber'] = this.phoneNumber;
data['birth'] = this.birth;
data['email'] = this.email;
data['ex'] = this.ex;
data['createTime'] = this.createTime;
data['remark'] = this.remark;
return data;
}
// bool get isFriendship => null != friendInfo;
//
// bool get isBlacklist => null != blackInfo;
bool get isMale => gender == 1;
String get _userID => isFriendship!
? friendInfo!.userID!
: (isBlacklist! ? blackInfo!.userID! : publicInfo!.userID!);
String? get _nickname => isFriendship!
? friendInfo?.nickname
: (isBlacklist! ? blackInfo?.nickname : publicInfo?.nickname);
String? get _faceUrl => isFriendship!
? friendInfo?.faceURL
: (isBlacklist! ? blackInfo?.faceURL : publicInfo?.faceURL);
int? get _gender => isFriendship!
? friendInfo?.gender
: (isBlacklist! ? blackInfo?.gender : publicInfo?.gender);
String? get _phoneNumber => friendInfo?.phoneNumber;
int? get _birth => friendInfo?.birth;
String? get _email => friendInfo?.email;
String? get _remark => friendInfo?.remark;
String getShowName() => _trimBlank(remark) ?? _trimBlank(nickname) ?? userID!;
static String? _trimBlank(String? value) {
if (value == null || value.trim().isEmpty) return null;
return value;
}
}
class PublicUserInfo {
String? userID;
String? nickname;
String? faceURL;
int? gender;
int? appMangerLevel;
PublicUserInfo({
this.userID,
this.nickname,
this.faceURL,
this.gender,
this.appMangerLevel,
});
PublicUserInfo.fromJson(Map<String, dynamic> json) {
userID = json['userID'];
nickname = json['nickname'];
faceURL = json['faceURL'];
gender = json['gender'];
mobile = json['mobile'];
appMangerLevel = json['appMangerLevel'];
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
data['userID'] = this.userID;
data['nickname'] = this.nickname;
data['faceURL'] = this.faceURL;
data['gender'] = this.gender;
data['appMangerLevel'] = this.appMangerLevel;
return data;
}
}
class FriendInfo {
String? userID;
String? nickname;
String? faceURL;
int? gender;
String? phoneNumber;
int? birth;
String? email;
String? remark;
String? ex;
int? createTime;
int? addSource;
String? operatorUserID;
FriendInfo({
this.userID,
this.nickname,
this.faceURL,
this.gender,
this.phoneNumber,
this.birth,
this.email,
this.remark,
this.ex,
this.createTime,
this.addSource,
this.operatorUserID,
});
FriendInfo.fromJson(Map<String, dynamic> json) {
// ownerUserID = json['ownerUserID'];
userID = json['userID'];
remark = json['remark'];
createTime = json['createTime'];
addSource = json['addSource'];
operatorUserID = json['operatorUserID'];
nickname = json['nickname'];
faceURL = json['faceURL'];
gender = json['gender'];
phoneNumber = json['phoneNumber'];
birth = json['birth'];
email = json['email'];
ex = json['ex'];
comment = json['comment'];
isInBlackList = json['isInBlackList'];
reqMessage = json['reqMessage'];
applyTime = json['applyTime'];
flag = json['flag'];
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
// data['ownerUserID'] = this.ownerUserID;
data['userID'] = this.userID;
data['remark'] = this.remark;
data['createTime'] = this.createTime;
data['addSource'] = this.addSource;
data['operatorUserID'] = this.operatorUserID;
data['nickname'] = this.nickname;
data['faceURL'] = this.faceURL;
data['gender'] = this.gender;
data['phoneNumber'] = this.phoneNumber;
data['birth'] = this.birth;
data['email'] = this.email;
data['ex'] = this.ex;
return data;
}
}
class BlacklistInfo {
String? userID;
String? nickname;
String? faceURL;
int? gender;
int? createTime;
int? addSource;
String? operatorUserID;
String? ex;
BlacklistInfo({
this.userID,
this.nickname,
this.faceURL,
this.gender,
this.createTime,
this.addSource,
this.operatorUserID,
this.ex,
});
BlacklistInfo.fromJson(Map<String, dynamic> json) {
userID = json['userID'];
nickname = json['nickname'];
faceURL = json['faceURL'];
gender = json['gender'];
createTime = json['createTime'];
addSource = json['addSource'];
operatorUserID = json['operatorUserID'];
ex = json['ex'];
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
data['userID'] = this.userID;
data['nickname'] = this.nickname;
data['faceURL'] = this.faceURL;
data['gender'] = this.gender;
data['createTime'] = this.createTime;
data['addSource'] = this.addSource;
data['operatorUserID'] = this.operatorUserID;
data['ex'] = this.ex;
return data;
}
}
class FriendshipInfo {
String? userID;
/// 1 means friend (and not blacklist)
/// 1表示好友并且不是黑名单
int? result;
FriendshipInfo({this.userID, this.result});
FriendshipInfo.fromJson(Map<String, dynamic> json) {
userID = json['userID'];
result = json['result'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['uid'] = this.uid;
data['name'] = this.name;
data['icon'] = this.icon;
data['gender'] = this.gender;
data['mobile'] = this.mobile;
data['birth'] = this.birth;
data['email'] = this.email;
data['userID'] = this.userID;
data['result'] = this.result;
return data;
}
}
class FriendApplicationInfo {
String? fromUserID;
String? fromNickname;
String? fromFaceURL;
int? fromGender;
String? toUserID;
String? toNickname;
String? toFaceURL;
int? toGender;
int? handleResult;
String? reqMsg;
int? createTime;
String? handlerUserID;
String? handleMsg;
int? handleTime;
String? ex;
FriendApplicationInfo(
{this.fromUserID,
this.fromNickname,
this.fromFaceURL,
this.fromGender,
this.toUserID,
this.toNickname,
this.toFaceURL,
this.toGender,
this.handleResult,
this.reqMsg,
this.createTime,
this.handlerUserID,
this.handleMsg,
this.handleTime,
this.ex});
FriendApplicationInfo.fromJson(Map<String, dynamic> json) {
fromUserID = json['fromUserID'];
fromNickname = json['fromNickname'];
fromFaceURL = json['fromFaceURL'];
fromGender = json['fromGender'];
toUserID = json['toUserID'];
toNickname = json['toNickname'];
toFaceURL = json['toFaceURL'];
toGender = json['toGender'];
handleResult = json['handleResult'];
reqMsg = json['reqMsg'];
createTime = json['createTime'];
handlerUserID = json['handlerUserID'];
handleMsg = json['handleMsg'];
handleTime = json['handleTime'];
ex = json['ex'];
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
data['fromUserID'] = this.fromUserID;
data['fromNickname'] = this.fromNickname;
data['fromFaceURL'] = this.fromFaceURL;
data['fromGender'] = this.fromGender;
data['toUserID'] = this.toUserID;
data['toNickname'] = this.toNickname;
data['toFaceURL'] = this.toFaceURL;
data['toGender'] = this.toGender;
data['handleResult'] = this.handleResult;
data['reqMsg'] = this.reqMsg;
data['createTime'] = this.createTime;
data['handlerUserID'] = this.handlerUserID;
data['handleMsg'] = this.handleMsg;
data['handleTime'] = this.handleTime;
data['ex'] = this.ex;
data['comment'] = this.comment;
data['isInBlackList'] = this.isInBlackList;
data['reqMessage'] = this.reqMessage;
data['applyTime'] = this.applyTime;
data['flag'] = this.flag;
return data;
}
String getShowName() {
if (null != comment && comment!.trim().isNotEmpty) {
return comment!;
} else if (null != name && name!.trim().isNotEmpty) {
return name!;
}
return uid;
}
bool get isMan => gender == 1;
bool get isWoman => gender == 2;
/// blacklist
bool get isBlocked => isInBlackList == 1;
/// friend application waiting handle
bool get isWaitingHandle => flag == 0;
bool get isWaitingHandle => handleResult == 0;
/// friend application agreed
bool get isAgreed => flag == 1;
bool get isAgreed => handleResult == 1;
/// friend application rejected
bool get isRejected => flag == -1;
/// exist friendship
bool get isFriendship => isAgreed;
bool get isRejected => handleResult == -1;
}