feat: 接入起卦后端流程并完善积分扣减链路

This commit is contained in:
qzl
2026-04-03 19:04:46 +08:00
parent a136e42290
commit d87b2e1e3a
56 changed files with 3310 additions and 809 deletions
+16
View File
@@ -44,6 +44,8 @@ class ApiClient {
final Dio _dio;
final Logger _logger = getLogger('data.network.api_client');
Dio get rawDio => _dio;
Future<void> postNoContent(String path, {Map<String, dynamic>? data}) async {
try {
await _dio.post<void>(path, data: data);
@@ -90,6 +92,20 @@ class ApiClient {
}
}
Future<Map<String, dynamic>> getJson(String path) async {
try {
final response = await _dio.get<Map<String, dynamic>>(path);
return response.data ?? <String, dynamic>{};
} on DioException catch (error, stackTrace) {
_logger.error(
message: 'GET json failed',
error: error,
stackTrace: stackTrace,
);
throw _mapProblem(error);
}
}
ApiProblem _mapProblem(DioException error) {
final status = error.response?.statusCode ?? 500;
final data = error.response?.data;