新增模拟未登录推荐,独立推荐设置,新增accesskey风控警告,统一推荐逻辑

This commit is contained in:
orz12
2024-01-20 15:14:52 +08:00
parent 4673f6dc5b
commit 41ddeab41a
9 changed files with 210 additions and 181 deletions

View File

@ -46,7 +46,9 @@ class VideoHttp {
setting.get(SettingBoxKey.blackMidsList, defaultValue: [-1]);
for (var i in res.data['data']['item']) {
//过滤掉live与ad以及拉黑用户
if (i['goto'] == 'av' && !blackMidsList.contains(i['owner']['mid'])) {
if (i['goto'] == 'av' &&
(i['owner'] != null &&
!blackMidsList.contains(i['owner']['mid']))) {
list.add(RecVideoItemModel.fromJson(i));
}
}
@ -59,7 +61,9 @@ class VideoHttp {
}
}
static Future rcmdVideoListApp({int? ps, required int freshIdx}) async {
// 添加额外的loginState变量模拟未登录状态
static Future rcmdVideoListApp(
{bool loginStatus = true, required int freshIdx}) async {
try {
var res = await Request().get(
Api.recommendListApp,
@ -72,9 +76,11 @@ class VideoHttp {
'device_name': 'vivo',
'pull': freshIdx == 0 ? 'true' : 'false',
'appkey': Constants.appKey,
'access_key': localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'] ??
''
'access_key': loginStatus
? (localCache.get(LocalCacheKey.accessKey,
defaultValue: {})['value'] ??
'')
: ''
},
);
if (res.data['code'] == 0) {
@ -92,7 +98,7 @@ class VideoHttp {
}
return {'status': true, 'data': list};
} else {
return {'status': false, 'data': [], 'msg': ''};
return {'status': false, 'data': [], 'msg': res.data['message']};
}
} catch (err) {
return {'status': false, 'data': [], 'msg': err.toString()};