init
This commit is contained in:
commit
295b4058be
243 files changed
+19832
No files matched your search
@@ -0,0 +1,63 @@
|
||||
import 'package:dio/dio.dart' as dio;
|
||||
|
||||
import 'package:pj_supermarket_cloud/common/index.dart';
|
||||
|
||||
abstract class UserApi {
|
||||
/// 硬件管理登录
|
||||
static Future<dynamic> login(dynamic pa) async {
|
||||
final res = await HttpManage().dio.post(
|
||||
"/auth/oauth2/token",
|
||||
queryParameters: {
|
||||
"username": pa["username"],
|
||||
"randomStr": "",
|
||||
"code": "",
|
||||
"grant_type": pa["grant_type"],
|
||||
"scope": pa["scope"],
|
||||
},
|
||||
data: {
|
||||
"password": pa["password"],
|
||||
},
|
||||
options: dio.Options(
|
||||
headers: {
|
||||
"Authorization": EncryptionTool.getLoginAuthorization(),
|
||||
"skipToken": true,
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
),
|
||||
);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
/// 刷新token
|
||||
static Future<ServiceBase<ServiceAuth>> refreshToken(dynamic pa) async {
|
||||
final res = await HttpManage().dio.post(
|
||||
"/refresh-token",
|
||||
queryParameters: pa,
|
||||
);
|
||||
if (res.data?.data == null) {
|
||||
return res.data;
|
||||
}
|
||||
final map = res.data!.data as Map<String, dynamic>;
|
||||
final typeData = ServiceAuth.fromJson(map);
|
||||
res.data?.data = typeData;
|
||||
return res.data;
|
||||
}
|
||||
|
||||
/// 获取人脸
|
||||
static Future<ServiceListBase<ServiceAsyncFace>> getFaceList(
|
||||
dynamic formData,
|
||||
) async {
|
||||
final res = await HttpManage().dio.get(
|
||||
"/admin/user-face/ad/find-face",
|
||||
queryParameters: formData,
|
||||
);
|
||||
if (res.data?.data == null) {
|
||||
return res.data;
|
||||
}
|
||||
final typeData = res.data?.data
|
||||
?.map<ServiceAsyncFace>((e) => ServiceAsyncFace.fromJson(e))
|
||||
.toList();
|
||||
res.data?.data = typeData;
|
||||
return res.data;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user