diff --git a/lib/http/api.dart b/lib/http/api.dart index 86074c79..4e844ba9 100644 --- a/lib/http/api.dart +++ b/lib/http/api.dart @@ -108,6 +108,8 @@ class Api { // csrf str CSRF Token(位于cookie) 必要 static const String oneThree = '/x/web-interface/archive/like/triple'; + static const String triple = '/pgc/season/episode/like/triple'; + // 获取指定用户创建的所有收藏夹信息 // 该接口也能查询目标内容id存在于那些收藏夹中 // up_mid num 目标用户mid 必要 diff --git a/lib/http/video.dart b/lib/http/video.dart index f05d7dca..7f14c316 100644 --- a/lib/http/video.dart +++ b/lib/http/video.dart @@ -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 { var res = await Request().post( @@ -533,11 +554,6 @@ class VideoHttp { var res = await Request().post( Api.replyAdd, data: FormData.fromMap(data), - options: Options( - headers: { - 'Content-Type': Headers.formUrlEncodedContentType, - }, - ), ); log(res.toString()); if (res.data['code'] == 0) { diff --git a/lib/pages/bangumi/introduction/controller.dart b/lib/pages/bangumi/introduction/controller.dart index f9eea235..ff45d51a 100644 --- a/lib/pages/bangumi/introduction/controller.dart +++ b/lib/pages/bangumi/introduction/controller.dart @@ -430,11 +430,11 @@ class BangumiIntroController extends CommonController { SmartDialog.showToast('已三连'); return false; } - var result = await VideoHttp.oneThree(bvid: bvid); + var result = await VideoHttp.triple(epId: epId); if (result['status']) { - hasLike.value = result["data"]["like"]; - hasCoin.value = result["data"]["coin"]; - hasFav.value = result["data"]["fav"]; + hasLike.value = result["data"]["like"] == 1; + hasCoin.value = result["data"]["coin"] == 1; + hasFav.value = result["data"]["favorite"] == 1; SmartDialog.showToast('三连成功'); } else { SmartDialog.showToast(result['msg']);