feat: 我的订阅新增播单支持

This commit is contained in:
orz12
2024-04-26 23:41:29 +08:00
parent c90f75de72
commit 30998611da
6 changed files with 100 additions and 37 deletions

View File

@@ -517,8 +517,11 @@ class Api {
/// 我的订阅
static const userSubFolder = '/x/v3/fav/folder/collected/list';
/// 我的订阅详情
static const userSubFolderDetail = '/x/space/fav/season/list';
/// 我的订阅-合集详情
static const favSeasonList = '/x/space/fav/season/list';
/// 我的订阅-播单详情
static const favResourceList = '/x/v3/fav/resource/list';
/// 发送私信
static const String sendMsg = '${HttpString.tUrl}/web_im/v1/web_im/send_msg';
@@ -526,6 +529,9 @@ class Api {
/// 排行榜
static const String getRankApi = "/x/web-interface/ranking/v2";
/// 取消订阅
static const String cancelSub = '/x/v3/fav/season/unfav';
/// 取消订阅-合集
static const String unfavSeason = '/x/v3/fav/season/unfav';
/// 取消订阅-播单
static const String unfavFolder = '/x/v3/fav/folder/unfav';
}

View File

@@ -334,13 +334,33 @@ class UserHttp {
}
}
static Future userSubFolderDetail({
required int seasonId,
static Future favSeasonList({
required int id,
required int pn,
required int ps,
}) async {
var res = await Request().get(Api.userSubFolderDetail, data: {
'season_id': seasonId,
var res = await Request().get(Api.favSeasonList, data: {
'season_id': id,
'ps': ps,
'pn': pn,
});
if (res.data['code'] == 0) {
return {
'status': true,
'data': SubDetailModelData.fromJson(res.data['data'])
};
} else {
return {'status': false, 'msg': res.data['message']};
}
}
static Future favResourceList({
required int id,
required int pn,
required int ps,
}) async {
var res = await Request().get(Api.favResourceList, data: {
'media_id': id,
'ps': ps,
'pn': pn,
});
@@ -355,15 +375,26 @@ class UserHttp {
}
// 取消订阅
static Future cancelSub({required int seasonId}) async {
var res = await Request().post(
Api.cancelSub,
queryParameters: {
'platform': 'web',
'season_id': seasonId,
'csrf': await Request.getCsrf(),
},
);
static Future cancelSub({required int id, required int type}) async {
late dynamic res;
if (type == 11) {
res = await Request().post(
Api.unfavFolder,
queryParameters: {
'media_id': id,
'csrf': await Request.getCsrf(),
},
);
} else {
res = await Request().post(
Api.unfavSeason,
queryParameters: {
'platform': 'web',
'season_id': id,
'csrf': await Request.getCsrf(),
},
);
}
if (res.data['code'] == 0) {
return {'status': true};
} else {