|
|
|
@ -119,38 +119,34 @@ abstract class ApiService {
|
|
|
|
|
} catch (e1) {} |
|
|
|
|
handler.next(options); |
|
|
|
|
}, onResponse: (Response response, ResponseInterceptorHandler handler) { |
|
|
|
|
try { |
|
|
|
|
debugPrint("\n======================= 响应数据开始 ======================="); |
|
|
|
|
if (SmartDialog.checkExist(dialogTypes: {SmartAllDialogType.loading})) { |
|
|
|
|
AppUtils.removeLoadingPath(response.requestOptions.path); |
|
|
|
|
} else { |
|
|
|
|
AppUtils.cleanLoadingPath(); |
|
|
|
|
} |
|
|
|
|
debugPrint("code = ${response.statusCode}"); |
|
|
|
|
p(jsonEncode(response.data)); |
|
|
|
|
if (response.data is Map) { |
|
|
|
|
Map map = response.data; |
|
|
|
|
if (map["code"] == 40005 || map["code"] == 40001) { |
|
|
|
|
if (context != null) { |
|
|
|
|
LoginTipsDialog.instance.show(context); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
debugPrint("======================= 响应数据结束 =======================\n"); |
|
|
|
|
if (map["code"] == 0 || map["code"] == 200 || map["infocode"] == "10000") { |
|
|
|
|
handler.next(response); |
|
|
|
|
} else { |
|
|
|
|
throw DioException( |
|
|
|
|
requestOptions: response.requestOptions, |
|
|
|
|
type: DioExceptionType.unknown, |
|
|
|
|
response: response, |
|
|
|
|
message: "${map["msg"] ?? map["message"] ?? map["repMsg"]}", |
|
|
|
|
); |
|
|
|
|
debugPrint("\n======================= 响应数据开始 ======================="); |
|
|
|
|
if (SmartDialog.checkExist(dialogTypes: {SmartAllDialogType.loading})) { |
|
|
|
|
AppUtils.removeLoadingPath(response.requestOptions.path); |
|
|
|
|
} else { |
|
|
|
|
AppUtils.cleanLoadingPath(); |
|
|
|
|
} |
|
|
|
|
debugPrint("code = ${response.statusCode}"); |
|
|
|
|
p(jsonEncode(response.data)); |
|
|
|
|
if (response.data is Map) { |
|
|
|
|
Map map = response.data; |
|
|
|
|
if (map["code"] == 40005 || map["code"] == 40001) { |
|
|
|
|
if (context != null) { |
|
|
|
|
LoginTipsDialog.instance.show(context); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
} |
|
|
|
|
debugPrint("======================= 响应数据结束 =======================\n"); |
|
|
|
|
if (map["code"] == 0 || map["code"] == 200 || map["repCode"] == "0000" || map["infocode"] == "10000") { |
|
|
|
|
handler.next(response); |
|
|
|
|
} else { |
|
|
|
|
throw DioException( |
|
|
|
|
requestOptions: response.requestOptions, |
|
|
|
|
type: DioExceptionType.unknown, |
|
|
|
|
response: response, |
|
|
|
|
message: "${map["msg"] ?? map["message"] ?? map["repMsg"]}", |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} catch (e2) { |
|
|
|
|
print("respon: ${e2}"); |
|
|
|
|
} else { |
|
|
|
|
handler.next(response); |
|
|
|
|
} |
|
|
|
|
}, onError: (DioException e, ErrorInterceptorHandler handler) { |
|
|
|
|
if (SmartDialog.checkExist(dialogTypes: {SmartAllDialogType.loading})) { |
|
|
|
|