940c67e642
- 后端新增 GET /api/v1/points/ledger 接口 - 前端新增积分流水列表页面 - 积分中心添加「查看流水」入口 - 重命名 AccountDeleteScreen 为 AccountDataScreen - 流水列表支持分页加载和空状态展示
31 lines
764 B
Dart
31 lines
764 B
Dart
import 'package:dio/dio.dart';
|
|
|
|
import '../models/ledger_item.dart';
|
|
import '../models/package_info.dart';
|
|
|
|
class PointsApi {
|
|
const PointsApi(this._dio);
|
|
|
|
final Dio _dio;
|
|
|
|
Future<PackagesResult> getPackages() async {
|
|
final response = await _dio.get('/api/v1/points/packages');
|
|
return PackagesResult.fromJson(response.data as Map<String, dynamic>);
|
|
}
|
|
|
|
Future<LedgerListResult> getLedger({
|
|
int limit = 20,
|
|
String? cursor,
|
|
}) async {
|
|
final query = <String, dynamic>{'limit': limit};
|
|
if (cursor != null) {
|
|
query['cursor'] = cursor;
|
|
}
|
|
final response = await _dio.get(
|
|
'/api/v1/points/ledger',
|
|
queryParameters: query,
|
|
);
|
|
return LedgerListResult.fromJson(response.data as Map<String, dynamic>);
|
|
}
|
|
}
|