107 lines
2.8 KiB
Dart
107 lines
2.8 KiB
Dart
import 'package:dio/dio.dart';
|
|
import 'package:qhd_prevention/http/ApiService.dart';
|
|
import 'package:qhd_prevention/http/HttpManager.dart';
|
|
import 'package:qhd_prevention/services/SessionService.dart';
|
|
|
|
class AuthApi {
|
|
/// 本地登录
|
|
static Future<Map<String, dynamic>> userlogin(Map data) {
|
|
return HttpManager().request(
|
|
ApiService.basePath + (ApiService.isProduct ? '/basicInfo' : '/basicInfo') ,
|
|
'/appuser/login',
|
|
method: Method.post,
|
|
data: {...data},
|
|
);
|
|
}
|
|
/// 本地获取验证码
|
|
static Future<Map<String, dynamic>> getUserCaptcha() {
|
|
return HttpManager().request(
|
|
ApiService.basePath + (ApiService.isProduct ? '/basicInfo' : '/basicInfo') ,
|
|
'/appuser/generateCaptcha',
|
|
method: Method.post,
|
|
data: {},
|
|
);
|
|
}
|
|
/// 底座登录验证接口
|
|
static Future<Map<String, dynamic>> loginCheck(Map data) {
|
|
return HttpManager().request(
|
|
ApiService.basePath,
|
|
'/login/login',
|
|
method: Method.post,
|
|
data: {...data},
|
|
);
|
|
}
|
|
|
|
/// 获取验证码
|
|
static Future<Map<String, dynamic>> getCaptcha() {
|
|
return HttpManager().request(
|
|
ApiService.basePath,
|
|
'/login/captcha',
|
|
method: Method.get,
|
|
data: {},
|
|
);
|
|
}
|
|
|
|
/// 心跳
|
|
static Future<Map<String, dynamic>> heartbeat() {
|
|
return HttpManager().request(
|
|
ApiService.basePath,
|
|
'/base/accounts/token/heartbeat',
|
|
method: Method.post,
|
|
contentType: Headers.multipartFormDataContentType,
|
|
isHeartbeat: true,
|
|
data: {
|
|
"token": SessionService.instance.token,
|
|
},
|
|
);
|
|
}
|
|
|
|
/// 获取当前人信息
|
|
static Future<Map<String, dynamic>> getUserData() {
|
|
return HttpManager().request(
|
|
ApiService.basePath,
|
|
'/basicInfo/user/getInfo',
|
|
method: Method.get,
|
|
data: {},
|
|
);
|
|
}
|
|
|
|
/// 修改密码
|
|
static Future<Map<String, dynamic>> changePassWord(data) {
|
|
return HttpManager().request(
|
|
ApiService.basePath + (ApiService.isProduct ? '/basicInfo' : '/basicInfo') ,
|
|
'/appuser/updatePassword',
|
|
method: Method.post,
|
|
data: {
|
|
...data,
|
|
},
|
|
);
|
|
}
|
|
/// 找回密码
|
|
static Future<Map<String, dynamic>> passwordRecover(data) {
|
|
return HttpManager().request(
|
|
ApiService.basePath + (ApiService.isProduct ? '/basicInfo' : '/basicInfo') ,
|
|
'/appuser/passwordRecover',
|
|
method: Method.post,
|
|
data: {
|
|
...data,
|
|
},
|
|
);
|
|
}
|
|
/// 上传人脸认证图片
|
|
static Future<Map<String, dynamic>> reloadMyFace(String imagePath) {
|
|
return HttpManager().request(
|
|
ApiService.basePath + (ApiService.isProduct ? '/basicInfo' : '/basicInfo') ,
|
|
'/appuser/updateUserFaceUrl',
|
|
method: Method.post,
|
|
data: {
|
|
// ...data,
|
|
"id": SessionService.instance.accountId ?? "",
|
|
"userAvatarUrl": imagePath,
|
|
},
|
|
);
|
|
}
|
|
|
|
|
|
|
|
} |