mod: load total replies without login

This commit is contained in:
bggRGjQaUbCoE
2024-08-26 18:20:13 +08:00
parent 2fde055748
commit 7e2e08024a

View File

@@ -1,16 +1,22 @@
import 'package:dio/dio.dart';
import '../models/video/reply/data.dart'; import '../models/video/reply/data.dart';
import '../models/video/reply/emote.dart'; import '../models/video/reply/emote.dart';
import 'api.dart'; import 'api.dart';
import 'constants.dart';
import 'init.dart'; import 'init.dart';
class ReplyHttp { class ReplyHttp {
static final _dio = Dio();
static Future replyList({ static Future 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 {
var res = await Request().get(Api.replyList, data: { try {
var res = await _dio
.get('${HttpString.apiBaseUrl}${Api.replyList}', queryParameters: {
'oid': oid, 'oid': oid,
'type': type, 'type': type,
'pagination_str': '{"offset":"${nextOffset.replaceAll('"', '\\"')}"}', 'pagination_str': '{"offset":"${nextOffset.replaceAll('"', '\\"')}"}',
@@ -28,6 +34,13 @@ class ReplyHttp {
'msg': res.data['message'], 'msg': res.data['message'],
}; };
} }
} catch (e) {
return {
'status': false,
'date': [],
'msg': e.toString(),
};
}
} }
static Future replyReplyList({ static Future replyReplyList({
@@ -37,7 +50,9 @@ class ReplyHttp {
required int type, required int type,
int sort = 1, int sort = 1,
}) async { }) async {
var res = await Request().get(Api.replyReplyList, data: { try {
var res = await _dio.get('${HttpString.apiBaseUrl}${Api.replyReplyList}',
queryParameters: {
'oid': oid, 'oid': oid,
'root': root, 'root': root,
'pn': pageNum, 'pn': pageNum,
@@ -57,6 +72,13 @@ class ReplyHttp {
'msg': res.data['message'], 'msg': res.data['message'],
}; };
} }
} catch (e) {
return {
'status': false,
'date': [],
'msg': e.toString(),
};
}
} }
// 评论点赞 // 评论点赞
@@ -87,7 +109,6 @@ class ReplyHttp {
} }
} }
static Future getEmoteList({String? business}) async { static Future getEmoteList({String? business}) async {
var res = await Request().get(Api.myEmote, data: { var res = await Request().get(Api.myEmote, data: {
'business': business ?? 'reply', 'business': business ?? 'reply',