1.更新消息阅读时间
2.修复配置wifi时wifi名称存在空格时配置失败 3.修复门店体验列表刷新失败
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/controller/login/login_controller.dart';
|
||||
import 'package:vbvs_app/pages/common/selectDialog.dart';
|
||||
|
||||
class ApiService {
|
||||
static Dio dio = Dio();
|
||||
@@ -15,32 +12,35 @@ class ApiService {
|
||||
static Dio reservation = Dio();
|
||||
|
||||
static void init() {
|
||||
|
||||
reservationInit();
|
||||
}
|
||||
|
||||
static void reservationInit() {
|
||||
reservation.options.baseUrl = "https://crm-api.swes.com.cn";
|
||||
reservation.options.connectTimeout = const Duration(seconds: 15);
|
||||
reservation.options.receiveTimeout = const Duration(seconds: 10);
|
||||
reservation.options.sendTimeout = const Duration(seconds: 10);
|
||||
reservation.interceptors.add(InterceptorsWrapper(
|
||||
onRequest: (options, handler) {
|
||||
print("---> ${options.method}, ${options.path}, ${options.data}");
|
||||
options.headers['token'] =
|
||||
"bMAQVR1x48t66u8EDYSftAJGo17r0rIB3z15JgyyoGz1rAEZHs1htHOCorYFJ2RT";
|
||||
return handler.next(options);
|
||||
},
|
||||
onResponse: (response, ResponseInterceptorHandler handler) {
|
||||
print("<--- ${response.statusCode} ${response.data}");
|
||||
return handler.next(response);
|
||||
},
|
||||
onError: (e, handler) {
|
||||
// 错误处理,例如打印错误信息
|
||||
showToast("网络异常或服务连接异常,请稍候再试", color: color_error);
|
||||
print("DioError: $e");
|
||||
return handler.reject(e);
|
||||
},
|
||||
));
|
||||
try {
|
||||
reservation.options.baseUrl = "https://crm-api.swes.com.cn";
|
||||
reservation.options.connectTimeout = const Duration(seconds: 15);
|
||||
reservation.options.receiveTimeout = const Duration(seconds: 10);
|
||||
reservation.options.sendTimeout = const Duration(seconds: 10);
|
||||
reservation.interceptors.add(InterceptorsWrapper(
|
||||
onRequest: (options, handler) {
|
||||
print("---> ${options.method}, ${options.path}, ${options.data}");
|
||||
options.headers['token'] =
|
||||
"bMAQVR1x48t66u8EDYSftAJGo17r0rIB3z15JgyyoGz1rAEZHs1htHOCorYFJ2RT";
|
||||
return handler.next(options);
|
||||
},
|
||||
onResponse: (response, ResponseInterceptorHandler handler) {
|
||||
print("<--- ${response.statusCode} ${response.data}");
|
||||
return handler.next(response);
|
||||
},
|
||||
onError: (e, handler) {
|
||||
// 错误处理,例如打印错误信息
|
||||
showToast("网络异常或服务连接异常,请稍候再试", color: color_error);
|
||||
print("DioError: $e");
|
||||
return handler.reject(e);
|
||||
},
|
||||
));
|
||||
} catch (e) {
|
||||
ef.log("$e");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,8 +92,8 @@ Future<ApiResponse> requestWithLog({
|
||||
} catch (e) {
|
||||
EasyDartModule.logger.error("$logTitle 失败->$e");
|
||||
DailyLogUtils.writeError("$logTitle 失败->$e");
|
||||
onFailure?.call(apiResponse);
|
||||
apiResponse.msg = e.toString();
|
||||
onFailure?.call(apiResponse);
|
||||
return apiResponse;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user