mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-20 00:56:31 +08:00
opt: unify fav & coin of video & pgc (#916)
This commit is contained in:
committed by
GitHub
parent
e945daba3a
commit
05c9269531
@@ -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