opt: unify fav & coin of video & pgc (#916)

This commit is contained in:
My-Responsitories
2025-07-31 20:16:42 +08:00
committed by GitHub
parent e945daba3a
commit 05c9269531
15 changed files with 194 additions and 316 deletions

View File

@@ -56,7 +56,7 @@ class PgcInfoModel {
int? showSeasonType;
String? squareCover;
String? staff;
Stat? stat;
PgcStat? stat;
int? status;
List? styles;
String? subtitle;
@@ -187,7 +187,7 @@ class PgcInfoModel {
staff: json['staff'] as String?,
stat: json['stat'] == null
? null
: Stat.fromJson(json['stat'] as Map<String, dynamic>),
: PgcStat.fromJson(json['stat'] as Map<String, dynamic>),
status: json['status'] as int?,
styles: json['styles'],
subtitle: json['subtitle'] as String?,

View File

@@ -17,7 +17,7 @@ class Season {
int? seasonId;
String? seasonTitle;
int? seasonType;
Stat? stat;
PgcStat? stat;
Season({
this.badge,
@@ -58,6 +58,6 @@ class Season {
seasonType: json['season_type'] as int?,
stat: json['stat'] == null
? null
: Stat.fromJson(json['stat'] as Map<String, dynamic>),
: PgcStat.fromJson(json['stat'] as Map<String, dynamic>),
);
}

View File

@@ -1,38 +1,19 @@
class Stat {
num coins;
int? danmakus;
int favorite;
import 'package:PiliPlus/models_new/video/video_detail/stat_detail.dart';
class PgcStat extends StatDetail {
int? favorites;
String? followText;
int likes;
int? reply;
int? share;
int? views;
int? vt;
Stat({
required this.coins,
this.danmakus,
required this.favorite,
this.favorites,
this.followText,
required this.likes,
this.reply,
this.share,
this.views,
this.vt,
});
factory Stat.fromJson(Map<String, dynamic> json) => Stat(
coins: json["coins"] ?? 0,
danmakus: json["danmakus"],
favorite: json["favorite"] ?? 0,
favorites: json["favorites"],
followText: json["follow_text"],
likes: json["likes"] ?? 0,
reply: json["reply"],
share: json["share"],
views: json["views"],
vt: json["vt"],
);
PgcStat.fromJson(Map<String, dynamic> json) {
coin = json["coins"] ?? 0;
danmaku = json["danmakus"];
favorite = json["favorite"] ?? 0;
favorites = json["favorites"];
followText = json["follow_text"];
like = json["likes"] ?? 0;
reply = json["reply"];
share = json["share"];
view = json["views"];
vt = json["vt"];
}
}