app-starlock/star_lock/lib/network/api_repository.dart
Daisy cf5b7e6212 1,新增获取单把钥匙详情借口
2,锁设置-基本信息逻辑处理
2023-09-04 15:04:44 +08:00

373 lines
12 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/login/seletCountryRegion/common/countryRegionEntity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart';
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/LockGroupListEntity.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.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 '../main/lockMian/entity/lockInfoEntity.dart';
import '../mine/addLock/saveLock/entity/SaveLockEntity.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<CountryRegionEntity> getCountryRegion(String type) async {
final res = await apiProvider.getCountryRegion(type);
return CountryRegionEntity.fromJson(res.body);
}
//电子钥匙列表
Future<ElectronicKeyListEntity> electronicKeyList(
String endDate,
String keyId,
String keyStatus,
String lockId,
String operatorUid,
String pageNo,
String pageSize,
String startDate,
String keyRight) async {
final res = await apiProvider.electronicKeyList(endDate, keyId, keyStatus,
lockId, operatorUid, pageNo, pageSize, startDate, keyRight);
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,
String keyboardPwdId,
String cardId,
String fingerprintId) async {
final res = await apiProvider.lockRecordList(
endDate,
keyId,
keyStatus,
lockId,
operatorUid,
pageNo,
pageSize,
startDate,
recordType,
searchStr,
timezoneRawOffSet,
keyboardPwdId,
cardId,
fingerprintId);
return KeyOperationRecordEntity.fromJson(res.body);
}
// 绑定蓝牙管理员
Future<SaveLockEntity> bindingBlueAdmin(
{required String bindingDate,
required String hotelMode,
required String lockAlias,
required Map lockData,
required String nbInitSuccess,
required Map position,
required Map bluetooth,
required String deviceNo,
required String lockUserNo}) async {
final res = await apiProvider.bindingBlueAdmin(
bindingDate,
hotelMode,
lockAlias,
lockData,
nbInitSuccess,
position,
bluetooth,
deviceNo,
lockUserNo);
return SaveLockEntity.fromJson(res.body);
}
//锁电量更新
Future<KeyOperationRecordEntity> uploadElectricQuantity(
String electricQuantity, String lockId) async {
final res =
await apiProvider.uploadElectricQuantity(electricQuantity, lockId);
return KeyOperationRecordEntity.fromJson(res.body);
}
//锁名称修改
Future<KeyOperationRecordEntity> modifyKeyName(
String keyId,
String lockId,
String keyName,
String operatorUid,
) async {
final res =
await apiProvider.modifyKeyName(keyId, lockId, keyName, operatorUid);
return KeyOperationRecordEntity.fromJson(res.body);
}
//编辑电子钥匙名字
Future<KeyOperationRecordEntity> modifyKeyNameForAdmin(
String keyId,
String keyNameForAdmin,
String operatorUid,
) async {
final res = await apiProvider.modifyKeyNameForAdmin(
keyId, keyNameForAdmin, operatorUid);
return KeyOperationRecordEntity.fromJson(res.body);
}
//编辑电子钥匙有效期
Future<KeyOperationRecordEntity> updateKeyDate(
String keyId,
String lockId,
String endDate,
String endDay,
String operatorUid,
String startDate,
String startDay,
List weekDays) async {
final res = await apiProvider.updateKeyDate(keyId, lockId, endDate, endDay,
operatorUid, startDate, startDay, weekDays);
return KeyOperationRecordEntity.fromJson(res.body);
}
//密码列表
Future<PasswordKeyListEntity> passwordKeyList(
String keyStatus,
String lockId,
String operatorUid,
String pageNo,
String pageSize,
) async {
final res = await apiProvider.passwordKeyList(
keyStatus, lockId, operatorUid, pageNo, pageSize);
return PasswordKeyListEntity.fromJson(res.body);
}
//重置密码钥匙
Future<PasswordKeyListEntity> resetPasswordKey(
String lockId, String operatorUid) async {
final res = await apiProvider.resetPasswordKey(lockId, operatorUid);
return PasswordKeyListEntity.fromJson(res.body);
}
// 获取锁信息
Future<LockMainEntity> getLockInfo(
{required String lastUpdateDate, required String pageNo}) async {
final res = await apiProvider.getLockInfo(lastUpdateDate, pageNo);
return LockMainEntity.fromJson(res.body);
}
// 删除锁
Future<LockMainEntity> deletLockData({required String lockId}) async {
final res = await apiProvider.deletLockInfo(lockId);
return LockMainEntity.fromJson(res.body);
}
//获取密码
Future<PasswordKeyEntity> getPasswordKey(
String endDate,
String isExclusive,
String keyboardPwdName,
String keyboardPwdType,
String keyboardPwdVersion,
String lockId,
String operatorUid,
String startDate,
String timezoneRawOffSet,
) async {
final res = await apiProvider.getKeyboardPwd(
endDate,
isExclusive,
keyboardPwdName,
keyboardPwdType,
keyboardPwdVersion,
lockId,
operatorUid,
startDate,
timezoneRawOffSet);
return PasswordKeyEntity.fromJson(res.body);
}
//清空操作记录
Future<KeyOperationRecordEntity> clearOperationRecord(String lockId) async {
final res = await apiProvider.clearOperationRecord(lockId);
return KeyOperationRecordEntity.fromJson(res.body);
}
//创建锁分组
Future<LockGroupListEntity> addLockGroup(
String groupName, String operatorUid) async {
final res = await apiProvider.addLockGroup(groupName, operatorUid);
return LockGroupListEntity.fromJson(res.body);
}
//锁分组列表
Future<LockGroupListEntity> lockGroupList(String type) async {
final res = await apiProvider.lockGroupList(type);
return LockGroupListEntity.fromJson(res.body);
}
//删除电子钥匙
Future<ElectronicKeyListEntity> deleteElectronicKey(String keyId) async {
final res = await apiProvider.deleteElectronicKey(keyId);
return ElectronicKeyListEntity.fromJson(res.body);
}
//删除密码
Future<PasswordKeyEntity> deleteKeyboardPwd(
String lockId, String keyboardPwdId, String deleteType) async {
final res =
await apiProvider.deleteKeyboardPwd(lockId, keyboardPwdId, deleteType);
return PasswordKeyEntity.fromJson(res.body);
}
//标记房态
Future<PasswordKeyEntity> updateSetting(
String lockId, String isOn, String type) async {
final res = await apiProvider.deleteKeyboardPwd(lockId, isOn, type);
return PasswordKeyEntity.fromJson(res.body);
}
//分组列表
Future<PasswordKeyEntity> keyGroupList(String type) async {
final res = await apiProvider.keyGroupList(type);
return PasswordKeyEntity.fromJson(res.body);
}
//分组下的锁
Future<PasswordKeyEntity> lockListByGroup(
String type, String keyGroupId) async {
final res = await apiProvider.lockListByGroup(type, keyGroupId);
return PasswordKeyEntity.fromJson(res.body);
}
//获取单把钥匙详情信息
Future<KeyDetailEntity> getKeyDetail(String lockId) async {
final res = await apiProvider.getKeyDetail(lockId);
return KeyDetailEntity.fromJson(res.body);
}
}