mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: pgc index page
Closes #216 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,9 +1,55 @@
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
|
||||
import '../models/bangumi/list.dart';
|
||||
import '../models/bangumi/pgc_index/condition.dart';
|
||||
import 'index.dart';
|
||||
|
||||
class BangumiHttp {
|
||||
static Future<LoadingState> pgcIndexResult({
|
||||
required int page,
|
||||
required Map<String, dynamic> params,
|
||||
seasonType,
|
||||
type,
|
||||
indexType,
|
||||
}) async {
|
||||
dynamic res = await Request().get(
|
||||
Api.pgcIndexResult,
|
||||
queryParameters: {
|
||||
...params,
|
||||
if (seasonType != null) 'season_type': seasonType,
|
||||
if (type != null) 'type': type,
|
||||
if (indexType != null) 'index_type': indexType,
|
||||
'page': page,
|
||||
'pagesize': 21,
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return LoadingState.success(res.data['data']);
|
||||
} else {
|
||||
return LoadingState.error(res.data['message']);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<LoadingState> pgcIndexCondition({
|
||||
seasonType,
|
||||
type,
|
||||
indexType,
|
||||
}) async {
|
||||
dynamic res = await Request().get(
|
||||
Api.pgcIndexCondition,
|
||||
queryParameters: {
|
||||
if (seasonType != null) 'season_type': seasonType,
|
||||
if (type != null) 'type': type,
|
||||
if (indexType != null) 'index_type': indexType,
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return LoadingState.success(Condition.fromJson(res.data['data']));
|
||||
} else {
|
||||
return LoadingState.error(res.data['message']);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<LoadingState> bangumiList({
|
||||
int? page,
|
||||
int? indexType,
|
||||
|
||||
Reference in New Issue
Block a user