fix: three point (#792)

This commit is contained in:
My-Responsitories
2025-05-01 23:16:47 +08:00
committed by GitHub
parent 0b05edd6ff
commit 56491591ab

View File

@@ -47,8 +47,8 @@ class RecVideoItemAppModel extends BaseRecVideoItemModel {
cardType = json['card_type']; cardType = json['card_type'];
adInfo = json['ad_info']; adInfo = json['ad_info'];
threePoint = json['three_point'] != null threePoint = json['three_point_v2'] != null
? ThreePoint.fromJson(json['three_point']) ? ThreePoint.fromJson(json['three_point_v2'])
: null; : null;
desc = json['desc']; desc = json['desc'];
} }
@@ -94,15 +94,26 @@ class RcmdOwner extends BaseOwner {
class ThreePoint { class ThreePoint {
List<Reason>? dislikeReasons; List<Reason>? dislikeReasons;
List<Reason>? feedbacks; List<Reason>? feedbacks;
int? watchLater; // int? watchLater;
ThreePoint.fromJson(Map<String, dynamic> json) { ThreePoint.fromJson(List json) {
dislikeReasons = (json['dislike_reasons'] as List?) for (var elem in json) {
?.map((v) => Reason.fromJson(v)) switch (elem['type']) {
.toList(); // case 'watch_later':
feedbacks = // watchLater = 1;
(json['feedbacks'] as List?)?.map((v) => Reason.fromJson(v)).toList(); // break;
watchLater = json['watch_later']; case 'feedback':
feedbacks = (elem['reasons'] as List?)
?.map((i) => Reason.fromJson(i))
.toList();
break;
case 'dislike':
dislikeReasons = (elem['reasons'] as List?)
?.map((i) => Reason.fromJson(i))
.toList();
break;
}
}
} }
} }