diff --git a/lib/models/home/rcmd/result.dart b/lib/models/home/rcmd/result.dart index 6f6141c7..590da0a3 100644 --- a/lib/models/home/rcmd/result.dart +++ b/lib/models/home/rcmd/result.dart @@ -47,8 +47,8 @@ class RecVideoItemAppModel extends BaseRecVideoItemModel { cardType = json['card_type']; adInfo = json['ad_info']; - threePoint = json['three_point'] != null - ? ThreePoint.fromJson(json['three_point']) + threePoint = json['three_point_v2'] != null + ? ThreePoint.fromJson(json['three_point_v2']) : null; desc = json['desc']; } @@ -94,15 +94,26 @@ class RcmdOwner extends BaseOwner { class ThreePoint { List? dislikeReasons; List? feedbacks; - int? watchLater; + // int? watchLater; - ThreePoint.fromJson(Map json) { - dislikeReasons = (json['dislike_reasons'] as List?) - ?.map((v) => Reason.fromJson(v)) - .toList(); - feedbacks = - (json['feedbacks'] as List?)?.map((v) => Reason.fromJson(v)).toList(); - watchLater = json['watch_later']; + ThreePoint.fromJson(List json) { + for (var elem in json) { + switch (elem['type']) { + // case 'watch_later': + // watchLater = 1; + // break; + 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; + } + } } }