v1.0.1
This commit is contained in:
87
lib/models/comic/author_model.dart
Normal file
87
lib/models/comic/author_model.dart
Normal file
@@ -0,0 +1,87 @@
|
||||
import 'dart:convert';
|
||||
|
||||
T? asT<T>(dynamic value) {
|
||||
if (value is T) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class ComicAuthorModel {
|
||||
ComicAuthorModel({
|
||||
required this.nickname,
|
||||
this.description,
|
||||
required this.cover,
|
||||
required this.data,
|
||||
});
|
||||
|
||||
factory ComicAuthorModel.fromJson(Map<String, dynamic> json) {
|
||||
final List<ComicAuthorComicModel>? data =
|
||||
json['data'] is List ? <ComicAuthorComicModel>[] : null;
|
||||
if (data != null) {
|
||||
for (final dynamic item in json['data']!) {
|
||||
if (item != null) {
|
||||
data.add(
|
||||
ComicAuthorComicModel.fromJson(asT<Map<String, dynamic>>(item)!));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ComicAuthorModel(
|
||||
nickname: asT<String>(json['nickname'])!,
|
||||
description: asT<String?>(json['description']) ?? "",
|
||||
cover: asT<String>(json['cover'])!,
|
||||
data: data!,
|
||||
);
|
||||
}
|
||||
|
||||
String nickname;
|
||||
String? description;
|
||||
String cover;
|
||||
List<ComicAuthorComicModel> data;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'nickname': nickname,
|
||||
'description': description,
|
||||
'cover': cover,
|
||||
'data': data,
|
||||
};
|
||||
}
|
||||
|
||||
class ComicAuthorComicModel {
|
||||
ComicAuthorComicModel({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.cover,
|
||||
required this.status,
|
||||
});
|
||||
|
||||
factory ComicAuthorComicModel.fromJson(Map<String, dynamic> json) =>
|
||||
ComicAuthorComicModel(
|
||||
id: asT<int>(json['id'])!,
|
||||
name: asT<String>(json['name'])!,
|
||||
cover: asT<String>(json['cover'])!,
|
||||
status: asT<String>(json['status'])!,
|
||||
);
|
||||
|
||||
int id;
|
||||
String name;
|
||||
String cover;
|
||||
String status;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'id': id,
|
||||
'name': name,
|
||||
'cover': cover,
|
||||
'status': status,
|
||||
};
|
||||
}
|
||||
157
lib/models/comic/category_comic_model.dart
Normal file
157
lib/models/comic/category_comic_model.dart
Normal file
@@ -0,0 +1,157 @@
|
||||
import 'dart:convert';
|
||||
|
||||
T? asT<T>(dynamic value) {
|
||||
if (value is T) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class ComicCategoryComicModel {
|
||||
ComicCategoryComicModel({
|
||||
required this.id,
|
||||
required this.name,
|
||||
this.authors,
|
||||
this.types,
|
||||
this.status,
|
||||
this.lastUpdateChapterName,
|
||||
this.lastUpdateChapterId,
|
||||
this.lastUpdatetime,
|
||||
this.cover,
|
||||
this.comicPy,
|
||||
this.isFee,
|
||||
this.hotNum,
|
||||
this.authorTag,
|
||||
this.authorTagList,
|
||||
this.copyright,
|
||||
});
|
||||
|
||||
factory ComicCategoryComicModel.fromJson(Map<String, dynamic> json) {
|
||||
final List<AuthorTagList>? authorTagList =
|
||||
json['authorTagList'] is List ? <AuthorTagList>[] : null;
|
||||
if (authorTagList != null) {
|
||||
for (final dynamic item in json['authorTagList']!) {
|
||||
if (item != null) {
|
||||
authorTagList
|
||||
.add(AuthorTagList.fromJson(asT<Map<String, dynamic>>(item)!));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ComicCategoryComicModel(
|
||||
id: asT<int>(json['id'])!,
|
||||
name: asT<String>(json['name'])!,
|
||||
authors: asT<String?>(json['authors']),
|
||||
types: asT<String?>(json['types']),
|
||||
status: asT<String?>(json['status']),
|
||||
lastUpdateChapterName: asT<String?>(json['last_update_chapter_name']),
|
||||
lastUpdateChapterId: asT<int?>(json['last_update_chapter_id']),
|
||||
lastUpdatetime: asT<int?>(json['last_updatetime']),
|
||||
cover: asT<String?>(json['cover']),
|
||||
comicPy: asT<String?>(json['comic_py']),
|
||||
isFee: asT<bool?>(json['isFee']),
|
||||
hotNum: asT<int?>(json['hotNum']),
|
||||
authorTag: json['authorTag'] == null
|
||||
? null
|
||||
: AuthorTag.fromJson(asT<Map<String, dynamic>>(json['authorTag'])!),
|
||||
authorTagList: authorTagList,
|
||||
copyright: asT<int?>(json['copyright']),
|
||||
);
|
||||
}
|
||||
|
||||
int id;
|
||||
String name;
|
||||
String? authors;
|
||||
String? types;
|
||||
String? status;
|
||||
String? lastUpdateChapterName;
|
||||
int? lastUpdateChapterId;
|
||||
int? lastUpdatetime;
|
||||
String? cover;
|
||||
String? comicPy;
|
||||
bool? isFee;
|
||||
int? hotNum;
|
||||
AuthorTag? authorTag;
|
||||
List<AuthorTagList>? authorTagList;
|
||||
int? copyright;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'id': id,
|
||||
'name': name,
|
||||
'authors': authors,
|
||||
'types': types,
|
||||
'status': status,
|
||||
'last_update_chapter_name': lastUpdateChapterName,
|
||||
'last_update_chapter_id': lastUpdateChapterId,
|
||||
'last_updatetime': lastUpdatetime,
|
||||
'cover': cover,
|
||||
'comic_py': comicPy,
|
||||
'isFee': isFee,
|
||||
'hotNum': hotNum,
|
||||
'authorTag': authorTag,
|
||||
'authorTagList': authorTagList,
|
||||
'copyright': copyright,
|
||||
};
|
||||
}
|
||||
|
||||
class AuthorTag {
|
||||
AuthorTag({
|
||||
this.id,
|
||||
this.tagName,
|
||||
this.tagPy,
|
||||
});
|
||||
|
||||
factory AuthorTag.fromJson(Map<String, dynamic> json) => AuthorTag(
|
||||
id: asT<int?>(json['id']),
|
||||
tagName: asT<String?>(json['tagName']),
|
||||
tagPy: asT<String?>(json['tagPy']),
|
||||
);
|
||||
|
||||
int? id;
|
||||
String? tagName;
|
||||
String? tagPy;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'id': id,
|
||||
'tagName': tagName,
|
||||
'tagPy': tagPy,
|
||||
};
|
||||
}
|
||||
|
||||
class AuthorTagList {
|
||||
AuthorTagList({
|
||||
this.id,
|
||||
this.tagName,
|
||||
this.tagPy,
|
||||
});
|
||||
|
||||
factory AuthorTagList.fromJson(Map<String, dynamic> json) => AuthorTagList(
|
||||
id: asT<int?>(json['id']),
|
||||
tagName: asT<String?>(json['tagName']),
|
||||
tagPy: asT<String?>(json['tagPy']),
|
||||
);
|
||||
|
||||
int? id;
|
||||
String? tagName;
|
||||
String? tagPy;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'id': id,
|
||||
'tagName': tagName,
|
||||
'tagPy': tagPy,
|
||||
};
|
||||
}
|
||||
73
lib/models/comic/category_filter_model.dart
Normal file
73
lib/models/comic/category_filter_model.dart
Normal file
@@ -0,0 +1,73 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
T? asT<T>(dynamic value) {
|
||||
if (value is T) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class ComicCategoryFilterModel {
|
||||
ComicCategoryFilterModel({
|
||||
required this.title,
|
||||
required this.items,
|
||||
});
|
||||
|
||||
factory ComicCategoryFilterModel.fromJson(Map<String, dynamic> json) {
|
||||
final List<ComicCategoryFilterItemModel>? items =
|
||||
json['items'] is List ? <ComicCategoryFilterItemModel>[] : null;
|
||||
if (items != null) {
|
||||
for (final dynamic item in json['items']!) {
|
||||
if (item != null) {
|
||||
items.add(ComicCategoryFilterItemModel.fromJson(
|
||||
asT<Map<String, dynamic>>(item)!));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ComicCategoryFilterModel(
|
||||
title: asT<String>(json['title'])!,
|
||||
items: items!,
|
||||
);
|
||||
}
|
||||
|
||||
String title;
|
||||
List<ComicCategoryFilterItemModel> items;
|
||||
var selectId = 0.obs;
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'title': title,
|
||||
'items': items,
|
||||
};
|
||||
}
|
||||
|
||||
class ComicCategoryFilterItemModel {
|
||||
ComicCategoryFilterItemModel({
|
||||
required this.tagId,
|
||||
required this.tagName,
|
||||
});
|
||||
|
||||
factory ComicCategoryFilterItemModel.fromJson(Map<String, dynamic> json) =>
|
||||
ComicCategoryFilterItemModel(
|
||||
tagId: asT<int>(json['tagId'])!,
|
||||
tagName: asT<String>(json['title'])!,
|
||||
);
|
||||
|
||||
int tagId;
|
||||
String tagName;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'tag_id': tagId,
|
||||
'tag_name': tagName,
|
||||
};
|
||||
}
|
||||
38
lib/models/comic/category_item_model.dart
Normal file
38
lib/models/comic/category_item_model.dart
Normal file
@@ -0,0 +1,38 @@
|
||||
import 'dart:convert';
|
||||
|
||||
T? asT<T>(dynamic value) {
|
||||
if (value is T) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class ComicCategoryItemModel {
|
||||
ComicCategoryItemModel({
|
||||
required this.tagId,
|
||||
required this.title,
|
||||
required this.cover,
|
||||
});
|
||||
|
||||
factory ComicCategoryItemModel.fromJson(Map<String, dynamic> json) =>
|
||||
ComicCategoryItemModel(
|
||||
tagId: asT<int>(json['tagId'])!,
|
||||
title: asT<String>(json['title'])!,
|
||||
cover: asT<String>(json['cover'])!,
|
||||
);
|
||||
|
||||
int tagId;
|
||||
String title;
|
||||
String cover;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'tagId': tagId,
|
||||
'title': title,
|
||||
'cover': cover,
|
||||
};
|
||||
}
|
||||
77
lib/models/comic/chapter_detail_model.dart
Normal file
77
lib/models/comic/chapter_detail_model.dart
Normal file
@@ -0,0 +1,77 @@
|
||||
import 'dart:convert';
|
||||
|
||||
T? asT<T>(dynamic value) {
|
||||
if (value is T) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class ComicChapterDetailModel {
|
||||
ComicChapterDetailModel({
|
||||
required this.chapterId,
|
||||
required this.comicId,
|
||||
required this.title,
|
||||
required this.chapterOrder,
|
||||
required this.direction,
|
||||
required this.pageUrl,
|
||||
required this.picnum,
|
||||
required this.pageUrlHd,
|
||||
});
|
||||
|
||||
factory ComicChapterDetailModel.fromJson(Map<String, dynamic> json) {
|
||||
final List<String>? pageUrl = json['page_url'] is List ? <String>[] : null;
|
||||
if (pageUrl != null) {
|
||||
for (final dynamic item in json['page_url']!) {
|
||||
if (item != null) {
|
||||
pageUrl.add(asT<String>(item)!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final List<String>? pageUrlHd =
|
||||
json['page_url_hd'] is List ? <String>[] : null;
|
||||
if (pageUrlHd != null) {
|
||||
for (final dynamic item in json['page_url_hd']!) {
|
||||
if (item != null) {
|
||||
pageUrlHd.add(asT<String>(item)!);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ComicChapterDetailModel(
|
||||
chapterId: asT<int>(json['chapter_id'])!,
|
||||
comicId: asT<int>(json['comic_id'])!,
|
||||
title: asT<String>(json['title'])!,
|
||||
chapterOrder: asT<int>(json['chapter_order'])!,
|
||||
direction: asT<int>(json['direction'])!,
|
||||
pageUrl: pageUrl!,
|
||||
picnum: asT<int>(json['picnum'])!,
|
||||
pageUrlHd: pageUrlHd!,
|
||||
);
|
||||
}
|
||||
|
||||
int chapterId;
|
||||
int comicId;
|
||||
String title;
|
||||
int chapterOrder;
|
||||
int direction;
|
||||
List<String> pageUrl;
|
||||
int picnum;
|
||||
List<String> pageUrlHd;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'chapter_id': chapterId,
|
||||
'comic_id': comicId,
|
||||
'title': title,
|
||||
'chapter_order': chapterOrder,
|
||||
'direction': direction,
|
||||
'page_url': pageUrl,
|
||||
'picnum': picnum,
|
||||
'page_url_hd': pageUrlHd,
|
||||
};
|
||||
}
|
||||
155
lib/models/comic/chapter_detail_web_model.dart
Normal file
155
lib/models/comic/chapter_detail_web_model.dart
Normal file
@@ -0,0 +1,155 @@
|
||||
import 'dart:convert';
|
||||
|
||||
T? asT<T>(dynamic value) {
|
||||
if (value is T) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class ComicChapterDetailWebModel {
|
||||
ComicChapterDetailWebModel({
|
||||
required this.id,
|
||||
required this.comicId,
|
||||
required this.chapterName,
|
||||
required this.chapterOrder,
|
||||
required this.createtime,
|
||||
required this.folder,
|
||||
required this.pageUrl,
|
||||
required this.chapterType,
|
||||
required this.chaptertype,
|
||||
required this.chapterTrueType,
|
||||
required this.chapterNum,
|
||||
required this.updatetime,
|
||||
required this.sumPages,
|
||||
required this.snsTag,
|
||||
required this.uid,
|
||||
required this.username,
|
||||
required this.translatorid,
|
||||
required this.translator,
|
||||
required this.link,
|
||||
required this.message,
|
||||
required this.download,
|
||||
required this.hidden,
|
||||
required this.direction,
|
||||
required this.filesize,
|
||||
required this.highFileSize,
|
||||
required this.picnum,
|
||||
required this.hit,
|
||||
required this.nextChapId,
|
||||
required this.prevChapId,
|
||||
required this.commentCount,
|
||||
});
|
||||
|
||||
factory ComicChapterDetailWebModel.fromJson(Map<String, dynamic> json) {
|
||||
final List<String>? pageUrl = json['page_url'] is List ? <String>[] : null;
|
||||
if (pageUrl != null) {
|
||||
for (final dynamic item in json['page_url']!) {
|
||||
if (item != null) {
|
||||
pageUrl.add(asT<String>(item)!);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ComicChapterDetailWebModel(
|
||||
id: asT<int>(json['id'])!,
|
||||
comicId: asT<int>(json['comic_id'])!,
|
||||
chapterName: asT<String>(json['chapter_name'])!,
|
||||
chapterOrder: asT<int>(json['chapter_order'])!,
|
||||
createtime: asT<int>(json['createtime'])!,
|
||||
folder: asT<String>(json['folder'])!,
|
||||
pageUrl: pageUrl!,
|
||||
chapterType: asT<int>(json['chapter_type'])!,
|
||||
chaptertype: asT<int>(json['chaptertype'])!,
|
||||
chapterTrueType: asT<int>(json['chapter_true_type'])!,
|
||||
chapterNum: asT<int>(json['chapter_num']) ?? 0,
|
||||
updatetime: asT<int>(json['updatetime'])!,
|
||||
sumPages: asT<int>(json['sum_pages'])!,
|
||||
snsTag: asT<int>(json['sns_tag'])!,
|
||||
uid: asT<int>(json['uid'])!,
|
||||
username: asT<String>(json['username'])!,
|
||||
translatorid: asT<String>(json['translatorid'])!,
|
||||
translator: asT<String>(json['translator'])!,
|
||||
link: asT<String>(json['link'])!,
|
||||
message: asT<String>(json['message'])!,
|
||||
download: asT<String>(json['download'])!,
|
||||
hidden: asT<int>(json['hidden'])!,
|
||||
direction: asT<int>(json['direction']) ?? 0,
|
||||
filesize: asT<int>(json['filesize']) ?? 0,
|
||||
highFileSize: asT<int>(json['high_file_size']) ?? 0,
|
||||
picnum: asT<int>(json['picnum']) ?? 0,
|
||||
hit: asT<int>(json['hit'])!,
|
||||
nextChapId: asT<int?>(json['next_chap_id']) ?? 0,
|
||||
prevChapId: asT<int?>(json['prev_chap_id']) ?? 0,
|
||||
commentCount: asT<int>(json['comment_count'])!,
|
||||
);
|
||||
}
|
||||
|
||||
int id;
|
||||
int comicId;
|
||||
String chapterName;
|
||||
int chapterOrder;
|
||||
int createtime;
|
||||
String folder;
|
||||
List<String> pageUrl;
|
||||
int chapterType;
|
||||
int chaptertype;
|
||||
int chapterTrueType;
|
||||
int chapterNum;
|
||||
int updatetime;
|
||||
int sumPages;
|
||||
int snsTag;
|
||||
int uid;
|
||||
String username;
|
||||
String translatorid;
|
||||
String translator;
|
||||
String link;
|
||||
String message;
|
||||
String download;
|
||||
int hidden;
|
||||
int direction;
|
||||
int filesize;
|
||||
int highFileSize;
|
||||
int picnum;
|
||||
int hit;
|
||||
int nextChapId;
|
||||
int prevChapId;
|
||||
int commentCount;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'id': id,
|
||||
'comic_id': comicId,
|
||||
'chapter_name': chapterName,
|
||||
'chapter_order': chapterOrder,
|
||||
'createtime': createtime,
|
||||
'folder': folder,
|
||||
'page_url': pageUrl,
|
||||
'chapter_type': chapterType,
|
||||
'chaptertype': chaptertype,
|
||||
'chapter_true_type': chapterTrueType,
|
||||
'chapter_num': chapterNum,
|
||||
'updatetime': updatetime,
|
||||
'sum_pages': sumPages,
|
||||
'sns_tag': snsTag,
|
||||
'uid': uid,
|
||||
'username': username,
|
||||
'translatorid': translatorid,
|
||||
'translator': translator,
|
||||
'link': link,
|
||||
'message': message,
|
||||
'download': download,
|
||||
'hidden': hidden,
|
||||
'direction': direction,
|
||||
'filesize': filesize,
|
||||
'high_file_size': highFileSize,
|
||||
'picnum': picnum,
|
||||
'hit': hit,
|
||||
'next_chap_id': nextChapId,
|
||||
'prev_chap_id': prevChapId,
|
||||
'comment_count': commentCount,
|
||||
};
|
||||
}
|
||||
83
lib/models/comic/chapter_info.dart
Normal file
83
lib/models/comic/chapter_info.dart
Normal file
@@ -0,0 +1,83 @@
|
||||
import 'package:flutter_dmzj/models/comic/chapter_detail_model.dart';
|
||||
import 'package:flutter_dmzj/models/comic/chapter_detail_web_model.dart';
|
||||
import 'package:flutter_dmzj/models/db/comic_download_info.dart';
|
||||
import 'package:flutter_dmzj/services/comic_download_service.dart';
|
||||
|
||||
// ignore: depend_on_referenced_packages
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
class ComicChapterDetail {
|
||||
ComicChapterDetail({
|
||||
required this.chapterId,
|
||||
required this.comicId,
|
||||
required this.chapterOrder,
|
||||
required this.direction,
|
||||
required this.chapterTitle,
|
||||
required this.pageUrls,
|
||||
required this.picnum,
|
||||
required this.commentCount,
|
||||
this.isLocal = false,
|
||||
});
|
||||
factory ComicChapterDetail.empty() => ComicChapterDetail(
|
||||
chapterId: 0,
|
||||
comicId: 0,
|
||||
chapterOrder: 0,
|
||||
direction: 0,
|
||||
chapterTitle: "",
|
||||
pageUrls: [],
|
||||
picnum: 0,
|
||||
commentCount: 0,
|
||||
);
|
||||
factory ComicChapterDetail.fromWebApi(ComicChapterDetailWebModel item) =>
|
||||
ComicChapterDetail(
|
||||
chapterId: item.id,
|
||||
comicId: item.comicId,
|
||||
chapterOrder: item.chapterOrder,
|
||||
direction: item.direction,
|
||||
chapterTitle: item.chapterName,
|
||||
pageUrls: item.pageUrl,
|
||||
picnum: item.picnum,
|
||||
commentCount: item.commentCount,
|
||||
);
|
||||
|
||||
factory ComicChapterDetail.fromV4(ComicChapterDetailModel item, bool useHD) =>
|
||||
ComicChapterDetail(
|
||||
chapterId: item.chapterId.toInt(),
|
||||
comicId: item.comicId.toInt(),
|
||||
chapterOrder: item.chapterOrder,
|
||||
direction: item.direction,
|
||||
chapterTitle: item.title,
|
||||
pageUrls: useHD
|
||||
? (item.pageUrlHd.isNotEmpty ? item.pageUrlHd : item.pageUrl)
|
||||
: (item.pageUrl.isNotEmpty ? item.pageUrl : item.pageUrlHd),
|
||||
//pageUrls: item.pageUrlHD.isNotEmpty ? item.pageUrlHD : item.pageUrl,
|
||||
picnum: item.picnum,
|
||||
commentCount: 0,
|
||||
);
|
||||
|
||||
factory ComicChapterDetail.fromDownload(ComicDownloadInfo item) =>
|
||||
ComicChapterDetail(
|
||||
chapterId: item.chapterId.toInt(),
|
||||
comicId: item.comicId.toInt(),
|
||||
chapterOrder: item.chapterSort,
|
||||
direction: 1,
|
||||
chapterTitle: item.chapterName,
|
||||
pageUrls: item.files
|
||||
.map((e) =>
|
||||
p.join(ComicDownloadService.instance.savePath, item.taskId, e))
|
||||
.toList(),
|
||||
picnum: item.files.length,
|
||||
commentCount: 0,
|
||||
isLocal: true,
|
||||
);
|
||||
|
||||
int chapterId;
|
||||
int comicId;
|
||||
int chapterOrder;
|
||||
int direction;
|
||||
String chapterTitle;
|
||||
List<String> pageUrls;
|
||||
int picnum;
|
||||
int commentCount;
|
||||
bool isLocal;
|
||||
}
|
||||
146
lib/models/comic/comic_related_model.dart
Normal file
146
lib/models/comic/comic_related_model.dart
Normal file
@@ -0,0 +1,146 @@
|
||||
import 'dart:convert';
|
||||
|
||||
T? asT<T>(dynamic value) {
|
||||
if (value is T) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class ComicRelatedModel {
|
||||
ComicRelatedModel({
|
||||
required this.authorComics,
|
||||
required this.themeComics,
|
||||
required this.novels,
|
||||
});
|
||||
|
||||
factory ComicRelatedModel.fromJson(Map<String, dynamic> json) {
|
||||
final List<ComicRelatedAuthorModel>? authorComics =
|
||||
json['author_comics'] is List ? <ComicRelatedAuthorModel>[] : null;
|
||||
if (authorComics != null) {
|
||||
for (final dynamic item in json['author_comics']!) {
|
||||
if (item != null) {
|
||||
authorComics.add(ComicRelatedAuthorModel.fromJson(
|
||||
asT<Map<String, dynamic>>(item)!));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final List<ComicRelatedItemModel>? themeComics =
|
||||
json['theme_comics'] is List ? <ComicRelatedItemModel>[] : null;
|
||||
if (themeComics != null) {
|
||||
for (final dynamic item in json['theme_comics']!) {
|
||||
if (item != null) {
|
||||
themeComics.add(
|
||||
ComicRelatedItemModel.fromJson(asT<Map<String, dynamic>>(item)!));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final List<ComicRelatedItemModel>? novels =
|
||||
json['novels'] is List ? <ComicRelatedItemModel>[] : null;
|
||||
if (novels != null) {
|
||||
for (final dynamic item in json['novels']!) {
|
||||
if (item != null) {
|
||||
novels.add(
|
||||
ComicRelatedItemModel.fromJson(asT<Map<String, dynamic>>(item)!));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ComicRelatedModel(
|
||||
authorComics: authorComics!,
|
||||
themeComics: themeComics!,
|
||||
novels: novels!,
|
||||
);
|
||||
}
|
||||
|
||||
List<ComicRelatedAuthorModel> authorComics;
|
||||
List<ComicRelatedItemModel> themeComics;
|
||||
List<ComicRelatedItemModel> novels;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'author_comics': authorComics,
|
||||
'theme_comics': themeComics,
|
||||
'novels': novels,
|
||||
};
|
||||
}
|
||||
|
||||
class ComicRelatedAuthorModel {
|
||||
ComicRelatedAuthorModel({
|
||||
required this.authorName,
|
||||
required this.authorId,
|
||||
required this.data,
|
||||
});
|
||||
|
||||
factory ComicRelatedAuthorModel.fromJson(Map<String, dynamic> json) {
|
||||
final List<ComicRelatedItemModel>? data =
|
||||
json['data'] is List ? <ComicRelatedItemModel>[] : null;
|
||||
if (data != null) {
|
||||
for (final dynamic item in json['data']!) {
|
||||
if (item != null) {
|
||||
data.add(
|
||||
ComicRelatedItemModel.fromJson(asT<Map<String, dynamic>>(item)!));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ComicRelatedAuthorModel(
|
||||
authorName: asT<String>(json['author_name'])!,
|
||||
authorId: asT<int>(json['author_id'])!,
|
||||
data: data!,
|
||||
);
|
||||
}
|
||||
|
||||
String authorName;
|
||||
int authorId;
|
||||
List<ComicRelatedItemModel> data;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'author_name': authorName,
|
||||
'author_id': authorId,
|
||||
'data': data,
|
||||
};
|
||||
}
|
||||
|
||||
class ComicRelatedItemModel {
|
||||
ComicRelatedItemModel({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.cover,
|
||||
required this.status,
|
||||
});
|
||||
|
||||
factory ComicRelatedItemModel.fromJson(Map<String, dynamic> json) =>
|
||||
ComicRelatedItemModel(
|
||||
id: asT<int>(json['id'])!,
|
||||
name: asT<String>(json['name'])!,
|
||||
cover: asT<String>(json['cover'])!,
|
||||
status: asT<String>(json['status'])!,
|
||||
);
|
||||
|
||||
int id;
|
||||
String name;
|
||||
String cover;
|
||||
String status;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'id': id,
|
||||
'name': name,
|
||||
'cover': cover,
|
||||
'status': status,
|
||||
};
|
||||
}
|
||||
275
lib/models/comic/detail_info.dart
Normal file
275
lib/models/comic/detail_info.dart
Normal file
@@ -0,0 +1,275 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter_dmzj/models/comic/detail_model.dart';
|
||||
import 'package:flutter_dmzj/models/comic/detail_v1_model.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
T? asT<T>(dynamic value) {
|
||||
if (value is T) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class ComicDetailInfo {
|
||||
ComicDetailInfo({
|
||||
this.id = 0,
|
||||
this.title = "",
|
||||
this.direction = 0,
|
||||
this.isLong = false,
|
||||
this.cover = "",
|
||||
this.description = "",
|
||||
this.lastUpdatetime = 0,
|
||||
this.lastUpdatechapterName = "",
|
||||
this.firstLetter = "",
|
||||
this.comicPy = "",
|
||||
this.hotNum = 0,
|
||||
this.hitNum = 0,
|
||||
this.lastUpdateChapterId = 0,
|
||||
required this.types,
|
||||
required this.status,
|
||||
required this.authors,
|
||||
this.subscribeNum = 0,
|
||||
required this.volumes,
|
||||
this.isHide = false,
|
||||
this.isVip = false,
|
||||
});
|
||||
|
||||
factory ComicDetailInfo.empty() => ComicDetailInfo(
|
||||
types: [],
|
||||
status: [],
|
||||
authors: [],
|
||||
volumes: [],
|
||||
);
|
||||
|
||||
factory ComicDetailInfo.fromV4(ComicDetailModel data) => ComicDetailInfo(
|
||||
id: data.data.id,
|
||||
title: data.data.title,
|
||||
direction: data.data.direction ?? 0,
|
||||
isLong: data.data.islong == 1,
|
||||
cover: data.data.cover ?? "",
|
||||
description: data.data.description ?? "",
|
||||
lastUpdateChapterId: data.data.lastUpdateChapterId ?? 0,
|
||||
lastUpdatechapterName: data.data.lastUpdateChapterName ?? "",
|
||||
lastUpdatetime: data.data.lastUpdatetime ?? 0,
|
||||
hitNum: 0,
|
||||
hotNum: 0,
|
||||
subscribeNum: 0,
|
||||
firstLetter: data.data.firstLetter ?? "",
|
||||
comicPy: data.data.comicPy ?? "",
|
||||
isVip: false,
|
||||
types: (data.data.types ?? [])
|
||||
.map(
|
||||
(e) => ComicDetailTag(
|
||||
tagId: e.tagId.toInt(),
|
||||
tagName: e.tagName,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
status: (data.data.status ?? [])
|
||||
.map(
|
||||
(e) => ComicDetailTag(
|
||||
tagId: e.tagId.toInt(),
|
||||
tagName: e.tagName,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
authors: (data.data.authors ?? [])
|
||||
.map(
|
||||
(e) => ComicDetailTag(
|
||||
tagId: e.tagId,
|
||||
tagName: e.tagName,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
volumes: (data.data.chapters ?? [])
|
||||
.map(
|
||||
(e) => ComicDetailVolume(
|
||||
title: e.title!,
|
||||
chapters: RxList<ComicDetailChapterItem>(
|
||||
(e.data ?? [])
|
||||
.map(
|
||||
(x) => ComicDetailChapterItem(
|
||||
chapterId: x.chapterId.toInt(),
|
||||
chapterTitle: x.chapterTitle,
|
||||
updateTime: x.updatetime ?? 0,
|
||||
fileSize: 0,
|
||||
chapterOrder: x.chapterOrder,
|
||||
isVip: false,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
);
|
||||
factory ComicDetailInfo.fromV1(ComicDetailV1Model model,
|
||||
{bool isHide = false}) {
|
||||
var lastChapterId = 0;
|
||||
List<ComicDetailVolume> volumes = [];
|
||||
List<ComicDetailChapterItem> serialItems = [];
|
||||
List<ComicDetailChapterItem> aloneItems = [];
|
||||
for (var item in model.list) {
|
||||
serialItems.add(
|
||||
ComicDetailChapterItem(
|
||||
chapterId: int.tryParse(item.id) ?? 0,
|
||||
chapterTitle: item.chapterName,
|
||||
updateTime: int.tryParse(item.updatetime) ?? 0,
|
||||
fileSize: int.tryParse(item.filesize) ?? 0,
|
||||
chapterOrder: int.tryParse(item.chapterOrder) ?? 0,
|
||||
),
|
||||
);
|
||||
}
|
||||
for (var item in model.alone) {
|
||||
aloneItems.add(
|
||||
ComicDetailChapterItem(
|
||||
chapterId: int.tryParse(item.id) ?? 0,
|
||||
chapterTitle: item.chapterName,
|
||||
updateTime: int.tryParse(item.updatetime) ?? 0,
|
||||
fileSize: int.tryParse(item.filesize) ?? 0,
|
||||
chapterOrder: int.tryParse(item.chapterOrder) ?? 0,
|
||||
),
|
||||
);
|
||||
}
|
||||
if (serialItems.isNotEmpty) {
|
||||
lastChapterId = serialItems.last.chapterId;
|
||||
}
|
||||
volumes.add(
|
||||
ComicDetailVolume(
|
||||
title: isHide ? "神隐" : "连载",
|
||||
chapters: RxList<ComicDetailChapterItem>(serialItems)),
|
||||
);
|
||||
if (aloneItems.isNotEmpty) {
|
||||
volumes.add(
|
||||
ComicDetailVolume(
|
||||
title: isHide ? "神隐-单行本" : "单行本",
|
||||
chapters: RxList<ComicDetailChapterItem>(aloneItems)),
|
||||
);
|
||||
}
|
||||
return ComicDetailInfo(
|
||||
id: int.tryParse(model.info.id) ?? 0,
|
||||
title: model.info.title,
|
||||
direction: int.tryParse(model.info.direction) ?? 0,
|
||||
isLong: (int.tryParse(model.info.islong) ?? 0) == 1,
|
||||
cover: model.info.cover,
|
||||
description: model.info.description,
|
||||
lastUpdateChapterId: lastChapterId,
|
||||
lastUpdatechapterName: model.info.lastUpdateChapterName,
|
||||
lastUpdatetime: int.tryParse(model.info.lastUpdatetime) ?? 0,
|
||||
hitNum: 0,
|
||||
hotNum: 0,
|
||||
subscribeNum: 0,
|
||||
firstLetter: model.info.firstLetter,
|
||||
comicPy: "",
|
||||
isHide: isHide,
|
||||
types: model.info.types
|
||||
.split("/")
|
||||
.map(
|
||||
(e) => ComicDetailTag(
|
||||
tagId: 0,
|
||||
tagName: e,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
status: [
|
||||
ComicDetailTag(
|
||||
tagId: 0,
|
||||
tagName: model.info.status,
|
||||
)
|
||||
],
|
||||
authors: model.info.authors
|
||||
.split("/")
|
||||
.map(
|
||||
(e) => ComicDetailTag(
|
||||
tagId: 0,
|
||||
tagName: e,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
volumes: volumes,
|
||||
);
|
||||
}
|
||||
|
||||
int id;
|
||||
String title;
|
||||
int direction;
|
||||
bool isLong;
|
||||
String cover;
|
||||
String description;
|
||||
int lastUpdatetime;
|
||||
String lastUpdatechapterName;
|
||||
String firstLetter;
|
||||
String comicPy;
|
||||
int hotNum;
|
||||
int hitNum;
|
||||
int lastUpdateChapterId;
|
||||
List<ComicDetailTag> types = [];
|
||||
List<ComicDetailTag> status = [];
|
||||
List<ComicDetailTag> authors = [];
|
||||
int subscribeNum;
|
||||
List<ComicDetailVolume> volumes = [];
|
||||
|
||||
bool isVip;
|
||||
|
||||
/// 是否神隐
|
||||
bool isHide;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ComicDetailTag {
|
||||
ComicDetailTag({
|
||||
required this.tagId,
|
||||
required this.tagName,
|
||||
});
|
||||
|
||||
int tagId;
|
||||
String tagName;
|
||||
}
|
||||
|
||||
class ComicDetailVolume {
|
||||
ComicDetailVolume({
|
||||
required this.title,
|
||||
required this.chapters,
|
||||
}) {
|
||||
sort();
|
||||
}
|
||||
|
||||
String title;
|
||||
RxList<ComicDetailChapterItem> chapters;
|
||||
//0倒序,1正序
|
||||
var sortType = 0.obs;
|
||||
var showAll = false.obs;
|
||||
bool get showMoreButton => chapters.length > 15;
|
||||
|
||||
void sort() {
|
||||
if (sortType.value == 0) {
|
||||
chapters.sort((a, b) => b.chapterOrder.compareTo(a.chapterOrder));
|
||||
} else {
|
||||
chapters.sort((a, b) => a.chapterOrder.compareTo(b.chapterOrder));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ComicDetailChapterItem {
|
||||
ComicDetailChapterItem({
|
||||
required this.chapterId,
|
||||
required this.chapterTitle,
|
||||
required this.updateTime,
|
||||
required this.fileSize,
|
||||
required this.chapterOrder,
|
||||
this.isVip = false,
|
||||
});
|
||||
|
||||
int chapterId;
|
||||
String chapterTitle;
|
||||
int updateTime;
|
||||
int fileSize;
|
||||
int chapterOrder;
|
||||
|
||||
bool isVip;
|
||||
}
|
||||
352
lib/models/comic/detail_model.dart
Normal file
352
lib/models/comic/detail_model.dart
Normal file
@@ -0,0 +1,352 @@
|
||||
import 'dart:convert';
|
||||
|
||||
T? asT<T>(dynamic value) {
|
||||
if (value is T) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class ComicDetailModel {
|
||||
ComicDetailModel({
|
||||
required this.data,
|
||||
required this.readingRecord,
|
||||
});
|
||||
|
||||
factory ComicDetailModel.fromJson(Map<String, dynamic> json) =>
|
||||
ComicDetailModel(
|
||||
data: ComicDetailDataModel.fromJson(
|
||||
asT<Map<String, dynamic>>(json['data'])!),
|
||||
readingRecord: ComicDetailReadingRecordModel.fromJson(
|
||||
asT<Map<String, dynamic>>(json['readingRecord'])!),
|
||||
);
|
||||
|
||||
ComicDetailDataModel data;
|
||||
ComicDetailReadingRecordModel readingRecord;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'data': data,
|
||||
'readingRecord': readingRecord,
|
||||
};
|
||||
}
|
||||
|
||||
class ComicDetailDataModel {
|
||||
ComicDetailDataModel({
|
||||
required this.id,
|
||||
required this.title,
|
||||
this.direction,
|
||||
this.islong,
|
||||
this.cover,
|
||||
this.description,
|
||||
this.lastUpdatetime,
|
||||
this.lastUpdateChapterName,
|
||||
this.firstLetter,
|
||||
this.comicPy,
|
||||
this.lastUpdateChapterId,
|
||||
this.types,
|
||||
this.status,
|
||||
this.authors,
|
||||
this.chapters,
|
||||
this.dhUrlLinks,
|
||||
});
|
||||
|
||||
factory ComicDetailDataModel.fromJson(Map<String, dynamic> json) {
|
||||
final List<ComicDetailDataTagModel>? types =
|
||||
json['types'] is List ? <ComicDetailDataTagModel>[] : null;
|
||||
if (types != null) {
|
||||
for (final dynamic item in json['types']!) {
|
||||
if (item != null) {
|
||||
types.add(ComicDetailDataTagModel.fromJson(
|
||||
asT<Map<String, dynamic>>(item)!));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final List<ComicDetailDataTagModel>? status =
|
||||
json['status'] is List ? <ComicDetailDataTagModel>[] : null;
|
||||
if (status != null) {
|
||||
for (final dynamic item in json['status']!) {
|
||||
if (item != null) {
|
||||
status.add(ComicDetailDataTagModel.fromJson(
|
||||
asT<Map<String, dynamic>>(item)!));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final List<ComicDetailDataTagModel>? authors =
|
||||
json['authors'] is List ? <ComicDetailDataTagModel>[] : null;
|
||||
if (authors != null) {
|
||||
for (final dynamic item in json['authors']!) {
|
||||
if (item != null) {
|
||||
authors.add(ComicDetailDataTagModel.fromJson(
|
||||
asT<Map<String, dynamic>>(item)!));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final List<ComicDetailChapterModel>? chapters =
|
||||
json['chapters'] is List ? <ComicDetailChapterModel>[] : null;
|
||||
if (chapters != null) {
|
||||
for (final dynamic item in json['chapters']!) {
|
||||
if (item != null) {
|
||||
chapters.add(ComicDetailChapterModel.fromJson(
|
||||
asT<Map<String, dynamic>>(item)!));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final List<DhUrlLinks>? dhUrlLinks =
|
||||
json['dh_url_links'] is List ? <DhUrlLinks>[] : null;
|
||||
if (dhUrlLinks != null) {
|
||||
for (final dynamic item in json['dh_url_links']!) {
|
||||
if (item != null) {
|
||||
dhUrlLinks.add(DhUrlLinks.fromJson(asT<Map<String, dynamic>>(item)!));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ComicDetailDataModel(
|
||||
id: asT<int>(json['id'])!,
|
||||
title: asT<String>(json['title'])!,
|
||||
direction: asT<int?>(json['direction']),
|
||||
islong: asT<int?>(json['islong']),
|
||||
cover: asT<String?>(json['cover']),
|
||||
description: asT<String?>(json['description']),
|
||||
lastUpdatetime: asT<int?>(json['last_updatetime']),
|
||||
lastUpdateChapterName: asT<String?>(json['last_update_chapter_name']),
|
||||
firstLetter: asT<String?>(json['first_letter']),
|
||||
comicPy: asT<String?>(json['comic_py']),
|
||||
lastUpdateChapterId: asT<int?>(json['last_update_chapter_id']),
|
||||
types: types,
|
||||
status: status,
|
||||
authors: authors,
|
||||
chapters: chapters,
|
||||
dhUrlLinks: dhUrlLinks,
|
||||
);
|
||||
}
|
||||
|
||||
int id;
|
||||
String title;
|
||||
int? direction;
|
||||
int? islong;
|
||||
String? cover;
|
||||
String? description;
|
||||
int? lastUpdatetime;
|
||||
String? lastUpdateChapterName;
|
||||
String? firstLetter;
|
||||
String? comicPy;
|
||||
int? lastUpdateChapterId;
|
||||
List<ComicDetailDataTagModel>? types;
|
||||
List<ComicDetailDataTagModel>? status;
|
||||
List<ComicDetailDataTagModel>? authors;
|
||||
List<ComicDetailChapterModel>? chapters;
|
||||
List<DhUrlLinks>? dhUrlLinks;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'id': id,
|
||||
'title': title,
|
||||
'direction': direction,
|
||||
'islong': islong,
|
||||
'cover': cover,
|
||||
'description': description,
|
||||
'last_updatetime': lastUpdatetime,
|
||||
'last_update_chapter_name': lastUpdateChapterName,
|
||||
'first_letter': firstLetter,
|
||||
'comic_py': comicPy,
|
||||
'last_update_chapter_id': lastUpdateChapterId,
|
||||
'types': types,
|
||||
'status': status,
|
||||
'authors': authors,
|
||||
'chapters': chapters,
|
||||
'dh_url_links': dhUrlLinks,
|
||||
};
|
||||
}
|
||||
|
||||
class ComicDetailDataTagModel {
|
||||
ComicDetailDataTagModel({
|
||||
required this.tagId,
|
||||
required this.tagName,
|
||||
});
|
||||
|
||||
factory ComicDetailDataTagModel.fromJson(Map<String, dynamic> json) =>
|
||||
ComicDetailDataTagModel(
|
||||
tagId: asT<int>(json['tag_id'])!,
|
||||
tagName: asT<String>(json['tag_name'])!,
|
||||
);
|
||||
|
||||
int tagId;
|
||||
String tagName;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'tag_id': tagId,
|
||||
'tag_name': tagName,
|
||||
};
|
||||
}
|
||||
|
||||
class ComicDetailChapterModel {
|
||||
ComicDetailChapterModel({
|
||||
this.title,
|
||||
this.data,
|
||||
});
|
||||
|
||||
factory ComicDetailChapterModel.fromJson(Map<String, dynamic> json) {
|
||||
final List<ComicDetailChapterDataModel>? data =
|
||||
json['data'] is List ? <ComicDetailChapterDataModel>[] : null;
|
||||
if (data != null) {
|
||||
for (final dynamic item in json['data']!) {
|
||||
if (item != null) {
|
||||
data.add(ComicDetailChapterDataModel.fromJson(
|
||||
asT<Map<String, dynamic>>(item)!));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ComicDetailChapterModel(
|
||||
title: asT<String?>(json['title']),
|
||||
data: data,
|
||||
);
|
||||
}
|
||||
|
||||
String? title;
|
||||
List<ComicDetailChapterDataModel>? data;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'title': title,
|
||||
'data': data,
|
||||
};
|
||||
}
|
||||
|
||||
class ComicDetailChapterDataModel {
|
||||
ComicDetailChapterDataModel({
|
||||
required this.chapterId,
|
||||
required this.chapterTitle,
|
||||
this.updatetime,
|
||||
required this.chapterOrder,
|
||||
});
|
||||
|
||||
factory ComicDetailChapterDataModel.fromJson(Map<String, dynamic> json) =>
|
||||
ComicDetailChapterDataModel(
|
||||
chapterId: asT<int>(json['chapter_id'])!,
|
||||
chapterTitle: asT<String>(json['chapter_title'])!,
|
||||
updatetime: asT<int?>(json['updatetime']),
|
||||
chapterOrder: asT<int>(json['chapter_order'])!,
|
||||
);
|
||||
|
||||
int chapterId;
|
||||
String chapterTitle;
|
||||
int? updatetime;
|
||||
int chapterOrder;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'chapter_id': chapterId,
|
||||
'chapter_title': chapterTitle,
|
||||
'updatetime': updatetime,
|
||||
'chapter_order': chapterOrder,
|
||||
};
|
||||
}
|
||||
|
||||
class DhUrlLinks {
|
||||
DhUrlLinks({
|
||||
this.title,
|
||||
});
|
||||
|
||||
factory DhUrlLinks.fromJson(Map<String, dynamic> json) => DhUrlLinks(
|
||||
title: asT<String?>(json['title']),
|
||||
);
|
||||
|
||||
String? title;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'title': title,
|
||||
};
|
||||
}
|
||||
|
||||
class ComicDetailReadingRecordModel {
|
||||
ComicDetailReadingRecordModel({
|
||||
this.typeName,
|
||||
this.uid,
|
||||
this.source,
|
||||
this.bizId,
|
||||
this.chapterId,
|
||||
this.viewingTime,
|
||||
this.record,
|
||||
this.volumeId,
|
||||
this.totalNum,
|
||||
this.chapterName,
|
||||
this.volumeName,
|
||||
});
|
||||
|
||||
factory ComicDetailReadingRecordModel.fromJson(Map<String, dynamic> json) =>
|
||||
ComicDetailReadingRecordModel(
|
||||
typeName: asT<String?>(json['type_name']),
|
||||
uid: asT<int?>(json['uid']),
|
||||
source: asT<int?>(json['source']),
|
||||
bizId: asT<int?>(json['biz_id']),
|
||||
chapterId: asT<int?>(json['chapter_id']),
|
||||
viewingTime: asT<int?>(json['viewing_time']),
|
||||
record: asT<int?>(json['record']),
|
||||
volumeId: asT<int?>(json['volume_id']),
|
||||
totalNum: asT<int?>(json['total_num']),
|
||||
chapterName: asT<String?>(json['chapter_name']),
|
||||
volumeName: asT<String?>(json['volume_name']),
|
||||
);
|
||||
|
||||
String? typeName;
|
||||
int? uid;
|
||||
int? source;
|
||||
int? bizId;
|
||||
int? chapterId;
|
||||
int? viewingTime;
|
||||
int? record;
|
||||
int? volumeId;
|
||||
int? totalNum;
|
||||
String? chapterName;
|
||||
String? volumeName;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'type_name': typeName,
|
||||
'uid': uid,
|
||||
'source': source,
|
||||
'biz_id': bizId,
|
||||
'chapter_id': chapterId,
|
||||
'viewing_time': viewingTime,
|
||||
'record': record,
|
||||
'volume_id': volumeId,
|
||||
'total_num': totalNum,
|
||||
'chapter_name': chapterName,
|
||||
'volume_name': volumeName,
|
||||
};
|
||||
}
|
||||
186
lib/models/comic/detail_v1_model.dart
Normal file
186
lib/models/comic/detail_v1_model.dart
Normal file
@@ -0,0 +1,186 @@
|
||||
import 'dart:convert';
|
||||
|
||||
T? asT<T>(dynamic value) {
|
||||
if (value is T) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class ComicDetailV1Model {
|
||||
ComicDetailV1Model({
|
||||
required this.info,
|
||||
required this.list,
|
||||
required this.alone,
|
||||
});
|
||||
|
||||
factory ComicDetailV1Model.fromJson(Map<String, dynamic> json) {
|
||||
final List<ComicDetailV1ChapterModel>? list =
|
||||
json['list'] is List ? <ComicDetailV1ChapterModel>[] : null;
|
||||
if (list != null) {
|
||||
for (final dynamic item in json['list']!) {
|
||||
if (item != null) {
|
||||
list.add(ComicDetailV1ChapterModel.fromJson(
|
||||
asT<Map<String, dynamic>>(item)!));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final List<ComicDetailV1ChapterModel>? alone =
|
||||
json['alone'] is List ? <ComicDetailV1ChapterModel>[] : null;
|
||||
if (alone != null) {
|
||||
for (final dynamic item in json['alone']!) {
|
||||
if (item != null) {
|
||||
alone.add(ComicDetailV1ChapterModel.fromJson(
|
||||
asT<Map<String, dynamic>>(item)!));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ComicDetailV1Model(
|
||||
info: ComicDetailV1InfoModel.fromJson(
|
||||
asT<Map<String, dynamic>>(json['info'])!),
|
||||
list: list!,
|
||||
alone: alone!,
|
||||
);
|
||||
}
|
||||
|
||||
ComicDetailV1InfoModel info;
|
||||
List<ComicDetailV1ChapterModel> list;
|
||||
List<ComicDetailV1ChapterModel> alone;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'info': info,
|
||||
'list': list,
|
||||
'alone': alone,
|
||||
};
|
||||
}
|
||||
|
||||
class ComicDetailV1InfoModel {
|
||||
ComicDetailV1InfoModel({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.subtitle,
|
||||
required this.types,
|
||||
required this.zone,
|
||||
required this.status,
|
||||
required this.lastUpdateChapterName,
|
||||
required this.lastUpdatetime,
|
||||
required this.cover,
|
||||
required this.authors,
|
||||
required this.description,
|
||||
required this.firstLetter,
|
||||
required this.direction,
|
||||
required this.islong,
|
||||
required this.copyright,
|
||||
});
|
||||
|
||||
factory ComicDetailV1InfoModel.fromJson(Map<String, dynamic> json) =>
|
||||
ComicDetailV1InfoModel(
|
||||
id: asT<String>(json['id'])!,
|
||||
title: asT<String>(json['title'])!,
|
||||
subtitle: asT<String>(json['subtitle'])!,
|
||||
types: asT<String>(json['types'])!,
|
||||
zone: asT<String>(json['zone'])!,
|
||||
status: asT<String>(json['status'])!,
|
||||
lastUpdateChapterName: asT<String>(json['last_update_chapter_name'])!,
|
||||
lastUpdatetime: asT<String>(json['last_updatetime'])!,
|
||||
cover: asT<String>(json['cover'])!,
|
||||
authors: asT<String>(json['authors'])!,
|
||||
description: asT<String>(json['description'])!,
|
||||
firstLetter: asT<String>(json['first_letter'])!,
|
||||
direction: asT<String>(json['direction'])!,
|
||||
islong: asT<String>(json['islong'])!,
|
||||
copyright: asT<String>(json['copyright'])!,
|
||||
);
|
||||
|
||||
String id;
|
||||
String title;
|
||||
String subtitle;
|
||||
String types;
|
||||
String zone;
|
||||
String status;
|
||||
String lastUpdateChapterName;
|
||||
String lastUpdatetime;
|
||||
String cover;
|
||||
String authors;
|
||||
String description;
|
||||
String firstLetter;
|
||||
String direction;
|
||||
String islong;
|
||||
String copyright;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'id': id,
|
||||
'title': title,
|
||||
'subtitle': subtitle,
|
||||
'types': types,
|
||||
'zone': zone,
|
||||
'status': status,
|
||||
'last_update_chapter_name': lastUpdateChapterName,
|
||||
'last_updatetime': lastUpdatetime,
|
||||
'cover': cover,
|
||||
'authors': authors,
|
||||
'description': description,
|
||||
'first_letter': firstLetter,
|
||||
'direction': direction,
|
||||
'islong': islong,
|
||||
'copyright': copyright,
|
||||
};
|
||||
}
|
||||
|
||||
class ComicDetailV1ChapterModel {
|
||||
ComicDetailV1ChapterModel({
|
||||
required this.id,
|
||||
required this.comicId,
|
||||
required this.chapterName,
|
||||
required this.chapterOrder,
|
||||
required this.filesize,
|
||||
required this.createtime,
|
||||
required this.updatetime,
|
||||
});
|
||||
|
||||
factory ComicDetailV1ChapterModel.fromJson(Map<String, dynamic> json) =>
|
||||
ComicDetailV1ChapterModel(
|
||||
id: asT<String>(json['id'])!,
|
||||
comicId: asT<String>(json['comic_id'])!,
|
||||
chapterName: asT<String>(json['chapter_name'])!,
|
||||
chapterOrder: asT<String>(json['chapter_order'])!,
|
||||
filesize: asT<String>(json['filesize'])!,
|
||||
createtime: asT<String>(json['createtime'])!,
|
||||
updatetime: asT<String>(json['updatetime'])!,
|
||||
);
|
||||
|
||||
String id;
|
||||
String comicId;
|
||||
String chapterName;
|
||||
String chapterOrder;
|
||||
String filesize;
|
||||
String createtime;
|
||||
String updatetime;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'id': id,
|
||||
'comic_id': comicId,
|
||||
'chapter_name': chapterName,
|
||||
'chapter_order': chapterOrder,
|
||||
'filesize': filesize,
|
||||
'createtime': createtime,
|
||||
'updatetime': updatetime,
|
||||
};
|
||||
}
|
||||
70
lib/models/comic/rank_item_model.dart
Normal file
70
lib/models/comic/rank_item_model.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import 'dart:convert';
|
||||
|
||||
T? asT<T>(dynamic value) {
|
||||
if (value is T) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class ComicRankListItemModel {
|
||||
ComicRankListItemModel({
|
||||
required this.comicId,
|
||||
required this.title,
|
||||
this.authors,
|
||||
this.status,
|
||||
this.cover,
|
||||
this.types,
|
||||
this.lastUpdatetime,
|
||||
this.lastUpdateChapterName,
|
||||
this.comicPy,
|
||||
this.num,
|
||||
this.tagId,
|
||||
});
|
||||
|
||||
factory ComicRankListItemModel.fromJson(Map<String, dynamic> json) =>
|
||||
ComicRankListItemModel(
|
||||
comicId: asT<int>(json['comic_id'])!,
|
||||
title: asT<String>(json['title'])!,
|
||||
authors: asT<String?>(json['authors']),
|
||||
status: asT<String?>(json['status']),
|
||||
cover: asT<String?>(json['cover']),
|
||||
types: asT<String?>(json['types']),
|
||||
lastUpdatetime: asT<int?>(json['last_updatetime']),
|
||||
lastUpdateChapterName: asT<String?>(json['last_update_chapter_name']),
|
||||
comicPy: asT<String?>(json['comic_py']),
|
||||
num: asT<int?>(json['num']),
|
||||
tagId: asT<int?>(json['tag_id']),
|
||||
);
|
||||
|
||||
int comicId;
|
||||
String title;
|
||||
String? authors;
|
||||
String? status;
|
||||
String? cover;
|
||||
String? types;
|
||||
int? lastUpdatetime;
|
||||
String? lastUpdateChapterName;
|
||||
String? comicPy;
|
||||
int? num;
|
||||
int? tagId;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'comic_id': comicId,
|
||||
'title': title,
|
||||
'authors': authors,
|
||||
'status': status,
|
||||
'cover': cover,
|
||||
'types': types,
|
||||
'last_updatetime': lastUpdatetime,
|
||||
'last_update_chapter_name': lastUpdateChapterName,
|
||||
'comic_py': comicPy,
|
||||
'num': num,
|
||||
'tag_id': tagId,
|
||||
};
|
||||
}
|
||||
101
lib/models/comic/recommend_model.dart
Normal file
101
lib/models/comic/recommend_model.dart
Normal file
@@ -0,0 +1,101 @@
|
||||
import 'dart:convert';
|
||||
|
||||
T? asT<T>(dynamic value) {
|
||||
if (value is T) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class ComicRecommendModel {
|
||||
ComicRecommendModel({
|
||||
required this.categoryId,
|
||||
required this.title,
|
||||
required this.sort,
|
||||
required this.data,
|
||||
});
|
||||
|
||||
factory ComicRecommendModel.fromJson(Map<String, dynamic> json) {
|
||||
final List<ComicRecommendItemModel>? data =
|
||||
json['data'] is List ? <ComicRecommendItemModel>[] : null;
|
||||
if (data != null) {
|
||||
for (final dynamic item in json['data']!) {
|
||||
if (item != null) {
|
||||
data.add(ComicRecommendItemModel.fromJson(
|
||||
asT<Map<String, dynamic>>(item)!));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ComicRecommendModel(
|
||||
categoryId: asT<int>(json['category_id'])!,
|
||||
title: asT<String>(json['title'])!,
|
||||
sort: asT<int>(json['sort'])!,
|
||||
data: data ?? [],
|
||||
);
|
||||
}
|
||||
|
||||
int categoryId;
|
||||
String title;
|
||||
int sort;
|
||||
List<ComicRecommendItemModel> data;
|
||||
int page = 1;
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'category_id': categoryId,
|
||||
'title': title,
|
||||
'sort': sort,
|
||||
'data': data,
|
||||
};
|
||||
}
|
||||
|
||||
class ComicRecommendItemModel {
|
||||
ComicRecommendItemModel({
|
||||
required this.cover,
|
||||
required this.title,
|
||||
this.subTitle,
|
||||
this.type,
|
||||
this.url,
|
||||
required this.objId,
|
||||
this.status,
|
||||
this.id,
|
||||
});
|
||||
|
||||
factory ComicRecommendItemModel.fromJson(Map<String, dynamic> json) =>
|
||||
ComicRecommendItemModel(
|
||||
id: asT<int?>(json['id']),
|
||||
cover: asT<String>(json['cover'])!,
|
||||
title: asT<String>(json['title'])!,
|
||||
subTitle: asT<String?>(json['sub_title']),
|
||||
type: asT<int?>(json['type']),
|
||||
url: asT<String?>(json['url']),
|
||||
objId: asT<int?>(json['obj_id']),
|
||||
status: asT<String?>(json['status']),
|
||||
);
|
||||
int? id;
|
||||
String cover;
|
||||
String title;
|
||||
String? subTitle;
|
||||
int? type;
|
||||
String? url;
|
||||
int? objId;
|
||||
String? status;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'cover': cover,
|
||||
'title': title,
|
||||
'sub_title': subTitle,
|
||||
'type': type,
|
||||
'url': url,
|
||||
'obj_id': objId,
|
||||
'status': status,
|
||||
};
|
||||
}
|
||||
36
lib/models/comic/search_item.dart
Normal file
36
lib/models/comic/search_item.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter_dmzj/models/comic/search_model.dart';
|
||||
import 'package:flutter_dmzj/models/comic/web_search_model.dart';
|
||||
|
||||
class SearchComicItem {
|
||||
final int comicId;
|
||||
final String title;
|
||||
final String cover;
|
||||
final String author;
|
||||
final String lastChapterName;
|
||||
final String tags;
|
||||
SearchComicItem({
|
||||
required this.author,
|
||||
required this.comicId,
|
||||
required this.cover,
|
||||
required this.lastChapterName,
|
||||
required this.tags,
|
||||
required this.title,
|
||||
});
|
||||
|
||||
factory SearchComicItem.fromApi(ComicSearchModel item) => SearchComicItem(
|
||||
author: item.authors ?? "",
|
||||
comicId: item.id,
|
||||
cover: item.cover ?? "",
|
||||
lastChapterName: item.lastName ?? "",
|
||||
tags: item.types ?? "",
|
||||
title: item.title,
|
||||
);
|
||||
factory SearchComicItem.fromWeb(ComicWebSearchModel item) => SearchComicItem(
|
||||
author: item.comicAuthor,
|
||||
comicId: item.id,
|
||||
cover: item.cover,
|
||||
lastChapterName: item.lastUpdateChapterName,
|
||||
tags: "/",
|
||||
title: item.comicName,
|
||||
);
|
||||
}
|
||||
70
lib/models/comic/search_model.dart
Normal file
70
lib/models/comic/search_model.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import 'dart:convert';
|
||||
|
||||
T? asT<T>(dynamic value) {
|
||||
if (value is T) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class ComicSearchModel {
|
||||
ComicSearchModel({
|
||||
required this.id,
|
||||
this.authors,
|
||||
this.copyright,
|
||||
this.cover,
|
||||
this.hotHits,
|
||||
this.lastName,
|
||||
this.status,
|
||||
required this.title,
|
||||
this.types,
|
||||
this.aliasName,
|
||||
this.comicPy,
|
||||
});
|
||||
|
||||
factory ComicSearchModel.fromJson(Map<String, dynamic> json) =>
|
||||
ComicSearchModel(
|
||||
id: asT<int>(json['id'])!,
|
||||
authors: asT<String?>(json['authors']),
|
||||
copyright: asT<int?>(json['copyright']),
|
||||
cover: asT<String?>(json['cover']),
|
||||
hotHits: asT<int?>(json['hot_hits']),
|
||||
lastName: asT<String?>(json['last_name']),
|
||||
status: asT<String?>(json['status']),
|
||||
title: asT<String>(json['title'])!,
|
||||
types: asT<String?>(json['types']),
|
||||
aliasName: asT<String?>(json['alias_name']),
|
||||
comicPy: asT<String?>(json['comic_py']),
|
||||
);
|
||||
|
||||
int id;
|
||||
String? authors;
|
||||
int? copyright;
|
||||
String? cover;
|
||||
int? hotHits;
|
||||
String? lastName;
|
||||
String? status;
|
||||
String title;
|
||||
String? types;
|
||||
String? aliasName;
|
||||
String? comicPy;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'id': id,
|
||||
'authors': authors,
|
||||
'copyright': copyright,
|
||||
'cover': cover,
|
||||
'hot_hits': hotHits,
|
||||
'last_name': lastName,
|
||||
'status': status,
|
||||
'title': title,
|
||||
'types': types,
|
||||
'alias_name': aliasName,
|
||||
'comic_py': comicPy,
|
||||
};
|
||||
}
|
||||
103
lib/models/comic/special_detail_model.dart
Normal file
103
lib/models/comic/special_detail_model.dart
Normal file
@@ -0,0 +1,103 @@
|
||||
import 'dart:convert';
|
||||
|
||||
T? asT<T>(dynamic value) {
|
||||
if (value is T) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class ComicSpecialDetailModel {
|
||||
ComicSpecialDetailModel({
|
||||
required this.mobileHeaderPic,
|
||||
required this.title,
|
||||
required this.pageUrl,
|
||||
required this.description,
|
||||
required this.comics,
|
||||
required this.commentAmount,
|
||||
});
|
||||
|
||||
factory ComicSpecialDetailModel.fromJson(Map<String, dynamic> json) {
|
||||
final List<ComicSpecialComicModel>? comics =
|
||||
json['comics'] is List ? <ComicSpecialComicModel>[] : null;
|
||||
if (comics != null) {
|
||||
for (final dynamic item in json['comics']!) {
|
||||
if (item != null) {
|
||||
comics.add(ComicSpecialComicModel.fromJson(
|
||||
asT<Map<String, dynamic>>(item)!));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ComicSpecialDetailModel(
|
||||
mobileHeaderPic: asT<String>(json['mobile_header_pic'])!,
|
||||
title: asT<String>(json['title'])!,
|
||||
pageUrl: asT<String>(json['page_url'])!,
|
||||
description: asT<String>(json['description'])!,
|
||||
comics: comics!,
|
||||
commentAmount: asT<int>(json['comment_amount'])!,
|
||||
);
|
||||
}
|
||||
|
||||
String mobileHeaderPic;
|
||||
String title;
|
||||
String pageUrl;
|
||||
String description;
|
||||
List<ComicSpecialComicModel> comics;
|
||||
int commentAmount;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'mobile_header_pic': mobileHeaderPic,
|
||||
'title': title,
|
||||
'page_url': pageUrl,
|
||||
'description': description,
|
||||
'comics': comics,
|
||||
'comment_amount': commentAmount,
|
||||
};
|
||||
}
|
||||
|
||||
class ComicSpecialComicModel {
|
||||
ComicSpecialComicModel({
|
||||
required this.cover,
|
||||
required this.recommendBrief,
|
||||
required this.recommendReason,
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.aliasName,
|
||||
});
|
||||
|
||||
factory ComicSpecialComicModel.fromJson(Map<String, dynamic> json) =>
|
||||
ComicSpecialComicModel(
|
||||
cover: asT<String?>(json['cover']) ?? "",
|
||||
recommendBrief: asT<String?>(json['recommend_brief']) ?? "",
|
||||
recommendReason: asT<String?>(json['recommend_reason']) ?? "",
|
||||
id: asT<int>(json['id'])!,
|
||||
name: asT<String?>(json['name']) ?? "",
|
||||
aliasName: asT<String?>(json['alias_name']) ?? "",
|
||||
);
|
||||
|
||||
String cover;
|
||||
String recommendBrief;
|
||||
String recommendReason;
|
||||
int id;
|
||||
String name;
|
||||
String aliasName;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'cover': cover,
|
||||
'recommend_brief': recommendBrief,
|
||||
'recommend_reason': recommendReason,
|
||||
'id': id,
|
||||
'name': name,
|
||||
'alias_name': aliasName,
|
||||
};
|
||||
}
|
||||
58
lib/models/comic/special_model.dart
Normal file
58
lib/models/comic/special_model.dart
Normal file
@@ -0,0 +1,58 @@
|
||||
import 'dart:convert';
|
||||
|
||||
T? asT<T>(dynamic value) {
|
||||
if (value is T) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class ComicSpecialModel {
|
||||
ComicSpecialModel({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.shortTitle,
|
||||
required this.createTime,
|
||||
required this.smallCover,
|
||||
required this.pageType,
|
||||
required this.sort,
|
||||
required this.pageUrl,
|
||||
});
|
||||
|
||||
factory ComicSpecialModel.fromJson(Map<String, dynamic> json) =>
|
||||
ComicSpecialModel(
|
||||
id: asT<int>(json['id'])!,
|
||||
title: asT<String>(json['title'])!,
|
||||
shortTitle: asT<String>(json['short_title'])!,
|
||||
createTime: asT<int>(json['create_time'])!,
|
||||
smallCover: asT<String>(json['small_cover'])!,
|
||||
pageType: asT<int>(json['page_type'])!,
|
||||
sort: asT<int>(json['sort'])!,
|
||||
pageUrl: asT<String>(json['page_url'])!,
|
||||
);
|
||||
|
||||
int id;
|
||||
String title;
|
||||
String shortTitle;
|
||||
int createTime;
|
||||
String smallCover;
|
||||
int pageType;
|
||||
int sort;
|
||||
String pageUrl;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'id': id,
|
||||
'title': title,
|
||||
'short_title': shortTitle,
|
||||
'create_time': createTime,
|
||||
'small_cover': smallCover,
|
||||
'page_type': pageType,
|
||||
'sort': sort,
|
||||
'page_url': pageUrl,
|
||||
};
|
||||
}
|
||||
66
lib/models/comic/update_item_model.dart
Normal file
66
lib/models/comic/update_item_model.dart
Normal file
@@ -0,0 +1,66 @@
|
||||
import 'dart:convert';
|
||||
|
||||
T? asT<T>(dynamic value) {
|
||||
if (value is T) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class ComicUpdateItemModel {
|
||||
ComicUpdateItemModel({
|
||||
required this.comicId,
|
||||
required this.title,
|
||||
this.islong,
|
||||
this.authors,
|
||||
this.types,
|
||||
this.cover,
|
||||
this.status,
|
||||
this.lastUpdateChapterName,
|
||||
this.lastUpdateChapterId,
|
||||
this.lastUpdatetime,
|
||||
});
|
||||
|
||||
factory ComicUpdateItemModel.fromJson(Map<String, dynamic> json) =>
|
||||
ComicUpdateItemModel(
|
||||
comicId: asT<int>(json['comic_id'])!,
|
||||
title: asT<String>(json['title'])!,
|
||||
islong: asT<int?>(json['islong']),
|
||||
authors: asT<String?>(json['authors']),
|
||||
types: asT<String?>(json['types']),
|
||||
cover: asT<String?>(json['cover']),
|
||||
status: asT<String?>(json['status']),
|
||||
lastUpdateChapterName: asT<String?>(json['last_update_chapter_name']),
|
||||
lastUpdateChapterId: asT<int?>(json['last_update_chapter_id']),
|
||||
lastUpdatetime: asT<int?>(json['last_updatetime']),
|
||||
);
|
||||
|
||||
int comicId;
|
||||
String title;
|
||||
int? islong;
|
||||
String? authors;
|
||||
String? types;
|
||||
String? cover;
|
||||
String? status;
|
||||
String? lastUpdateChapterName;
|
||||
int? lastUpdateChapterId;
|
||||
int? lastUpdatetime;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'comic_id': comicId,
|
||||
'title': title,
|
||||
'islong': islong,
|
||||
'authors': authors,
|
||||
'types': types,
|
||||
'cover': cover,
|
||||
'status': status,
|
||||
'last_update_chapter_name': lastUpdateChapterName,
|
||||
'last_update_chapter_id': lastUpdateChapterId,
|
||||
'last_updatetime': lastUpdatetime,
|
||||
};
|
||||
}
|
||||
48
lib/models/comic/view_point_model.dart
Normal file
48
lib/models/comic/view_point_model.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
T? asT<T>(dynamic value) {
|
||||
if (value is T) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class ComicViewPointModel {
|
||||
ComicViewPointModel({
|
||||
required this.id,
|
||||
required this.uid,
|
||||
required this.content,
|
||||
required this.num,
|
||||
required this.page,
|
||||
});
|
||||
|
||||
factory ComicViewPointModel.fromJson(Map<String, dynamic> json) =>
|
||||
ComicViewPointModel(
|
||||
id: asT<int>(json['id'])!,
|
||||
uid: asT<int>(json['uid'])!,
|
||||
content: asT<String>(json['content'])!,
|
||||
num: (asT<int?>(json['num']) ?? 0).obs,
|
||||
page: asT<int>(json['page'])!,
|
||||
);
|
||||
|
||||
int id;
|
||||
int uid;
|
||||
String content;
|
||||
RxInt num;
|
||||
int page;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'id': id,
|
||||
'uid': uid,
|
||||
'content': content,
|
||||
'num': num,
|
||||
'page': page,
|
||||
};
|
||||
}
|
||||
71
lib/models/comic/web_search_model.dart
Normal file
71
lib/models/comic/web_search_model.dart
Normal file
@@ -0,0 +1,71 @@
|
||||
import 'dart:convert';
|
||||
|
||||
T? asT<T>(dynamic value) {
|
||||
if (value is T) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class ComicWebSearchModel {
|
||||
ComicWebSearchModel({
|
||||
required this.id,
|
||||
required this.comicName,
|
||||
required this.comicAuthor,
|
||||
required this.comicCover,
|
||||
required this.cover,
|
||||
required this.lastUpdateChapterName,
|
||||
required this.comicUrlRaw,
|
||||
required this.comicUrl,
|
||||
required this.status,
|
||||
required this.chapterUrlRaw,
|
||||
required this.chapterUrl,
|
||||
});
|
||||
|
||||
factory ComicWebSearchModel.fromJson(Map<String, dynamic> json) =>
|
||||
ComicWebSearchModel(
|
||||
id: asT<int>(json['id'])!,
|
||||
comicName: asT<String>(json['comic_name'])!,
|
||||
comicAuthor: asT<String?>(json['comic_author']) ?? "",
|
||||
comicCover: asT<String?>(json['comic_cover']) ?? "",
|
||||
cover: asT<String?>(json['cover']) ?? "",
|
||||
lastUpdateChapterName:
|
||||
asT<String?>(json['last_update_chapter_name']) ?? "",
|
||||
comicUrlRaw: asT<String?>(json['comic_url_raw']) ?? "",
|
||||
comicUrl: asT<String?>(json['comic_url']) ?? "",
|
||||
status: asT<String?>(json['status']) ?? "",
|
||||
chapterUrlRaw: asT<String?>(json['chapter_url_raw']) ?? "",
|
||||
chapterUrl: asT<String?>(json['chapter_url']) ?? "",
|
||||
);
|
||||
|
||||
int id;
|
||||
String comicName;
|
||||
String comicAuthor;
|
||||
String comicCover;
|
||||
String cover;
|
||||
String lastUpdateChapterName;
|
||||
String comicUrlRaw;
|
||||
String comicUrl;
|
||||
String status;
|
||||
String chapterUrlRaw;
|
||||
String chapterUrl;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return jsonEncode(this);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'id': id,
|
||||
'comic_name': comicName,
|
||||
'comic_author': comicAuthor,
|
||||
'comic_cover': comicCover,
|
||||
'cover': cover,
|
||||
'last_update_chapter_name': lastUpdateChapterName,
|
||||
'comic_url_raw': comicUrlRaw,
|
||||
'comic_url': comicUrl,
|
||||
'status': status,
|
||||
'chapter_url_raw': chapterUrlRaw,
|
||||
'chapter_url': chapterUrl,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user