app-starlock/star_lock/lib/network/api_repository.dart
Daisy 819b04e697 1,新增电子钥匙重置接口
2,新增电子钥匙详情-操作记录接口
3,新增公用组件边线button
4,完善发送钥匙部分逻辑
2023-08-17 18:54:19 +08:00

172 lines
5.2 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
import '../login/login/entity/LoginEntity.dart';
import '../login/register/entity/SendValidationCodeEntity.dart';
import 'api_provider.dart';
class ApiRepository {
final ApiProvider apiProvider;
static ApiRepository get to => Get.find<ApiRepository>();
ApiRepository(this.apiProvider);
// 发送验证码 1注册2找回密码3绑定手机号4解绑换绑5删除账号
Future<SendValidationCodeEntity> sendValidationCode(
String countryCode,
String account,
String channel,
String codeType,
String uniqueid,
String xWidth) async {
final res = await apiProvider.getVerificationCode(
countryCode, account, channel, codeType, uniqueid, xWidth);
return SendValidationCodeEntity.fromJson(res.body);
}
// 注册
Future<LoginEntity> register(
String countryCode,
String countryId,
String mobile,
String password,
String uniqueid,
String verificationCode) async {
final res = await apiProvider.register(
countryCode, countryId, mobile, password, uniqueid, verificationCode);
return LoginEntity.fromJson(res.body);
}
// 获取图片验证码
Future<SafetyVerificationEntity> getSliderVerifyImg(
String countryCode, String account) async {
final res = await apiProvider.getSliderVerifyImg(countryCode, account);
return SafetyVerificationEntity.fromJson(res.body);
}
// 检验图片验证码
Future<CheckSafetyVerificationEntity> checkSliderVerifyImg(
String countryCode, String account, String xWidth) async {
final res =
await apiProvider.checkSliderVerifyImg(countryCode, account, xWidth);
return CheckSafetyVerificationEntity.fromJson(res.body);
}
//登录
Future<LoginEntity> login(String loginType, String password,
String countryCode, String username) async {
final res =
await apiProvider.login(loginType, password, countryCode, username);
return LoginEntity.fromJson(res.body);
}
//重置密码
Future<LoginEntity> resetPassword(
String countryCode,
String account,
String date,
String newPassword,
String uniqueid,
String verificationCode) async {
final res = await apiProvider.resetPassword(
countryCode, account, date, newPassword, uniqueid, verificationCode);
return LoginEntity.fromJson(res.body);
}
//获取国家或地区 json文件
Future<LoginEntity> getCountryRegion(String type) async {
final res = await apiProvider.getCountryRegion(type);
return LoginEntity.fromJson(res.body);
}
//电子钥匙列表
Future<ElectronicKeyListEntity> electronicKeyList(
String endDate,
String keyId,
String keyStatus,
String lockId,
String operatorUid,
String pageNo,
String pageSize,
String startDate) async {
final res = await apiProvider.electronicKeyList(endDate, keyId, keyStatus,
lockId, operatorUid, pageNo, pageSize, startDate);
return ElectronicKeyListEntity.fromJson(res.body);
}
//发送电子钥匙
Future<ElectronicKeyListEntity> sendElectronicKey(
String createUser,
String countryCode,
String usernameType,
String endDate,
String faceAuthentication,
String isCameraEnable,
String isRemoteUnlock,
String keyNameForAdmin,
String keyRight,
String keyType,
String lockId,
String operatorUid,
String receiverUsername,
String remarks,
String startDate,
List weekDays) async {
final res = await apiProvider.sendElectronicKey(
createUser,
countryCode,
usernameType,
endDate,
faceAuthentication,
isCameraEnable,
isRemoteUnlock,
keyNameForAdmin,
keyRight,
keyType,
lockId,
operatorUid,
receiverUsername,
remarks,
startDate,
weekDays);
return ElectronicKeyListEntity.fromJson(res.body);
}
//重置电子钥匙
Future<ElectronicKeyListEntity> resetElectronicKey(
String lockId, String operatorUid) async {
final res = await apiProvider.resetElectronicKey(lockId, operatorUid);
return ElectronicKeyListEntity.fromJson(res.body);
}
//钥匙详情-操作记录
Future<KeyOperationRecordEntity> lockRecordList(
String endDate,
String keyId,
String keyStatus,
String lockId,
String operatorUid,
String pageNo,
String pageSize,
String startDate,
String recordType,
String searchStr,
String timezoneRawOffSet) async {
final res = await apiProvider.lockRecordList(
endDate,
keyId,
keyStatus,
lockId,
operatorUid,
pageNo,
pageSize,
startDate,
recordType,
searchStr,
timezoneRawOffSet);
return KeyOperationRecordEntity.fromJson(res.body);
}
}