为 audioplayers_android 模块单独设置 Java 1.8,其他模块保持 Java 17
This commit is contained in:
@@ -34,32 +34,19 @@ class VoteApi {
|
||||
static final Dio _dio = Dio(_options)
|
||||
..interceptors.add(CookieManager(_cookieJar));
|
||||
|
||||
static void _debugLog(String message) {
|
||||
if (kDebugMode) {
|
||||
print('VoteApi: $message');
|
||||
}
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>> _get(
|
||||
String path, {
|
||||
Map<String, dynamic>? queryParameters,
|
||||
}) async {
|
||||
try {
|
||||
final url = '$_baseUrl$path';
|
||||
_debugLog('GET $url');
|
||||
if (queryParameters != null) {
|
||||
_debugLog('查询参数: $queryParameters');
|
||||
}
|
||||
|
||||
final response = await _dio.get(url, queryParameters: queryParameters);
|
||||
|
||||
_debugLog('响应: ${response.data}');
|
||||
return response.data as Map<String, dynamic>;
|
||||
} on DioException catch (e) {
|
||||
_debugLog('Dio异常: ${e.type} - ${e.message}');
|
||||
throw Exception('请求失败: ${e.message}');
|
||||
} catch (e) {
|
||||
_debugLog('未知异常: $e');
|
||||
throw Exception('请求失败: $e');
|
||||
}
|
||||
}
|
||||
@@ -70,20 +57,13 @@ class VoteApi {
|
||||
}) async {
|
||||
try {
|
||||
final url = '$_baseUrl$path';
|
||||
_debugLog('POST $url');
|
||||
if (data != null) {
|
||||
_debugLog('请求数据: $data');
|
||||
}
|
||||
|
||||
final response = await _dio.post(url, data: data);
|
||||
|
||||
_debugLog('响应: ${response.data}');
|
||||
return response.data as Map<String, dynamic>;
|
||||
} on DioException catch (e) {
|
||||
_debugLog('Dio异常: ${e.type} - ${e.message}');
|
||||
throw Exception('请求失败: ${e.message}');
|
||||
} catch (e) {
|
||||
_debugLog('未知异常: $e');
|
||||
throw Exception('请求失败: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user