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

@ -55,12 +55,13 @@ class RcmdController extends GetxController {
}
late final Map<String,dynamic> res;
switch (defaultRcmdType) {
case 'app': case 'notLogin':
res = await VideoHttp.rcmdVideoListApp(
loginStatus: defaultRcmdType != 'notLogin',
freshIdx: _currentPage,
);
break;
case 'app':
case 'notLogin':
res = await VideoHttp.rcmdVideoListApp(
loginStatus: defaultRcmdType != 'notLogin',
freshIdx: _currentPage,
);
break;
default: //'web'
res = await VideoHttp.rcmdVideoList(
freshIdx: _currentPage,
@ -83,10 +84,16 @@ class RcmdController extends GetxController {
} else if (type == 'onLoad') {
videoList.addAll(res['data']);
}
// 目前仅支持app端系列保存缓存
if (defaultRcmdType != 'web') {
recVideo.put('cacheList', res['data']);
}
_currentPage += 1;
// 若videoList数量太小可能会影响翻页此时再次请求
// 为避免请求到的数据太少时还在反复请求要求本次返回数据大于1条才触发
if (res['data'].length > 1 && videoList.length < 10){
queryRcmdFeed('onLoad');
}
} else {
Get.snackbar('提示', res['msg']);
}