初始化
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import 'package:hgdj/hj_model/comment/comment_model.dart';
|
||||
|
||||
///评论列表返回信息
|
||||
class CommentListRes {
|
||||
List<CommentModel>? list;
|
||||
int? total;
|
||||
bool? hasNext = false;
|
||||
List<CommentLink>? quickSearchList;
|
||||
|
||||
CommentListRes.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
list =
|
||||
(json['list'] as List?)?.map((e) => CommentModel.fromJson(e)).toList();
|
||||
total = json['total'];
|
||||
hasNext = json['hasNext'];
|
||||
quickSearchList = (json['quickSearchList'] as List?)
|
||||
?.map((e) => CommentLink.fromJson(e))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
///评论区快捷入口
|
||||
class CommentLink {
|
||||
String? id;
|
||||
String? title;
|
||||
String? searchKeyword;
|
||||
String? link;
|
||||
int? type; //1:评论置顶 2:评论大家都在搜
|
||||
|
||||
CommentLink.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
id = json['id'];
|
||||
title = json['title'];
|
||||
searchKeyword = json['searchKeyword'];
|
||||
link = json['link'];
|
||||
type = json['type'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import 'package:hgdj/hj_model/comment/reply_model.dart';
|
||||
|
||||
class CommentModel {
|
||||
String? id;
|
||||
|
||||
//用户信息
|
||||
int? userID;
|
||||
String? userName;
|
||||
String? userPortrait;
|
||||
bool? superUser;
|
||||
int? vipLevel;
|
||||
|
||||
//评论内容
|
||||
String? content;
|
||||
String? image;
|
||||
String? createdAt;
|
||||
bool? isGodComment; //神评论
|
||||
bool? official; //官方评论,读取用 isOfficial
|
||||
|
||||
//互动数据
|
||||
int? likeCount;
|
||||
int? commCount;
|
||||
bool? isLike;
|
||||
|
||||
//超链接评论(点评论跳搜索/外链)
|
||||
String? searchKeyword;
|
||||
int? linkType; //1:内链跳转 2:外链跳转
|
||||
String? linkStr;
|
||||
|
||||
//子回复,分页在本地维护
|
||||
List<ReplyModel>? replies;
|
||||
bool? hasMoreReply = false; //还有更多子回复
|
||||
int? replyPage = 1;
|
||||
|
||||
bool get isOfficial => official == true;
|
||||
|
||||
//超链接评论隐藏点赞/回复入口 true 隐藏 false 显示
|
||||
bool get isHideLikeOrComment =>
|
||||
(linkType == 1 || linkType == 2) &&
|
||||
linkStr?.isNotEmpty == true &&
|
||||
searchKeyword?.isNotEmpty == true;
|
||||
|
||||
CommentModel.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
id = json['id'];
|
||||
userID = json['userID'];
|
||||
userName = json['userName'];
|
||||
userPortrait = json['userPortrait'];
|
||||
superUser = json['superUser'];
|
||||
vipLevel = json['vipLevel'];
|
||||
content = json['content'];
|
||||
image = json['image'];
|
||||
createdAt = json['createdAt'];
|
||||
isGodComment = json['isGodComment'];
|
||||
official = json['isOfficial'];
|
||||
likeCount = json['likeCount'];
|
||||
commCount = json['commCount'];
|
||||
isLike = json['isLike'];
|
||||
searchKeyword = json['searchKeyword'];
|
||||
linkType = json['linkType'];
|
||||
linkStr = json['linkStr'];
|
||||
replies =
|
||||
(json['Info'] as List?)?.map((e) => ReplyModel.fromJson(e)).toList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
class ReplyModel {
|
||||
String? id;
|
||||
|
||||
//用户信息
|
||||
int? userID;
|
||||
String? userName;
|
||||
String? userPortrait;
|
||||
|
||||
//被回复人
|
||||
int? toUserID;
|
||||
String? toUserName;
|
||||
|
||||
//回复内容
|
||||
String? content;
|
||||
String? image;
|
||||
String? createdAt;
|
||||
|
||||
//互动数据
|
||||
int? likeCount;
|
||||
bool? isLike;
|
||||
|
||||
ReplyModel.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
id = json['id'];
|
||||
userID = json['userID'];
|
||||
userName = json['userName'];
|
||||
userPortrait = json['userPortrait'];
|
||||
toUserID = json['toUserID'];
|
||||
toUserName = json['toUserName'];
|
||||
content = json['content'];
|
||||
image = json['image'];
|
||||
createdAt = json['createdAt'];
|
||||
likeCount = json['likeCount'];
|
||||
isLike = json['isLike'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
///我的评论列表项
|
||||
class UserCommentItem {
|
||||
String? id;
|
||||
String? objID;
|
||||
String? content;
|
||||
int? likeCount;
|
||||
bool? isGodComment;
|
||||
String? vidTitle;
|
||||
String? vidCover;
|
||||
String? createdAt;
|
||||
|
||||
UserCommentItem.fromJson(Map<String, dynamic>? json) {
|
||||
json ??= {};
|
||||
id = json['id'];
|
||||
objID = json['objID'];
|
||||
content = json['content'];
|
||||
likeCount = json['likeCount'];
|
||||
isGodComment = json['isGodComment'];
|
||||
vidTitle = json['vidTitle'];
|
||||
vidCover = json['vidCover'];
|
||||
createdAt = json['createdAt'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user