2023-08-07 10:32:24 +08:00
|
|
|
import 'dart:convert';
|
2023-07-27 15:29:37 +08:00
|
|
|
|
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
import 'api_provider_base.dart';
|
|
|
|
|
|
|
|
|
|
class ApiProvider extends BaseProvider {
|
2023-08-07 10:32:24 +08:00
|
|
|
Future<Response> getVerificationCode(String countryCode, String account,
|
|
|
|
|
String channel, String codeType, String uniqueid, String xWidth) =>
|
|
|
|
|
post(
|
|
|
|
|
getVerificationCodeUrl.toUrl,
|
|
|
|
|
jsonEncode({
|
|
|
|
|
'countryCode': countryCode,
|
|
|
|
|
'account': account,
|
|
|
|
|
"channel": channel,
|
|
|
|
|
'codeType': codeType,
|
|
|
|
|
"uniqueid": uniqueid,
|
|
|
|
|
'xWidth': xWidth,
|
|
|
|
|
}));
|
2023-07-27 15:29:37 +08:00
|
|
|
|
2023-08-07 10:32:24 +08:00
|
|
|
Future<Response> register(String countryCode, String countryId, String mobile,
|
|
|
|
|
String password, String uniqueid, String verificationCode) =>
|
|
|
|
|
post(registerUrl.toUrl, null, query: {
|
|
|
|
|
'countryCode': countryCode,
|
|
|
|
|
'countryId': countryId,
|
|
|
|
|
"mobile": mobile,
|
|
|
|
|
'password': password,
|
|
|
|
|
'platId': "2",
|
|
|
|
|
"uniqueid": uniqueid,
|
|
|
|
|
'verificationCode': verificationCode,
|
|
|
|
|
});
|
2023-07-27 15:29:37 +08:00
|
|
|
|
2023-08-07 10:32:24 +08:00
|
|
|
// post(
|
|
|
|
|
// registerUrl.toUrl,
|
|
|
|
|
// jsonEncode({
|
|
|
|
|
// 'countryCode': countryCode,
|
|
|
|
|
// 'countryId': countryId,
|
|
|
|
|
// "mobile": mobile,
|
|
|
|
|
// 'password': password,
|
|
|
|
|
// 'platId': "2",
|
|
|
|
|
// "uniqueid": uniqueid,
|
|
|
|
|
// 'verificationCode': verificationCode,
|
|
|
|
|
// }));
|
2023-07-27 15:29:37 +08:00
|
|
|
|
2023-08-07 10:32:24 +08:00
|
|
|
Future<Response> getSliderVerifyImg(String countryCode, String account) =>
|
|
|
|
|
post(
|
|
|
|
|
getSliderVerifyImgUrl.toUrl,
|
|
|
|
|
jsonEncode({
|
|
|
|
|
'countryCode': countryCode,
|
|
|
|
|
'account': account,
|
|
|
|
|
}));
|
2023-07-29 18:33:48 +08:00
|
|
|
|
2023-08-02 09:22:39 +08:00
|
|
|
Future<Response> checkSliderVerifyImg(
|
2023-08-07 10:32:24 +08:00
|
|
|
String countryCode, String account, String xWidth) =>
|
|
|
|
|
post(
|
|
|
|
|
checkImgUrl.toUrl,
|
|
|
|
|
jsonEncode({
|
|
|
|
|
'countryCode': countryCode,
|
|
|
|
|
'account': account,
|
|
|
|
|
'xWidth': xWidth,
|
|
|
|
|
}));
|
2023-07-29 18:33:48 +08:00
|
|
|
|
2023-08-07 10:32:24 +08:00
|
|
|
Future<Response> login(String loginType, String password, String countryCode,
|
|
|
|
|
String username) =>
|
|
|
|
|
post(
|
|
|
|
|
loginUrl.toUrl,
|
|
|
|
|
jsonEncode({
|
|
|
|
|
'loginType': loginType,
|
|
|
|
|
'password': password,
|
|
|
|
|
"platId": "2",
|
|
|
|
|
'uniqueid': "477E6814-289D-402A-9F49-F89A8BD05D63",
|
|
|
|
|
'countryCode': countryCode,
|
|
|
|
|
"username": username
|
|
|
|
|
}));
|
2023-07-27 15:29:37 +08:00
|
|
|
|
2023-08-07 10:32:24 +08:00
|
|
|
Future<Response> resetPassword(
|
|
|
|
|
String countryCode,
|
|
|
|
|
String account,
|
|
|
|
|
String date,
|
|
|
|
|
String newPassword,
|
|
|
|
|
String uniqueid,
|
|
|
|
|
String verificationCode) =>
|
|
|
|
|
post(
|
|
|
|
|
resetPasswordURL.toUrl,
|
|
|
|
|
jsonEncode({
|
|
|
|
|
'countryCode': countryCode,
|
|
|
|
|
'account': account,
|
|
|
|
|
"date": date,
|
|
|
|
|
'newPassword': newPassword,
|
|
|
|
|
"uniqueid": uniqueid,
|
|
|
|
|
'verificationCode': verificationCode,
|
|
|
|
|
}));
|
2023-08-16 17:35:43 +08:00
|
|
|
|
|
|
|
|
Future<Response> getCountryRegion(String type) =>
|
|
|
|
|
post(getCountryRegionURL.toUrl, jsonEncode({'type': type}));
|
|
|
|
|
|
|
|
|
|
Future<Response> electronicKeyList(
|
|
|
|
|
String endDate,
|
|
|
|
|
String keyId,
|
|
|
|
|
String keyStatus,
|
|
|
|
|
String lockId,
|
|
|
|
|
String operatorUid,
|
|
|
|
|
String pageNo,
|
|
|
|
|
String pageSize,
|
2023-08-23 14:27:50 +08:00
|
|
|
String startDate,
|
|
|
|
|
String keyRight) =>
|
2023-08-16 17:35:43 +08:00
|
|
|
post(
|
|
|
|
|
electronicKeyListURL.toUrl,
|
|
|
|
|
jsonEncode({
|
|
|
|
|
'endDate': endDate,
|
|
|
|
|
'keyId': keyId,
|
|
|
|
|
"keyStatus": keyStatus,
|
|
|
|
|
'lockId': lockId,
|
|
|
|
|
"operatorUid": operatorUid,
|
|
|
|
|
'pageNo': pageNo,
|
|
|
|
|
'pageSize': pageSize,
|
|
|
|
|
'startDate': startDate,
|
2023-08-23 14:27:50 +08:00
|
|
|
'keyRight': keyRight
|
2023-08-16 17:35:43 +08:00
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
Future<Response> 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,
|
2023-08-17 18:54:19 +08:00
|
|
|
List weekDays) =>
|
2023-08-16 17:35:43 +08:00
|
|
|
post(
|
|
|
|
|
sendElectronicKeyURL.toUrl,
|
|
|
|
|
jsonEncode({
|
|
|
|
|
'createUser': createUser,
|
|
|
|
|
'countryCode': countryCode,
|
|
|
|
|
'usernameType': usernameType,
|
|
|
|
|
'endDate': endDate,
|
|
|
|
|
'faceAuthentication': faceAuthentication,
|
|
|
|
|
'isCameraEnable': isCameraEnable,
|
|
|
|
|
'isRemoteUnlock': isRemoteUnlock,
|
|
|
|
|
'keyNameForAdmin': keyNameForAdmin,
|
|
|
|
|
'keyRight': keyRight,
|
|
|
|
|
'keyType': keyType,
|
|
|
|
|
'lockId': lockId,
|
|
|
|
|
'operatorUid': operatorUid,
|
|
|
|
|
'receiverUsername': receiverUsername,
|
|
|
|
|
'remarks': remarks,
|
|
|
|
|
'startDate': startDate,
|
|
|
|
|
'weekDays': weekDays
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
Future<Response> uploadElectricQuantity(
|
|
|
|
|
String electricQuantity,
|
|
|
|
|
String lockId,
|
|
|
|
|
) =>
|
|
|
|
|
post(
|
|
|
|
|
uploadElectricQuantityURL.toUrl,
|
|
|
|
|
jsonEncode({
|
|
|
|
|
'electricQuantity': electricQuantity,
|
|
|
|
|
'lockId': lockId,
|
|
|
|
|
}));
|
2023-08-17 18:54:19 +08:00
|
|
|
|
2023-08-18 18:25:58 +08:00
|
|
|
Future<Response> modifyKeyName(
|
|
|
|
|
String keyId,
|
|
|
|
|
String lockId,
|
|
|
|
|
String keyName,
|
|
|
|
|
String operatorUid,
|
|
|
|
|
) =>
|
|
|
|
|
post(
|
|
|
|
|
modifyKeyNameURL.toUrl,
|
|
|
|
|
jsonEncode({
|
|
|
|
|
'keyId': keyId,
|
|
|
|
|
'lockId': lockId,
|
|
|
|
|
'keyName': keyName,
|
|
|
|
|
'operatorUid': operatorUid,
|
|
|
|
|
}));
|
|
|
|
|
|
2023-08-23 14:27:50 +08:00
|
|
|
Future<Response> modifyKeyNameForAdmin(
|
|
|
|
|
String keyId,
|
|
|
|
|
String keyNameForAdmin,
|
|
|
|
|
String operatorUid,
|
|
|
|
|
) =>
|
|
|
|
|
post(
|
|
|
|
|
modifyKeyNameForAdminURL.toUrl,
|
|
|
|
|
jsonEncode({
|
|
|
|
|
'keyId': keyId,
|
|
|
|
|
'keyNameForAdmin': keyNameForAdmin,
|
|
|
|
|
'operatorUid': operatorUid,
|
|
|
|
|
}));
|
|
|
|
|
|
2023-09-04 11:11:14 +08:00
|
|
|
Future<Response> updateKeyDate(
|
|
|
|
|
String keyId,
|
|
|
|
|
String lockId,
|
|
|
|
|
String endDate,
|
|
|
|
|
String endDay,
|
|
|
|
|
String operatorUid,
|
|
|
|
|
String startDate,
|
|
|
|
|
String startDay,
|
|
|
|
|
List weekDays) =>
|
|
|
|
|
post(
|
|
|
|
|
updateKeyDateURL.toUrl,
|
|
|
|
|
jsonEncode({
|
|
|
|
|
'keyId': keyId,
|
|
|
|
|
'lockId': lockId,
|
|
|
|
|
'endDate': endDate,
|
|
|
|
|
'endDay': endDay,
|
|
|
|
|
'operatorUid': operatorUid,
|
|
|
|
|
'startDate': startDate,
|
|
|
|
|
'startDay': startDay,
|
|
|
|
|
'weekDays': weekDays,
|
|
|
|
|
}));
|
|
|
|
|
|
2023-08-17 18:54:19 +08:00
|
|
|
Future<Response> resetElectronicKey(String lockId, String operatorUid) =>
|
|
|
|
|
post(resetElectronicKeyURL.toUrl,
|
|
|
|
|
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
|
|
|
|
|
|
|
|
|
|
Future<Response> lockRecordList(
|
|
|
|
|
String endDate,
|
|
|
|
|
String keyId,
|
|
|
|
|
String keyStatus,
|
|
|
|
|
String lockId,
|
|
|
|
|
String operatorUid,
|
|
|
|
|
String pageNo,
|
|
|
|
|
String pageSize,
|
|
|
|
|
String startDate,
|
|
|
|
|
String recordType,
|
|
|
|
|
String searchStr,
|
2023-08-31 14:40:50 +08:00
|
|
|
String timezoneRawOffSet,
|
|
|
|
|
String keyboardPwdId,
|
|
|
|
|
String cardId,
|
|
|
|
|
String fingerprintId) =>
|
2023-08-17 18:54:19 +08:00
|
|
|
post(
|
|
|
|
|
keyOperationRecordURL.toUrl,
|
|
|
|
|
jsonEncode({
|
|
|
|
|
'endDate': endDate,
|
|
|
|
|
'keyId': keyId,
|
|
|
|
|
"keyStatus": keyStatus,
|
|
|
|
|
'lockId': lockId,
|
|
|
|
|
"operatorUid": operatorUid,
|
|
|
|
|
'pageNo': pageNo,
|
|
|
|
|
'pageSize': pageSize,
|
|
|
|
|
'startDate': startDate,
|
|
|
|
|
'recordType': recordType,
|
|
|
|
|
'searchStr': searchStr,
|
2023-08-31 14:40:50 +08:00
|
|
|
'timezoneRawOffSet': timezoneRawOffSet,
|
|
|
|
|
'keyboardPwdId': keyboardPwdId,
|
|
|
|
|
'cardId': cardId,
|
|
|
|
|
'fingerprintId': fingerprintId
|
2023-08-17 18:54:19 +08:00
|
|
|
}));
|
2023-08-24 14:25:55 +08:00
|
|
|
|
|
|
|
|
// 绑定蓝牙管理员
|
|
|
|
|
Future<Response> bindingBlueAdmin(
|
2023-08-24 14:29:31 +08:00
|
|
|
String bindingDate,
|
|
|
|
|
String hotelMode,
|
|
|
|
|
String lockAlias,
|
2023-08-26 11:40:40 +08:00
|
|
|
Map lockData,
|
2023-08-24 14:29:31 +08:00
|
|
|
String nbInitSuccess,
|
2023-08-29 11:02:52 +08:00
|
|
|
Map position,
|
|
|
|
|
Map bluetooth,
|
2023-08-31 15:56:01 +08:00
|
|
|
String deviceNo,
|
|
|
|
|
String lockUserNo) =>
|
2023-08-24 14:25:55 +08:00
|
|
|
post(
|
|
|
|
|
bindingBlueAdminURL.toUrl,
|
|
|
|
|
jsonEncode({
|
|
|
|
|
'bindingDate': bindingDate,
|
|
|
|
|
'hotelMode': hotelMode,
|
|
|
|
|
"lockAlias": lockAlias,
|
|
|
|
|
'lockData': lockData,
|
|
|
|
|
"nbInitSuccess": nbInitSuccess,
|
|
|
|
|
'position': position,
|
2023-08-29 11:02:52 +08:00
|
|
|
'bluetooth': bluetooth,
|
2023-08-31 15:56:01 +08:00
|
|
|
'deviceNo': deviceNo,
|
|
|
|
|
'lockUserNo': lockUserNo,
|
2023-08-24 14:25:55 +08:00
|
|
|
}));
|
2023-08-26 11:40:40 +08:00
|
|
|
|
|
|
|
|
// 获取锁信息
|
2023-08-30 10:58:00 +08:00
|
|
|
Future<Response> getLockInfo(String lastUpdateDate, String pageNo) => post(
|
|
|
|
|
getLockInfoURL.toUrl,
|
|
|
|
|
jsonEncode({
|
|
|
|
|
'lastUpdateDate': lastUpdateDate,
|
|
|
|
|
"pageNo": pageNo,
|
|
|
|
|
}));
|
2023-08-26 11:40:40 +08:00
|
|
|
|
2023-08-29 17:39:35 +08:00
|
|
|
// 删除锁
|
2023-08-30 10:58:00 +08:00
|
|
|
Future<Response> deletLockInfo(String lockId) => post(
|
|
|
|
|
deletLockURL.toUrl,
|
|
|
|
|
jsonEncode({
|
|
|
|
|
'lockId': lockId,
|
|
|
|
|
}));
|
2023-08-29 17:39:35 +08:00
|
|
|
|
2023-08-23 14:27:50 +08:00
|
|
|
Future<Response> passwordKeyList(
|
|
|
|
|
String keyStatus,
|
|
|
|
|
String lockId,
|
|
|
|
|
String operatorUid,
|
|
|
|
|
String pageNo,
|
|
|
|
|
String pageSize,
|
|
|
|
|
) =>
|
|
|
|
|
post(
|
|
|
|
|
passwordKeyListURL.toUrl,
|
|
|
|
|
jsonEncode({
|
|
|
|
|
'keyStatus': keyStatus,
|
|
|
|
|
'lockId': lockId,
|
|
|
|
|
'operatorUid': operatorUid,
|
|
|
|
|
'pageNo': pageNo,
|
|
|
|
|
'pageSize': pageSize
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
Future<Response> resetPasswordKey(String lockId, String operatorUid) => post(
|
2023-08-25 17:06:42 +08:00
|
|
|
resetPasswordURL.toUrl,
|
2023-08-23 14:27:50 +08:00
|
|
|
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
|
2023-08-25 17:06:42 +08:00
|
|
|
|
|
|
|
|
Future<Response> getKeyboardPwd(
|
|
|
|
|
String endDate,
|
|
|
|
|
String isExclusive,
|
|
|
|
|
String keyboardPwdName,
|
|
|
|
|
String keyboardPwdType,
|
|
|
|
|
String keyboardPwdVersion,
|
|
|
|
|
String lockId,
|
|
|
|
|
String operatorUid,
|
|
|
|
|
String startDate,
|
|
|
|
|
String timezoneRawOffSet,
|
|
|
|
|
) =>
|
|
|
|
|
post(
|
|
|
|
|
passwordKeyGetURL.toUrl,
|
|
|
|
|
jsonEncode({
|
|
|
|
|
'endDate': endDate,
|
|
|
|
|
'isExclusive': isExclusive,
|
|
|
|
|
'keyboardPwdName': keyboardPwdName,
|
|
|
|
|
'keyboardPwdType': keyboardPwdType,
|
|
|
|
|
'keyboardPwdVersion': keyboardPwdVersion,
|
|
|
|
|
'lockId': lockId,
|
|
|
|
|
'operatorUid': operatorUid,
|
|
|
|
|
'startDate': startDate,
|
|
|
|
|
'timezoneRawOffSet': timezoneRawOffSet
|
|
|
|
|
}));
|
2023-08-28 17:35:30 +08:00
|
|
|
|
|
|
|
|
Future<Response> clearOperationRecord(String lockId) =>
|
|
|
|
|
post(clearOperationRecordURL.toUrl, jsonEncode({'lockId': lockId}));
|
|
|
|
|
|
|
|
|
|
Future<Response> addLockGroup(String groupName, String operatorUid) => post(
|
|
|
|
|
addlockGroupURL.toUrl,
|
|
|
|
|
jsonEncode({'groupName': groupName, 'operatorUid': operatorUid}));
|
|
|
|
|
|
|
|
|
|
Future<Response> lockGroupList(String type) =>
|
|
|
|
|
post(lockGroupListURL.toUrl, jsonEncode({'type': type}));
|
2023-08-29 17:41:20 +08:00
|
|
|
|
|
|
|
|
Future<Response> deleteElectronicKey(String keyId) =>
|
|
|
|
|
post(deleteElectronicKeyURL.toUrl, jsonEncode({'keyId': keyId}));
|
|
|
|
|
|
|
|
|
|
Future<Response> deleteKeyboardPwd(
|
2023-09-04 11:11:14 +08:00
|
|
|
String lockId, String keyboardPwdId, String deleteType) =>
|
2023-08-29 17:41:20 +08:00
|
|
|
post(
|
|
|
|
|
deleteKeyboardPwdURL.toUrl,
|
|
|
|
|
jsonEncode({
|
2023-09-04 11:11:14 +08:00
|
|
|
'lockId': lockId,
|
2023-08-29 17:41:20 +08:00
|
|
|
'keyboardPwdId': keyboardPwdId,
|
|
|
|
|
'deleteType': deleteType
|
|
|
|
|
}));
|
2023-08-30 10:58:00 +08:00
|
|
|
|
|
|
|
|
Future<Response> updateSetting(String lockId, String isOn, String type) =>
|
|
|
|
|
post(updateSettingURL.toUrl,
|
|
|
|
|
jsonEncode({'lockId': lockId, 'isOn': isOn, 'type': type}));
|
2023-08-31 15:58:29 +08:00
|
|
|
|
|
|
|
|
Future<Response> keyGroupList(String type) =>
|
|
|
|
|
post(keyGroupListURL.toUrl, jsonEncode({'type': type}));
|
|
|
|
|
|
|
|
|
|
Future<Response> lockListByGroup(String type, String keyGroupId) => post(
|
|
|
|
|
lockListByGroupURL.toUrl,
|
|
|
|
|
jsonEncode({'type': type, 'keyGroupId': keyGroupId}));
|
2023-09-04 15:04:44 +08:00
|
|
|
|
|
|
|
|
Future<Response> getKeyDetail(String lockId) =>
|
|
|
|
|
post(getKeyDetailURL.toUrl, jsonEncode({'lockId': lockId}));
|
2023-07-27 15:29:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension ExtensionString on String {
|
2023-08-23 14:27:50 +08:00
|
|
|
String get toUrl => this;
|
2023-08-07 10:32:24 +08:00
|
|
|
}
|