feat: 点赞投币调整为app接口,启用长按三连功能

This commit is contained in:
orz12
2024-07-11 17:30:11 +08:00
parent 26dcef3728
commit 4aba65c90b
4 changed files with 79 additions and 84 deletions

View File

@@ -8,7 +8,8 @@ class Api {
// APP端不感兴趣、取消不感兴趣
static const String feedDislike = '${HttpString.appBaseUrl}/x/feed/dislike';
static const String feedDislikeCancel = '${HttpString.appBaseUrl}/x/feed/dislike/cancel';
static const String feedDislikeCancel =
'${HttpString.appBaseUrl}/x/feed/dislike/cancel';
// 热门视频
static const String hotList = '/x/web-interface/popular';
@@ -35,8 +36,10 @@ class Api {
/// like num 操作方式 必要 1点赞 2取消赞
// csrf str CSRF Token位于cookie 必要
// https://api.bilibili.com/x/web-interface/archive/like
static const String likeVideo = '/x/web-interface/archive/like';
// static const String likeVideo = '/x/web-interface/archive/like';
// 改用app端点赞接口
static const String likeVideo = '${HttpString.appBaseUrl}/x/v2/view/like';
//判断视频是否被点赞双端Get
// access_key str APP登录Token APP方式必要
/// aid num 稿件avid 必要(可选) avid与bvid任选一个
@@ -50,7 +53,8 @@ class Api {
/// access_key str APP登录Token 必要
/// aid num 稿件avid 必要
///
static const String dislikeVideo = '${HttpString.appBaseUrl}/x/v2/view/dislike';
static const String dislikeVideo =
'${HttpString.appBaseUrl}/x/v2/view/dislike';
// 投币视频web端POST
/// aid num 稿件avid 必要(可选) avid与bvid任选一个
@@ -59,7 +63,10 @@ class Api {
/// select_like num 是否附加点赞 非必要 0不点赞 1同时点赞 默认为0
// csrf str CSRF Token位于cookie 必要
// https://api.bilibili.com/x/web-interface/coin/add
static const String coinVideo = '/x/web-interface/coin/add';
// static const String coinVideo = '/x/web-interface/coin/add';
// 改用app端投币接口
static const String coinVideo = '${HttpString.appBaseUrl}/x/v2/view/coin/add';
// 判断视频是否被投币双端GET
// access_key str APP登录Token APP方式必要
@@ -383,13 +390,16 @@ class Api {
//https://api.bilibili.com/x/msgfeed/like?platform=web&build=0&mobi_app=web
static const String msgFeedLike = '/x/msgfeed/like';
//https://message.bilibili.com/x/sys-msg/query_user_notify?csrf=xxxx&csrf=xxxx&page_size=20&build=0&mobi_app=web
static const String msgSysUserNotify = '${HttpString.messageBaseUrl}/x/sys-msg/query_user_notify';
static const String msgSysUserNotify =
'${HttpString.messageBaseUrl}/x/sys-msg/query_user_notify';
//https://message.bilibili.com/x/sys-msg/query_unified_notify?csrf=xxxx&csrf=xxxx&page_size=10&build=0&mobi_app=web
static const String msgSysUnifiedNotify = '${HttpString.messageBaseUrl}/x/sys-msg/query_unified_notify';
static const String msgSysUnifiedNotify =
'${HttpString.messageBaseUrl}/x/sys-msg/query_unified_notify';
// 系统信息光标更新(已读标记)
//https://message.bilibili.com/x/sys-msg/update_cursor?csrf=xxxx&csrf=xxxx&cursor=1705288500000000000&has_up=0&build=0&mobi_app=web
static const String msgSysUpdateCursor = '${HttpString.messageBaseUrl}/x/sys-msg/update_cursor';
static const String msgSysUpdateCursor =
'${HttpString.messageBaseUrl}/x/sys-msg/update_cursor';
/// 私聊
/// 'https://api.vc.bilibili.com/session_svr/v1/session_svr/get_sessions?

View File

@@ -256,7 +256,7 @@ class VideoHttp {
// };
return {
'status': false,
'data': null,
'data': result.data,
'code': result.code,
'msg': result.message,
// 'msg': errMap[result.code] ?? '请求异常',
@@ -307,12 +307,16 @@ class VideoHttp {
var res = await Request().post(
Api.coinVideo,
queryParameters: {
'bvid': bvid,
'aid': IdUtils.bv2av(bvid),
// 'bvid': bvid,
'multiply': multiply,
'select_like': 0,
'csrf': await Request.getCsrf(),
'access_key': GStorage.localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'],
// 'csrf': await Request.getCsrf(),
},
);
print(res);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
@@ -351,10 +355,16 @@ class VideoHttp {
var res = await Request().post(
Api.likeVideo,
queryParameters: {
'bvid': bvid,
'like': type ? 1 : 2,
'csrf': await Request.getCsrf(),
},
'aid': IdUtils.bv2av(bvid),
'like': type ? 0 : 1,
'access_key': GStorage.localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'],
}
// queryParameters: {
// 'bvid': bvid,
// 'like': type ? 1 : 2,
// 'csrf': await Request.getCsrf(),
// },
);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};