feat: dyn topic rcmd

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-06-09 19:50:07 +08:00
parent f1e4130201
commit 10efd96788
15 changed files with 260 additions and 142 deletions

View File

@@ -1,11 +1,11 @@
import 'package:PiliPlus/models_new/dynamic/dyn_topic_pub_search/new_topic.dart';
import 'package:PiliPlus/models_new/dynamic/dyn_topic_pub_search/page_info.dart';
import 'package:PiliPlus/models_new/dynamic/dyn_topic_pub_search/topic_item.dart';
import 'package:PiliPlus/models_new/dynamic/dyn_topic_top/topic_item.dart';
class TopicPubSearchData {
NewTopic? newTopic;
bool? hasCreateJurisdiction;
List<TopicPubSearchItem>? topicItems;
List<TopicItem>? topicItems;
String? requestId;
PageInfo? pageInfo;
@@ -24,7 +24,7 @@ class TopicPubSearchData {
: NewTopic.fromJson(json['new_topic'] as Map<String, dynamic>),
hasCreateJurisdiction: json['has_create_jurisdiction'] as bool?,
topicItems: (json['topic_items'] as List<dynamic>?)
?.map((e) => TopicPubSearchItem.fromJson(e as Map<String, dynamic>))
?.map((e) => TopicItem.fromJson(e as Map<String, dynamic>))
.toList(),
requestId: json['request_id'] as String?,
pageInfo: json['page_info'] == null

View File

@@ -1,30 +0,0 @@
class TopicPubSearchItem {
int? id;
String? name;
int? view;
int? discuss;
String? statDesc;
String? description;
bool? showInteractData;
TopicPubSearchItem({
this.id,
this.name,
this.view,
this.discuss,
this.statDesc,
this.description,
this.showInteractData,
});
factory TopicPubSearchItem.fromJson(Map<String, dynamic> json) =>
TopicPubSearchItem(
id: json['id'] as int?,
name: json['name'] as String?,
view: json['view'] as int?,
discuss: json['discuss'] as int?,
statDesc: json['stat_desc'] as String?,
description: json['description'] as String?,
showInteractData: json['show_interact_data'] as bool?,
);
}

View File

@@ -1,10 +1,10 @@
class TopicItem {
int? id;
String? name;
int? view;
int? discuss;
late int fav;
late int like;
int id;
String name;
int view;
int discuss;
int fav;
int like;
int? dynamics;
String? jumpUrl;
String? backColor;
@@ -17,10 +17,10 @@ class TopicItem {
bool? isLike;
TopicItem({
this.id,
this.name,
this.view,
this.discuss,
required this.id,
required this.name,
required this.view,
required this.discuss,
required this.fav,
required this.like,
this.dynamics,
@@ -36,12 +36,12 @@ class TopicItem {
});
factory TopicItem.fromJson(Map<String, dynamic> json) => TopicItem(
id: json['id'] as int?,
name: json['name'] as String?,
view: json['view'] as int? ?? 0,
discuss: json['discuss'] as int? ?? 0,
fav: json['fav'] as int? ?? 0,
like: json['like'] as int? ?? 0,
id: json['id'],
name: json['name'],
view: json['view'] ?? 0,
discuss: json['discuss'] ?? 0,
fav: json['fav'] ?? 0,
like: json['like'] ?? 0,
dynamics: json['dynamics'] as int?,
jumpUrl: json['jump_url'] as String?,
backColor: json['back_color'] as String?,