opt: bangumi triple

This commit is contained in:
bggRGjQaUbCoE
2024-10-01 20:44:41 +08:00
parent fb1ae9df15
commit 41ed15b0d7
3 changed files with 27 additions and 9 deletions

View File

@@ -108,6 +108,8 @@ class Api {
// csrf str CSRF Token位于cookie 必要 // csrf str CSRF Token位于cookie 必要
static const String oneThree = '/x/web-interface/archive/like/triple'; static const String oneThree = '/x/web-interface/archive/like/triple';
static const String triple = '/pgc/season/episode/like/triple';
// 获取指定用户创建的所有收藏夹信息 // 获取指定用户创建的所有收藏夹信息
// 该接口也能查询目标内容id存在于那些收藏夹中 // 该接口也能查询目标内容id存在于那些收藏夹中
// up_mid num 目标用户mid 必要 // up_mid num 目标用户mid 必要

View File

@@ -348,6 +348,27 @@ class VideoHttp {
} }
} }
// 一键三连 bangumi
static Future triple({dynamic epId}) async {
var res = await Request().post(
Api.triple,
data: {
'ep_id': epId,
'csrf': await Request.getCsrf(),
},
options: Options(
headers: {
'Content-Type': Headers.formUrlEncodedContentType,
},
),
);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
return {'status': false, 'data': [], 'msg': res.data['message']};
}
}
// 一键三连 // 一键三连
static Future oneThree({required String bvid}) async { static Future oneThree({required String bvid}) async {
var res = await Request().post( var res = await Request().post(
@@ -533,11 +554,6 @@ class VideoHttp {
var res = await Request().post( var res = await Request().post(
Api.replyAdd, Api.replyAdd,
data: FormData.fromMap(data), data: FormData.fromMap(data),
options: Options(
headers: {
'Content-Type': Headers.formUrlEncodedContentType,
},
),
); );
log(res.toString()); log(res.toString());
if (res.data['code'] == 0) { if (res.data['code'] == 0) {

View File

@@ -430,11 +430,11 @@ class BangumiIntroController extends CommonController {
SmartDialog.showToast('已三连'); SmartDialog.showToast('已三连');
return false; return false;
} }
var result = await VideoHttp.oneThree(bvid: bvid); var result = await VideoHttp.triple(epId: epId);
if (result['status']) { if (result['status']) {
hasLike.value = result["data"]["like"]; hasLike.value = result["data"]["like"] == 1;
hasCoin.value = result["data"]["coin"]; hasCoin.value = result["data"]["coin"] == 1;
hasFav.value = result["data"]["fav"]; hasFav.value = result["data"]["favorite"] == 1;
SmartDialog.showToast('三连成功'); SmartDialog.showToast('三连成功');
} else { } else {
SmartDialog.showToast(result['msg']); SmartDialog.showToast(result['msg']);