fix: 首页推荐数据格式异常
This commit is contained in:
@ -34,7 +34,7 @@ class RecVideoItemAppModel {
|
||||
String? title;
|
||||
int? isFollowed;
|
||||
RcmdOwner? owner;
|
||||
RcmdReason? rcmdReason;
|
||||
String? rcmdReason;
|
||||
String? goto;
|
||||
int? param;
|
||||
String? uri;
|
||||
@ -64,17 +64,11 @@ class RecVideoItemAppModel {
|
||||
//duration = json['cover_right_text'];
|
||||
title = json['title'];
|
||||
owner = RcmdOwner.fromJson(json);
|
||||
rcmdReason = json['rcmd_reason_style'] != null
|
||||
? RcmdReason.fromJson(json['rcmd_reason_style'])
|
||||
: null;
|
||||
rcmdReason = json['bottom_rcmd_reason'] ?? json['top_rcmd_reason'];
|
||||
// 由于app端api并不会直接返回与owner的关注状态
|
||||
// 所以借用推荐原因是否为“已关注”、“新关注”等判别关注状态,从而与web端接口等效
|
||||
RegExp regex = RegExp(r'已关注|新关注');
|
||||
isFollowed = rcmdReason != null &&
|
||||
rcmdReason!.content != null &&
|
||||
regex.hasMatch(rcmdReason!.content!)
|
||||
? 1
|
||||
: 0;
|
||||
isFollowed = regex.hasMatch(rcmdReason ?? '') ? 1 : 0;
|
||||
// 如果是,就无需再显示推荐原因,交由view统一处理即可
|
||||
if (isFollowed == 1) {
|
||||
rcmdReason = null;
|
||||
|
Reference in New Issue
Block a user