mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt query pgc timeline
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -3,7 +3,7 @@ import 'package:PiliPlus/models_new/pgc/pgc_timeline/result.dart';
|
||||
class PgcTimeline {
|
||||
int? code;
|
||||
String? message;
|
||||
List<Result>? result;
|
||||
List<TimelineResult>? result;
|
||||
|
||||
PgcTimeline({this.code, this.message, this.result});
|
||||
|
||||
@@ -11,7 +11,7 @@ class PgcTimeline {
|
||||
code: json['code'] as int?,
|
||||
message: json['message'] as String?,
|
||||
result: (json['result'] as List<dynamic>?)
|
||||
?.map((e) => Result.fromJson(e as Map<String, dynamic>))
|
||||
?.map((e) => TimelineResult.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import 'package:PiliPlus/models_new/pgc/pgc_timeline/episode.dart';
|
||||
|
||||
class Result {
|
||||
class TimelineResult {
|
||||
String? date;
|
||||
int? dateTs;
|
||||
int? dayOfWeek;
|
||||
List<Episode>? episodes;
|
||||
int? isToday;
|
||||
|
||||
Result({
|
||||
TimelineResult({
|
||||
this.date,
|
||||
this.dateTs,
|
||||
this.dayOfWeek,
|
||||
@@ -15,7 +15,7 @@ class Result {
|
||||
this.isToday,
|
||||
});
|
||||
|
||||
factory Result.fromJson(Map<String, dynamic> json) => Result(
|
||||
factory TimelineResult.fromJson(Map<String, dynamic> json) => TimelineResult(
|
||||
date: json['date'] as String?,
|
||||
dateTs: json['date_ts'] as int?,
|
||||
dayOfWeek: json['day_of_week'] as int?,
|
||||
@@ -24,4 +24,12 @@ class Result {
|
||||
.toList(),
|
||||
isToday: json['is_today'] as int?,
|
||||
);
|
||||
|
||||
void operator +(TimelineResult other) {
|
||||
if (dateTs == other.dateTs) {
|
||||
if (other.episodes case final list?) {
|
||||
(episodes ??= <Episode>[]).addAll(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user