mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-26 03:56:45 +08:00
feat: fav topic
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
17
lib/models/user/fav_topic/data.dart
Normal file
17
lib/models/user/fav_topic/data.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:PiliPlus/models/user/fav_topic/topic_list.dart';
|
||||
|
||||
class FavTopicData {
|
||||
TopicList? topicList;
|
||||
|
||||
FavTopicData({this.topicList});
|
||||
|
||||
factory FavTopicData.fromJson(Map<String, dynamic> json) => FavTopicData(
|
||||
topicList: json['topic_list'] == null
|
||||
? null
|
||||
: TopicList.fromJson(json['topic_list'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'topic_list': topicList?.toJson(),
|
||||
};
|
||||
}
|
||||
16
lib/models/user/fav_topic/page_info.dart
Normal file
16
lib/models/user/fav_topic/page_info.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
class PageInfo {
|
||||
int? curPageNum;
|
||||
int? total;
|
||||
|
||||
PageInfo({this.curPageNum, this.total});
|
||||
|
||||
factory PageInfo.fromJson(Map<String, dynamic> json) => PageInfo(
|
||||
curPageNum: json['cur_page_num'] as int?,
|
||||
total: json['total'] as int?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'cur_page_num': curPageNum,
|
||||
'total': total,
|
||||
};
|
||||
}
|
||||
39
lib/models/user/fav_topic/topic_item.dart
Normal file
39
lib/models/user/fav_topic/topic_item.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
class FavTopicModel {
|
||||
int? id;
|
||||
String? name;
|
||||
int? view;
|
||||
int? discuss;
|
||||
String? jumpUrl;
|
||||
String? statDesc;
|
||||
bool? showInteractData;
|
||||
|
||||
FavTopicModel({
|
||||
this.id,
|
||||
this.name,
|
||||
this.view,
|
||||
this.discuss,
|
||||
this.jumpUrl,
|
||||
this.statDesc,
|
||||
this.showInteractData,
|
||||
});
|
||||
|
||||
factory FavTopicModel.fromJson(Map<String, dynamic> json) => FavTopicModel(
|
||||
id: json['id'] as int?,
|
||||
name: json['name'] as String?,
|
||||
view: json['view'] as int?,
|
||||
discuss: json['discuss'] as int?,
|
||||
jumpUrl: json['jump_url'] as String?,
|
||||
statDesc: json['stat_desc'] as String?,
|
||||
showInteractData: json['show_interact_data'] as bool?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'view': view,
|
||||
'discuss': discuss,
|
||||
'jump_url': jumpUrl,
|
||||
'stat_desc': statDesc,
|
||||
'show_interact_data': showInteractData,
|
||||
};
|
||||
}
|
||||
23
lib/models/user/fav_topic/topic_list.dart
Normal file
23
lib/models/user/fav_topic/topic_list.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:PiliPlus/models/user/fav_topic/page_info.dart';
|
||||
import 'package:PiliPlus/models/user/fav_topic/topic_item.dart';
|
||||
|
||||
class TopicList {
|
||||
List<FavTopicModel>? topicItems;
|
||||
PageInfo? pageInfo;
|
||||
|
||||
TopicList({this.topicItems, this.pageInfo});
|
||||
|
||||
factory TopicList.fromJson(Map<String, dynamic> json) => TopicList(
|
||||
topicItems: (json['topic_items'] as List<dynamic>?)
|
||||
?.map((e) => FavTopicModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
pageInfo: json['page_info'] == null
|
||||
? null
|
||||
: PageInfo.fromJson(json['page_info'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'topic_items': topicItems?.map((e) => e.toJson()).toList(),
|
||||
'page_info': pageInfo?.toJson(),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user