mod: 新增推荐过滤器,回退model转换修改,移除不必要的futureBuilder

This commit is contained in:
orz12
2024-01-20 17:07:10 +08:00
parent 41ddeab41a
commit 9122dd7f3a
14 changed files with 274 additions and 60 deletions

View File

@ -40,7 +40,7 @@ class RecVideoItemAppModel {
@HiveField(5)
RcmdStat? stat;
@HiveField(6)
String? duration;
int? duration;
@HiveField(7)
String? title;
@HiveField(8)
@ -79,13 +79,27 @@ class RecVideoItemAppModel {
cid = json['player_args'] != null ? json['player_args']['cid'] : -1;
pic = json['cover'];
stat = RcmdStat.fromJson(json);
duration = json['cover_right_text'];
// 改用player_args中的duration作为原始数据秒数
duration = json['player_args'] != null
? json['player_args']['duration']
: -1;
//duration = json['cover_right_text'];
title = json['title'];
isFollowed = 0;
owner = RcmdOwner.fromJson(json);
rcmdReason = json['rcmd_reason_style'] != null
? RcmdReason.fromJson(json['rcmd_reason_style'])
: null;
// 由于app端api并不会直接返回与owner的关注状态
// 所以借用推荐原因是否为“已关注”、“新关注”等判别关注状态从而与web端接口等效
isFollowed = rcmdReason != null &&
rcmdReason!.content != null &&
rcmdReason!.content!.contains('关注')
? 1
: 0;
// 如果是就无需再显示推荐原因交由view统一处理即可
if (isFollowed == 1) {
rcmdReason = null;
}
goto = json['goto'];
param = int.parse(json['param']);
uri = json['uri'];