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? 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? 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(); } }