mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-24 19:16:44 +08:00
feat: article list
Closes #841 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -34,8 +34,6 @@ class Pic {
|
||||
num? size;
|
||||
String? liveUrl;
|
||||
|
||||
double? calHeight;
|
||||
|
||||
Pic.fromJson(Map<String, dynamic> json) {
|
||||
url = json['url'];
|
||||
width = json['width'];
|
||||
@@ -45,12 +43,6 @@ class Pic {
|
||||
style = json['style'];
|
||||
liveUrl = json['live_url'];
|
||||
}
|
||||
|
||||
void onCalHeight(double maxWidth) {
|
||||
if (calHeight == null && height != null && width != null) {
|
||||
calHeight = maxWidth * height! / width!;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Line {
|
||||
|
||||
84
lib/models/dynamics/article_list/article.dart
Normal file
84
lib/models/dynamics/article_list/article.dart
Normal file
@@ -0,0 +1,84 @@
|
||||
import 'package:PiliPlus/models/dynamics/article_list/category.dart';
|
||||
import 'package:PiliPlus/models/dynamics/article_list/stats.dart';
|
||||
|
||||
class Article {
|
||||
int? id;
|
||||
String? title;
|
||||
int? state;
|
||||
int? publishTime;
|
||||
int? words;
|
||||
List? imageUrls;
|
||||
Category? category;
|
||||
List<Category>? categories;
|
||||
String? summary;
|
||||
int? type;
|
||||
String? dynIdStr;
|
||||
int? attributes;
|
||||
int? authorUid;
|
||||
int? onlyFans;
|
||||
Stats? stats;
|
||||
int? likeState;
|
||||
|
||||
Article({
|
||||
this.id,
|
||||
this.title,
|
||||
this.state,
|
||||
this.publishTime,
|
||||
this.words,
|
||||
this.imageUrls,
|
||||
this.category,
|
||||
this.categories,
|
||||
this.summary,
|
||||
this.type,
|
||||
this.dynIdStr,
|
||||
this.attributes,
|
||||
this.authorUid,
|
||||
this.onlyFans,
|
||||
this.stats,
|
||||
this.likeState,
|
||||
});
|
||||
|
||||
factory Article.fromJson(Map<String, dynamic> json) => Article(
|
||||
id: json['id'] as int?,
|
||||
title: json['title'] as String?,
|
||||
state: json['state'] as int?,
|
||||
publishTime: json['publish_time'] as int?,
|
||||
words: json['words'] as int?,
|
||||
imageUrls: json['image_urls'],
|
||||
category: json['category'] == null
|
||||
? null
|
||||
: Category.fromJson(json['category'] as Map<String, dynamic>),
|
||||
categories: (json['categories'] as List<dynamic>?)
|
||||
?.map((e) => Category.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
summary: json['summary'] as String?,
|
||||
type: json['type'] as int?,
|
||||
dynIdStr: json['dyn_id_str'] as String?,
|
||||
attributes: json['attributes'] as int?,
|
||||
authorUid: json['author_uid'] as int?,
|
||||
onlyFans: json['only_fans'] as int?,
|
||||
stats: json['stats'] == null
|
||||
? null
|
||||
: Stats.fromJson(json['stats'] as Map<String, dynamic>),
|
||||
likeState: json['like_state'] as int?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'title': title,
|
||||
'state': state,
|
||||
'publish_time': publishTime,
|
||||
'words': words,
|
||||
'image_urls': imageUrls,
|
||||
'category': category?.toJson(),
|
||||
'categories': categories?.map((e) => e.toJson()).toList(),
|
||||
'summary': summary,
|
||||
'type': type,
|
||||
'dyn_id_str': dynIdStr,
|
||||
'attributes': attributes,
|
||||
'author_uid': authorUid,
|
||||
'only_fans': onlyFans,
|
||||
'stats': stats?.toJson(),
|
||||
'like_state': likeState,
|
||||
};
|
||||
}
|
||||
23
lib/models/dynamics/article_list/author.dart
Normal file
23
lib/models/dynamics/article_list/author.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
class Author {
|
||||
int? mid;
|
||||
String? name;
|
||||
String? face;
|
||||
|
||||
Author({
|
||||
this.mid,
|
||||
this.name,
|
||||
this.face,
|
||||
});
|
||||
|
||||
factory Author.fromJson(Map<String, dynamic> json) => Author(
|
||||
mid: json['mid'] as int?,
|
||||
name: json['name'] as String?,
|
||||
face: json['face'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'mid': mid,
|
||||
'name': name,
|
||||
'face': face,
|
||||
};
|
||||
}
|
||||
19
lib/models/dynamics/article_list/category.dart
Normal file
19
lib/models/dynamics/article_list/category.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
class Category {
|
||||
int? id;
|
||||
int? parentId;
|
||||
String? name;
|
||||
|
||||
Category({this.id, this.parentId, this.name});
|
||||
|
||||
factory Category.fromJson(Map<String, dynamic> json) => Category(
|
||||
id: json['id'] as int?,
|
||||
parentId: json['parent_id'] as int?,
|
||||
name: json['name'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'parent_id': parentId,
|
||||
'name': name,
|
||||
};
|
||||
}
|
||||
38
lib/models/dynamics/article_list/data.dart
Normal file
38
lib/models/dynamics/article_list/data.dart
Normal file
@@ -0,0 +1,38 @@
|
||||
import 'package:PiliPlus/models/dynamics/article_list/article.dart';
|
||||
import 'package:PiliPlus/models/dynamics/article_list/author.dart';
|
||||
import 'package:PiliPlus/models/dynamics/article_list/list.dart';
|
||||
|
||||
class ArticleListData {
|
||||
ArticleList? list;
|
||||
List<Article>? articles;
|
||||
Author? author;
|
||||
bool? attention;
|
||||
|
||||
ArticleListData({
|
||||
this.list,
|
||||
this.articles,
|
||||
this.author,
|
||||
this.attention,
|
||||
});
|
||||
|
||||
factory ArticleListData.fromJson(Map<String, dynamic> json) =>
|
||||
ArticleListData(
|
||||
list: json['list'] == null
|
||||
? null
|
||||
: ArticleList.fromJson(json['list'] as Map<String, dynamic>),
|
||||
articles: (json['articles'] as List<dynamic>?)
|
||||
?.map((e) => Article.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
author: json['author'] == null
|
||||
? null
|
||||
: Author.fromJson(json['author'] as Map<String, dynamic>),
|
||||
attention: json['attention'] as bool?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'list': list?.toJson(),
|
||||
'articles': articles?.map((e) => e.toJson()).toList(),
|
||||
'author': author?.toJson(),
|
||||
'attention': attention,
|
||||
};
|
||||
}
|
||||
71
lib/models/dynamics/article_list/list.dart
Normal file
71
lib/models/dynamics/article_list/list.dart
Normal file
@@ -0,0 +1,71 @@
|
||||
class ArticleList {
|
||||
int? id;
|
||||
int? mid;
|
||||
String? name;
|
||||
String? imageUrl;
|
||||
int? updateTime;
|
||||
int? ctime;
|
||||
int? publishTime;
|
||||
String? summary;
|
||||
int? words;
|
||||
int? read;
|
||||
int? articlesCount;
|
||||
int? state;
|
||||
String? reason;
|
||||
String? applyTime;
|
||||
String? checkTime;
|
||||
|
||||
ArticleList({
|
||||
this.id,
|
||||
this.mid,
|
||||
this.name,
|
||||
this.imageUrl,
|
||||
this.updateTime,
|
||||
this.ctime,
|
||||
this.publishTime,
|
||||
this.summary,
|
||||
this.words,
|
||||
this.read,
|
||||
this.articlesCount,
|
||||
this.state,
|
||||
this.reason,
|
||||
this.applyTime,
|
||||
this.checkTime,
|
||||
});
|
||||
|
||||
factory ArticleList.fromJson(Map<String, dynamic> json) => ArticleList(
|
||||
id: json['id'] as int?,
|
||||
mid: json['mid'] as int?,
|
||||
name: json['name'] as String?,
|
||||
imageUrl: json['image_url'] as String?,
|
||||
updateTime: json['update_time'] as int?,
|
||||
ctime: json['ctime'] as int?,
|
||||
publishTime: json['publish_time'] as int?,
|
||||
summary: json['summary'] as String?,
|
||||
words: json['words'] as int?,
|
||||
read: json['read'] as int?,
|
||||
articlesCount: json['articles_count'] as int?,
|
||||
state: json['state'] as int?,
|
||||
reason: json['reason'] as String?,
|
||||
applyTime: json['apply_time'] as String?,
|
||||
checkTime: json['check_time'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'mid': mid,
|
||||
'name': name,
|
||||
'image_url': imageUrl,
|
||||
'update_time': updateTime,
|
||||
'ctime': ctime,
|
||||
'publish_time': publishTime,
|
||||
'summary': summary,
|
||||
'words': words,
|
||||
'read': read,
|
||||
'articles_count': articlesCount,
|
||||
'state': state,
|
||||
'reason': reason,
|
||||
'apply_time': applyTime,
|
||||
'check_time': checkTime,
|
||||
};
|
||||
}
|
||||
43
lib/models/dynamics/article_list/stats.dart
Normal file
43
lib/models/dynamics/article_list/stats.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
class Stats {
|
||||
int? view;
|
||||
int? favorite;
|
||||
int? like;
|
||||
int? dislike;
|
||||
int? reply;
|
||||
int? share;
|
||||
int? coin;
|
||||
int? dynam1c;
|
||||
|
||||
Stats({
|
||||
this.view,
|
||||
this.favorite,
|
||||
this.like,
|
||||
this.dislike,
|
||||
this.reply,
|
||||
this.share,
|
||||
this.coin,
|
||||
this.dynam1c,
|
||||
});
|
||||
|
||||
factory Stats.fromJson(Map<String, dynamic> json) => Stats(
|
||||
view: json['view'] as int?,
|
||||
favorite: json['favorite'] as int?,
|
||||
like: json['like'] as int?,
|
||||
dislike: json['dislike'] as int?,
|
||||
reply: json['reply'] as int?,
|
||||
share: json['share'] as int?,
|
||||
coin: json['coin'] as int?,
|
||||
dynam1c: json['dynamic'] as int?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'view': view,
|
||||
'favorite': favorite,
|
||||
'like': like,
|
||||
'dislike': dislike,
|
||||
'reply': reply,
|
||||
'share': share,
|
||||
'coin': coin,
|
||||
'dynamic': dynam1c,
|
||||
};
|
||||
}
|
||||
@@ -98,6 +98,7 @@ class ItemModulesModel {
|
||||
|
||||
// 专栏
|
||||
ModuleTop? moduleTop;
|
||||
ModuleCollection? moduleCollection;
|
||||
List<ModuleTag>? moduleExtend; // opus的tag
|
||||
List<ArticleContentModel>? moduleContent;
|
||||
ModuleBlocked? moduleBlocked;
|
||||
@@ -133,6 +134,11 @@ class ItemModulesModel {
|
||||
? null
|
||||
: ModuleTag.fromJson(i['module_title']);
|
||||
break;
|
||||
case 'MODULE_TYPE_COLLECTION':
|
||||
moduleCollection = i['module_collection'] == null
|
||||
? null
|
||||
: ModuleCollection.fromJson(i['module_collection']);
|
||||
break;
|
||||
case 'MODULE_TYPE_AUTHOR':
|
||||
moduleAuthor = i['module_author'] == null
|
||||
? null
|
||||
@@ -167,6 +173,20 @@ class ItemModulesModel {
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleCollection {
|
||||
String? count;
|
||||
int? id;
|
||||
String? name;
|
||||
String? title;
|
||||
|
||||
ModuleCollection.fromJson(Map<String, dynamic> json) {
|
||||
count = json['count'];
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
title = json['title'];
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleTop {
|
||||
ModuleTopDisplay? display;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user