初始化
This commit is contained in:
@@ -0,0 +1,321 @@
|
||||
import 'package:hgdj/hj_model/actress_info.dart';
|
||||
import 'package:hgdj/hj_model/video_model.dart';
|
||||
import 'package:hgdj/hj_utils/text_util.dart';
|
||||
|
||||
import '../cartoon_media_info.dart';
|
||||
|
||||
class AllMediaInfo {
|
||||
List<Content>? contents;
|
||||
int? countBrowse;
|
||||
int? countCollect;
|
||||
int? countComment;
|
||||
int? countDisLike;
|
||||
int? countLike;
|
||||
int? countPurchases;
|
||||
int? countView;
|
||||
String? createdAt;
|
||||
int? direction;
|
||||
int? freeTime;
|
||||
bool? hasFollow;
|
||||
String? horizontalCover;
|
||||
List<ActressInfo>? allActress;
|
||||
|
||||
String? get coverH {
|
||||
return (horizontalCover?.isNotEmpty == true)
|
||||
? horizontalCover
|
||||
: verticalCover;
|
||||
}
|
||||
|
||||
String? get coverV {
|
||||
return (verticalCover?.isNotEmpty == true)
|
||||
? verticalCover
|
||||
: horizontalCover;
|
||||
}
|
||||
|
||||
String? id;
|
||||
int? kind;
|
||||
String? mId;
|
||||
VidStatus? mediaStatus;
|
||||
String? mediaType;
|
||||
String? moduleName;
|
||||
int? number;
|
||||
int? permission;
|
||||
bool? permissionIconHide;
|
||||
int? price;
|
||||
String? sId;
|
||||
String? sectionName;
|
||||
int? sectionSort;
|
||||
int? sellType;
|
||||
int? sortCode;
|
||||
int? status;
|
||||
String? summary;
|
||||
List<TagsBean>? tagDetails;
|
||||
List<String>? tags;
|
||||
|
||||
String? title;
|
||||
int? totalEpisode; //总集数
|
||||
int? currentEpisode; //当前集数
|
||||
|
||||
int? updateStatus; //0 默认 1、更新中 2、已完结
|
||||
String? updateTime;
|
||||
String? verticalCover;
|
||||
|
||||
AllMediaInfo({
|
||||
this.contents,
|
||||
this.countBrowse,
|
||||
this.countCollect,
|
||||
this.countComment,
|
||||
this.countDisLike,
|
||||
this.countLike,
|
||||
this.countPurchases,
|
||||
this.countView,
|
||||
this.allActress,
|
||||
this.createdAt,
|
||||
this.direction,
|
||||
this.freeTime,
|
||||
this.hasFollow,
|
||||
this.horizontalCover,
|
||||
this.id,
|
||||
this.kind,
|
||||
this.mId,
|
||||
this.mediaStatus,
|
||||
this.mediaType,
|
||||
this.moduleName,
|
||||
this.number,
|
||||
this.permission,
|
||||
this.permissionIconHide,
|
||||
this.price,
|
||||
this.sId,
|
||||
this.sectionName,
|
||||
this.sectionSort,
|
||||
this.sellType,
|
||||
this.sortCode,
|
||||
this.status,
|
||||
this.summary,
|
||||
this.tagDetails,
|
||||
this.tags,
|
||||
this.title,
|
||||
this.totalEpisode,
|
||||
this.currentEpisode,
|
||||
this.updateStatus,
|
||||
this.updateTime,
|
||||
this.verticalCover,
|
||||
});
|
||||
|
||||
//集数状态描述
|
||||
String get episodeNumberStatus {
|
||||
if (updateStatus == 2) {
|
||||
return '共$totalEpisode话';
|
||||
} else {
|
||||
return '更新${currentEpisode != 0 ? currentEpisode : totalEpisode}话';
|
||||
}
|
||||
}
|
||||
|
||||
//更新状态
|
||||
String get updateDesc {
|
||||
if (updateStatus == 2) {
|
||||
return '已完结';
|
||||
} else {
|
||||
return '连载中';
|
||||
}
|
||||
}
|
||||
|
||||
AllMediaInfo.fromJson(Map<String, dynamic> json) {
|
||||
contents = json["contents"] == null
|
||||
? []
|
||||
: List<Content>.from(json["contents"]!.map((x) => Content.fromJson(x)));
|
||||
countBrowse = json["countBrowse"];
|
||||
countCollect = json["countCollect"];
|
||||
countComment = json["countComment"];
|
||||
countDisLike = json["countDisLike"];
|
||||
countLike = json["countLike"];
|
||||
countPurchases = json["countPurchases"];
|
||||
countView = json["countView"];
|
||||
createdAt = json["createdAt"];
|
||||
direction = json["direction"];
|
||||
freeTime = json["freeTime"];
|
||||
hasFollow = json["hasFollow"];
|
||||
horizontalCover = json["horizontalCover"];
|
||||
allActress = json["actresses"] == null
|
||||
? []
|
||||
: List<ActressInfo>.from(
|
||||
json["actresses"]!.map((x) => ActressInfo.fromJson(x)));
|
||||
id = json["id"];
|
||||
kind = json["kind"];
|
||||
mId = json["mId"];
|
||||
mediaStatus = json["mediaStatus"] == null
|
||||
? null
|
||||
: VidStatus.fromMap(json["mediaStatus"]);
|
||||
mediaType = json["mediaType"];
|
||||
moduleName = json["moduleName"];
|
||||
number = json["number"];
|
||||
permission = json["permission"];
|
||||
permissionIconHide = json["permissionIconHide"];
|
||||
price = json["price"];
|
||||
sId = json["sId"];
|
||||
sectionName = json["sectionName"];
|
||||
sectionSort = json["sectionSort"];
|
||||
sellType = json["sellType"];
|
||||
sortCode = json["sortCode"];
|
||||
status = json["status"];
|
||||
summary = json["summary"];
|
||||
tagDetails = json["tagDetails"] == null
|
||||
? []
|
||||
: List<TagsBean>.from(
|
||||
json["tagDetails"]!.map((x) => TagsBean.fromMap(x)));
|
||||
tags = parseStringList(json["tags"]);
|
||||
title = json["title"];
|
||||
totalEpisode = json["totalEpisode"];
|
||||
currentEpisode = json['currentEpisode'];
|
||||
updateStatus = json["updateStatus"];
|
||||
updateTime = json["updateTime"];
|
||||
verticalCover = json["verticalCover"];
|
||||
}
|
||||
}
|
||||
|
||||
class Content {
|
||||
String? audioUrl;
|
||||
int? countBrowse;
|
||||
int? countCollect;
|
||||
int? countComment;
|
||||
int? countDisLike;
|
||||
int? countLike;
|
||||
int? countPurchases;
|
||||
String? createdAt;
|
||||
int? episodeNumber;
|
||||
int? height;
|
||||
String? id;
|
||||
int? listenPermission;
|
||||
String? md5;
|
||||
String? mediaId;
|
||||
int? mediaSize;
|
||||
VidStatus? mediaStatus;
|
||||
String? name;
|
||||
int? playTime;
|
||||
int? price;
|
||||
double? ratio;
|
||||
String? text;
|
||||
String? updateTime;
|
||||
List<String>? urlSet;
|
||||
String? videoUrl;
|
||||
int? weight;
|
||||
|
||||
Content({
|
||||
this.audioUrl,
|
||||
this.countBrowse,
|
||||
this.countCollect,
|
||||
this.countComment,
|
||||
this.countDisLike,
|
||||
this.countLike,
|
||||
this.countPurchases,
|
||||
this.createdAt,
|
||||
this.episodeNumber,
|
||||
this.height,
|
||||
this.id,
|
||||
this.listenPermission,
|
||||
this.md5,
|
||||
this.mediaId,
|
||||
this.mediaSize,
|
||||
this.mediaStatus,
|
||||
this.name,
|
||||
this.playTime,
|
||||
this.price,
|
||||
this.ratio,
|
||||
this.text,
|
||||
this.updateTime,
|
||||
this.urlSet,
|
||||
this.videoUrl,
|
||||
this.weight,
|
||||
});
|
||||
|
||||
Content.fromJson(Map<String, dynamic> json) {
|
||||
audioUrl = json["audioUrl"];
|
||||
countBrowse = json["countBrowse"];
|
||||
countCollect = json["countCollect"];
|
||||
countComment = json["countComment"];
|
||||
countDisLike = json["countDisLike"];
|
||||
countLike = json["countLike"];
|
||||
countPurchases = json["countPurchases"];
|
||||
createdAt = json["createdAt"];
|
||||
episodeNumber = json["episodeNumber"];
|
||||
height = json["height"];
|
||||
id = json["id"];
|
||||
listenPermission = json["listenPermission"];
|
||||
md5 = json["md5"];
|
||||
mediaId = json["mediaId"];
|
||||
mediaSize = json["mediaSize"];
|
||||
mediaStatus = json["mediaStatus"] == null
|
||||
? null
|
||||
: VidStatus.fromMap(json["mediaStatus"]);
|
||||
name = json["name"];
|
||||
playTime = json["playTime"];
|
||||
price = json["price"];
|
||||
ratio = double.tryParse(json['ratio']?.toString() ?? '');
|
||||
text = json["text"];
|
||||
updateTime = json["updateTime"];
|
||||
urlSet = parseStringList(json["urlSet"]);
|
||||
videoUrl = json["videoUrl"];
|
||||
weight = json["weight"];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"audioUrl": audioUrl,
|
||||
"countBrowse": countBrowse,
|
||||
"countCollect": countCollect,
|
||||
"countComment": countComment,
|
||||
"countDisLike": countDisLike,
|
||||
"countLike": countLike,
|
||||
"countPurchases": countPurchases,
|
||||
"createdAt": createdAt,
|
||||
"episodeNumber": episodeNumber,
|
||||
"height": height,
|
||||
"id": id,
|
||||
"listenPermission": listenPermission,
|
||||
"md5": md5,
|
||||
"mediaId": mediaId,
|
||||
"mediaSize": mediaSize,
|
||||
"mediaStatus": mediaStatus?.toJson(),
|
||||
"name": name,
|
||||
"playTime": playTime,
|
||||
"price": price,
|
||||
"ratio": ratio,
|
||||
"text": text,
|
||||
"updateTime": updateTime,
|
||||
"urlSet":
|
||||
urlSet == null ? [] : List<dynamic>.from(urlSet!.map((x) => x)),
|
||||
"videoUrl": videoUrl,
|
||||
"weight": weight,
|
||||
};
|
||||
}
|
||||
|
||||
class MediaSearchListModel {
|
||||
bool? hasNext;
|
||||
List<CartoonMediaInfo>? list;
|
||||
List<CartoonMediaInfo>? tagMedia;
|
||||
String? tagId;
|
||||
int? total;
|
||||
|
||||
MediaSearchListModel({this.hasNext, this.list, this.total, this.tagId});
|
||||
|
||||
MediaSearchListModel.fromJson(dynamic json) {
|
||||
hasNext = json['hasNext'];
|
||||
list = (json['list'] as List?)
|
||||
?.map((v) => CartoonMediaInfo.fromJson(v))
|
||||
.toList();
|
||||
tagMedia = (json['tagMedia'] as List?)
|
||||
?.map((v) => CartoonMediaInfo.fromJson(v))
|
||||
.toList();
|
||||
tagId = json['tagId'];
|
||||
total = json['total'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['hasNext'] = hasNext;
|
||||
|
||||
map['list'] = list?.map((v) => v.toJson()).toList();
|
||||
|
||||
map['total'] = total;
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
//漫画章节
|
||||
import 'package:hgdj/config/address.dart' as address;
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
import '../media_content.dart';
|
||||
|
||||
class ComicChapterInfo {
|
||||
int? episodeNumber;
|
||||
bool? hasBuy;
|
||||
String? id;
|
||||
int? listenPermission; // 0:会员 1:金币购买 2:免费
|
||||
String? mediaId;
|
||||
String? name;
|
||||
int? price;
|
||||
String? createdAt;
|
||||
String? cover;
|
||||
String? audioUrl;
|
||||
|
||||
bool inFreeEpisode = false; //是否属于免费集数(前 freeEpisode 集)
|
||||
|
||||
MediaContent? mediaContent; //(另外的接口数据返回,外部手动赋值)
|
||||
|
||||
// 有声小说
|
||||
String get getRealAudioUrl {
|
||||
if (audioUrl == null || audioUrl!.isEmpty) {
|
||||
return "";
|
||||
}
|
||||
if (!audioUrl!.startsWith("http") && !audioUrl!.startsWith("https")) {
|
||||
return path.join(address.Address.audioCdnAddress ?? '', audioUrl);
|
||||
}
|
||||
return audioUrl!;
|
||||
}
|
||||
|
||||
ComicChapterInfo({
|
||||
this.episodeNumber,
|
||||
this.hasBuy,
|
||||
this.id,
|
||||
this.listenPermission,
|
||||
this.mediaId,
|
||||
this.name,
|
||||
this.price,
|
||||
this.createdAt,
|
||||
this.cover,
|
||||
this.audioUrl,
|
||||
});
|
||||
|
||||
ComicChapterInfo.fromJson(Map<String, dynamic> json) {
|
||||
episodeNumber = json['episodeNumber'];
|
||||
hasBuy = json['hasBuy'];
|
||||
id = json['id'];
|
||||
listenPermission = json['listenPermission'];
|
||||
mediaId = json['mediaId'];
|
||||
name = json['name'];
|
||||
price = json['price'];
|
||||
createdAt = json['createdAt'];
|
||||
cover = json['cover'];
|
||||
audioUrl = json['audioUrl'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['episodeNumber'] = episodeNumber;
|
||||
data['hasBuy'] = hasBuy;
|
||||
data['id'] = id;
|
||||
data['listenPermission'] = listenPermission;
|
||||
data['mediaId'] = mediaId;
|
||||
data['name'] = name;
|
||||
data['price'] = price;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user