feat: 新增不感兴趣功能;优化access_key刷新反馈

This commit is contained in:
orz12
2024-06-14 16:46:36 +08:00
parent ed6651bf7e
commit 72ba9f7062
6 changed files with 309 additions and 9 deletions

View File

@@ -325,7 +325,7 @@ class VideoHttp {
String? accessKey = GStrorage.localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'];
if (accessKey == null || accessKey == "") {
return {'status': false, 'data': [], 'msg': "本操作使用app端接口请前往【隐私设置】刷新access_key"};
return {'status': false, 'msg': "本操作使用app端接口请前往【隐私设置】刷新access_key"};
}
var res = await Request().post(
Api.dislikeVideo,
@@ -337,9 +337,74 @@ class VideoHttp {
);
print(res);
if (res.data is! String && res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
return {'status': true};
} else {
return {'status': false, 'data': [], 'msg': res.data['message']};
return {
'status': false,
'msg': res.data is String ? res.data : res.data['message']
};
}
}
// 推送不感兴趣反馈
static Future feedDislike(
{required String goto,
required int id,
int? reasonId,
int? feedbackId}) async {
String? accessKey = GStrorage.localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'];
if (accessKey == null || accessKey == "") {
return {'status': false, 'msg': "本操作使用app端接口请前往【隐私设置】刷新access_key"};
}
assert((reasonId != null) ^ (feedbackId != null));
var res = await Request().get(Api.feedDislike, data: {
'goto': goto,
'id': id,
// 'mid': mid,
if (reasonId != null) 'reason_id': reasonId,
if (feedbackId != null) 'feedback_id': feedbackId,
'build': 1,
'mobi_app': 'android',
'access_key': accessKey,
'appkey': Constants.appKey,
});
print(res);
if (res.data['code'] == 0) {
return {'status': true};
} else {
return {'status': false, 'msg': res.data['message']};
}
}
// 推送不感兴趣取消
static Future feedDislikeCancel(
{required String goto,
required int id,
int? reasonId,
int? feedbackId}) async {
String? accessKey = GStrorage.localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'];
if (accessKey == null || accessKey == "") {
return {'status': false, 'msg': "本操作使用app端接口请前往【隐私设置】刷新access_key"};
}
// assert ((reasonId != null) ^ (feedbackId != null));
var res = await Request().get(Api.feedDislikeCancel, data: {
'goto': goto,
'id': id,
// 'mid': mid,
if (reasonId != null) 'reason_id': reasonId,
if (feedbackId != null) 'feedback_id': feedbackId,
'build': 1,
'mobi_app': 'android',
'access_key': accessKey,
'appkey': Constants.appKey,
});
print(res);
if (res.data['code'] == 0) {
return {'status': true};
} else {
return {'status': false, 'msg': res.data['message']};
}
}