mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: 未登录状态下评论区条数受限(需移除cookie)
https://github.com/orz12/PiliPalaX/pull/214
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:PiliPalaX/http/loading_state.dart';
|
import 'package:PiliPalaX/http/loading_state.dart';
|
||||||
import 'package:PiliPalaX/utils/extension.dart';
|
import 'package:PiliPalaX/utils/storage.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
|
|
||||||
import '../models/video/reply/data.dart';
|
import '../models/video/reply/data.dart';
|
||||||
@@ -9,28 +11,30 @@ import 'constants.dart';
|
|||||||
import 'init.dart';
|
import 'init.dart';
|
||||||
|
|
||||||
class ReplyHttp {
|
class ReplyHttp {
|
||||||
static final _dio = Dio();
|
|
||||||
static Future<LoadingState> replyList({
|
static Future<LoadingState> replyList({
|
||||||
required int oid,
|
required int oid,
|
||||||
required String nextOffset,
|
required String nextOffset,
|
||||||
required int type,
|
required int type,
|
||||||
int sort = 1,
|
int sort = 1,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
Options? options = GStorage.userInfo.get('userInfoCache') == null
|
||||||
var res = await _dio
|
? Options(
|
||||||
.get('${HttpString.apiBaseUrl}${Api.replyList}', queryParameters: {
|
headers: {HttpHeaders.cookieHeader: "buvid3= ; b_nut= ; sid= "})
|
||||||
|
: null;
|
||||||
|
var res = await Request().get(
|
||||||
|
'${HttpString.apiBaseUrl}${Api.replyList}',
|
||||||
|
data: {
|
||||||
'oid': oid,
|
'oid': oid,
|
||||||
'type': type,
|
'type': type,
|
||||||
'pagination_str': '{"offset":"${nextOffset.replaceAll('"', '\\"')}"}',
|
'pagination_str': '{"offset":"${nextOffset.replaceAll('"', '\\"')}"}',
|
||||||
'mode': sort + 2, //2:按时间排序;3:按热度排序
|
'mode': sort + 2, //2:按时间排序;3:按热度排序
|
||||||
});
|
},
|
||||||
if (res.data['code'] == 0) {
|
options: options,
|
||||||
return LoadingState.success(ReplyData.fromJson(res.data['data']));
|
);
|
||||||
} else {
|
if (res.data['code'] == 0) {
|
||||||
return LoadingState.error(res.data['message']);
|
return LoadingState.success(ReplyData.fromJson(res.data['data']));
|
||||||
}
|
} else {
|
||||||
} catch (e) {
|
return LoadingState.error(res.data['message']);
|
||||||
return LoadingState.error(e.toString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,23 +45,26 @@ class ReplyHttp {
|
|||||||
required int type,
|
required int type,
|
||||||
int sort = 1,
|
int sort = 1,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
Options? options = GStorage.userInfo.get('userInfoCache') == null
|
||||||
var res = await _dio.get('${HttpString.apiBaseUrl}${Api.replyReplyList}',
|
? Options(
|
||||||
queryParameters: {
|
headers: {HttpHeaders.cookieHeader: "buvid3= ; b_nut= ; sid= "})
|
||||||
'oid': oid,
|
: null;
|
||||||
'root': root,
|
var res = await Request().get(
|
||||||
'pn': pageNum,
|
'${HttpString.apiBaseUrl}${Api.replyReplyList}',
|
||||||
'type': type,
|
data: {
|
||||||
'sort': 1,
|
'oid': oid,
|
||||||
'csrf': await Request.getCsrf(),
|
'root': root,
|
||||||
});
|
'pn': pageNum,
|
||||||
if (res.data['code'] == 0) {
|
'type': type,
|
||||||
return LoadingState.success(ReplyReplyData.fromJson(res.data['data']));
|
'sort': 1,
|
||||||
} else {
|
'csrf': await Request.getCsrf(),
|
||||||
return LoadingState.error(res.data['message']);
|
},
|
||||||
}
|
options: options,
|
||||||
} catch (e) {
|
);
|
||||||
return LoadingState.error(e.toString());
|
if (res.data['code'] == 0) {
|
||||||
|
return LoadingState.success(ReplyReplyData.fromJson(res.data['data']));
|
||||||
|
} else {
|
||||||
|
return LoadingState.error(res.data['message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user