mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-09 18:50:11 +08:00
opt: unify fav & coin of video & pgc (#916)
This commit is contained in:
committed by
GitHub
parent
e945daba3a
commit
05c9269531
@@ -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?,
|
||||
|
||||
@@ -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>),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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"];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:PiliPlus/models/model_owner.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/dimension.dart';
|
||||
import 'package:PiliPlus/models/model_video.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/rights.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/stat.dart';
|
||||
|
||||
@@ -18,7 +18,7 @@ class Arc {
|
||||
int? duration;
|
||||
Rights? rights;
|
||||
Owner? author;
|
||||
Stat? stat;
|
||||
VideoStat? stat;
|
||||
String? dynam1c;
|
||||
Dimension? dimension;
|
||||
bool? isChargeableSeason;
|
||||
@@ -77,7 +77,7 @@ class Arc {
|
||||
: Owner.fromJson(json['author'] as Map<String, dynamic>),
|
||||
stat: json['stat'] == null
|
||||
? null
|
||||
: Stat.fromJson(json['stat'] as Map<String, dynamic>),
|
||||
: VideoStat.fromJson(json['stat'] as Map<String, dynamic>),
|
||||
dynam1c: json['dynamic'] as String?,
|
||||
dimension: json['dimension'] == null
|
||||
? null
|
||||
|
||||
@@ -30,7 +30,7 @@ class VideoDetailData {
|
||||
int? duration;
|
||||
Rights? rights;
|
||||
Owner? owner;
|
||||
Stat? stat;
|
||||
VideoStat? stat;
|
||||
ArgueInfo? argueInfo;
|
||||
String? dynam1c;
|
||||
int? cid;
|
||||
@@ -137,7 +137,7 @@ class VideoDetailData {
|
||||
: Owner.fromJson(json['owner'] as Map<String, dynamic>),
|
||||
stat: json['stat'] == null
|
||||
? null
|
||||
: Stat.fromJson(json['stat'] as Map<String, dynamic>),
|
||||
: VideoStat.fromJson(json['stat'] as Map<String, dynamic>),
|
||||
argueInfo: json['argue_info'] == null
|
||||
? null
|
||||
: ArgueInfo.fromJson(json['argue_info'] as Map<String, dynamic>),
|
||||
|
||||
@@ -1,47 +1,25 @@
|
||||
class Stat {
|
||||
import 'package:PiliPlus/models_new/video/video_detail/stat_detail.dart';
|
||||
|
||||
class VideoStat extends StatDetail {
|
||||
int? aid;
|
||||
int? view;
|
||||
int? danmaku;
|
||||
int? reply;
|
||||
int favorite;
|
||||
num coin;
|
||||
int? share;
|
||||
int? nowRank;
|
||||
int? hisRank;
|
||||
int like;
|
||||
int? dislike;
|
||||
String? evaluation;
|
||||
int? vt;
|
||||
|
||||
Stat({
|
||||
this.aid,
|
||||
this.view,
|
||||
this.danmaku,
|
||||
this.reply,
|
||||
required this.favorite,
|
||||
required this.coin,
|
||||
this.share,
|
||||
this.nowRank,
|
||||
this.hisRank,
|
||||
required this.like,
|
||||
this.dislike,
|
||||
this.evaluation,
|
||||
this.vt,
|
||||
});
|
||||
|
||||
factory Stat.fromJson(Map<String, dynamic> json) => Stat(
|
||||
aid: json['aid'] as int?,
|
||||
view: json['view'] as int?,
|
||||
danmaku: json['danmaku'] as int?,
|
||||
reply: json['reply'] as int?,
|
||||
favorite: json['favorite'] as int? ?? 0,
|
||||
coin: json['coin'] as num? ?? 0,
|
||||
share: json['share'] as int?,
|
||||
nowRank: json['now_rank'] as int?,
|
||||
hisRank: json['his_rank'] as int?,
|
||||
like: json['like'] as int? ?? 0,
|
||||
dislike: json['dislike'] as int?,
|
||||
evaluation: json['evaluation'] as String?,
|
||||
vt: json['vt'] as int?,
|
||||
);
|
||||
VideoStat.fromJson(Map<String, dynamic> json) {
|
||||
aid = json['aid'] as int?;
|
||||
view = json['view'] as int?;
|
||||
danmaku = json['danmaku'] as int?;
|
||||
reply = json['reply'] as int?;
|
||||
favorite = json['favorite'] as int? ?? 0;
|
||||
coin = json['coin'] as num? ?? 0;
|
||||
share = json['share'] as int?;
|
||||
nowRank = json['now_rank'] as int?;
|
||||
hisRank = json['his_rank'] as int?;
|
||||
like = json['like'] as int? ?? 0;
|
||||
dislike = json['dislike'] as int?;
|
||||
evaluation = json['evaluation'] as String?;
|
||||
vt = json['vt'] as int?;
|
||||
}
|
||||
}
|
||||
|
||||
10
lib/models_new/video/video_detail/stat_detail.dart
Normal file
10
lib/models_new/video/video_detail/stat_detail.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
abstract class StatDetail {
|
||||
late num coin;
|
||||
int? danmaku;
|
||||
late int favorite;
|
||||
late int like;
|
||||
int? reply;
|
||||
int? share;
|
||||
int? view;
|
||||
int? vt;
|
||||
}
|
||||
@@ -10,7 +10,7 @@ class UgcSeason {
|
||||
int? signState;
|
||||
int? attribute;
|
||||
List<SectionItem>? sections;
|
||||
Stat? stat;
|
||||
VideoStat? stat;
|
||||
int? epCount;
|
||||
int? seasonType;
|
||||
bool? isPaySeason;
|
||||
@@ -45,7 +45,7 @@ class UgcSeason {
|
||||
.toList(),
|
||||
stat: json['stat'] == null
|
||||
? null
|
||||
: Stat.fromJson(json['stat'] as Map<String, dynamic>),
|
||||
: VideoStat.fromJson(json['stat'] as Map<String, dynamic>),
|
||||
epCount: json['ep_count'] as int?,
|
||||
seasonType: json['season_type'] as int?,
|
||||
isPaySeason: json['is_pay_season'] as bool?,
|
||||
|
||||
Reference in New Issue
Block a user