app-starlock/star_lock/lib/network/api_provider.dart
Daisy 8c8d8a62b9 1,新增锁电量更新接口
2,新增修改锁名称接口
2023-08-18 18:25:58 +08:00

218 lines
6.3 KiB
Dart

import 'dart:convert';
import 'package:get/get.dart';
import 'api_provider_base.dart';
class ApiProvider extends BaseProvider {
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,
}));
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,
});
// post(
// registerUrl.toUrl,
// jsonEncode({
// 'countryCode': countryCode,
// 'countryId': countryId,
// "mobile": mobile,
// 'password': password,
// 'platId': "2",
// "uniqueid": uniqueid,
// 'verificationCode': verificationCode,
// }));
Future<Response> getSliderVerifyImg(String countryCode, String account) =>
post(
getSliderVerifyImgUrl.toUrl,
jsonEncode({
'countryCode': countryCode,
'account': account,
}));
Future<Response> checkSliderVerifyImg(
String countryCode, String account, String xWidth) =>
post(
checkImgUrl.toUrl,
jsonEncode({
'countryCode': countryCode,
'account': account,
'xWidth': xWidth,
}));
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
}));
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,
}));
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,
String startDate) =>
post(
electronicKeyListURL.toUrl,
jsonEncode({
'endDate': endDate,
'keyId': keyId,
"keyStatus": keyStatus,
'lockId': lockId,
"operatorUid": operatorUid,
'pageNo': pageNo,
'pageSize': pageSize,
'startDate': startDate,
}));
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,
List weekDays) =>
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,
}));
Future<Response> modifyKeyName(
String keyId,
String lockId,
String keyName,
String operatorUid,
) =>
post(
modifyKeyNameURL.toUrl,
jsonEncode({
'keyId': keyId,
'lockId': lockId,
'keyName': keyName,
'operatorUid': operatorUid,
}));
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,
String timezoneRawOffSet) =>
post(
keyOperationRecordURL.toUrl,
jsonEncode({
'endDate': endDate,
'keyId': keyId,
"keyStatus": keyStatus,
'lockId': lockId,
"operatorUid": operatorUid,
'pageNo': pageNo,
'pageSize': pageSize,
'startDate': startDate,
'recordType': recordType,
'searchStr': searchStr,
'timezoneRawOffSet': timezoneRawOffSet
}));
}
extension ExtensionString on String {
String get toUrl => '$this';
}