refa: follow page

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-21 20:17:45 +08:00
parent e6e9ce7d57
commit 8b28a31d09
9 changed files with 271 additions and 424 deletions

View File

@@ -1,3 +1,5 @@
import 'package:PiliPlus/http/loading_state.dart';
import '../models/follow/result.dart';
import 'index.dart';
@@ -20,4 +22,22 @@ class FollowHttp {
return {'status': false, 'msg': res.data['message']};
}
}
static Future<LoadingState<List<FollowItemModel>?>> followingsNew(
{int? vmid, int? pn, int? ps, String? orderType}) async {
var res = await Request().get(Api.followings, queryParameters: {
'vmid': vmid,
'pn': pn,
'ps': ps,
'order': 'desc',
'order_type': orderType,
});
if (res.data['code'] == 0) {
return LoadingState.success(
FollowDataModel.fromJson(res.data['data']).list);
} else {
return LoadingState.error(res.data['message']);
}
}
}

View File

@@ -470,8 +470,8 @@ class MemberHttp {
if (res.data['code'] == 0) {
return {
'status': true,
'data': res.data['data']
.map<MemberTagItemModel>((e) => MemberTagItemModel.fromJson(e))
'data': (res.data['data'] as List?)
?.map<MemberTagItemModel>((e) => MemberTagItemModel.fromJson(e))
.toList()
};
} else {
@@ -525,28 +525,27 @@ class MemberHttp {
}
// 获取某分组下的up
static Future followUpGroup(
static Future<LoadingState<List<FollowItemModel>?>> followUpGroup(
int? mid,
int? tagid,
int? pn,
int? ps,
) async {
var res = await Request().get(Api.followUpGroup, queryParameters: {
'mid': mid,
'tagid': tagid,
'pn': pn,
'ps': ps,
});
var res = await Request().get(
Api.followUpGroup,
queryParameters: {
'mid': mid,
'tagid': tagid,
'pn': pn,
'ps': ps,
},
);
if (res.data['code'] == 0) {
// FollowItemModel
return {
'status': true,
'data': res.data['data']
.map<FollowItemModel>((e) => FollowItemModel.fromJson(e))
.toList()
};
return LoadingState.success((res.data['data'] as List?)
?.map<FollowItemModel>((e) => FollowItemModel.fromJson(e))
.toList());
} else {
return {'status': false, 'msg': res.data['message']};
return LoadingState.error(res.data['message']);
}
}