1,新增删除电子钥匙接口

2,新增删除密码接口
3,新增标记房态接口
This commit is contained in:
Daisy 2023-08-30 10:58:00 +08:00
parent 29955205ec
commit 5960876d53
6 changed files with 94 additions and 51 deletions

View File

@ -125,7 +125,9 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {}), onClick: () {
deleteKeyRequest();
}),
], ],
), ),
); );
@ -249,6 +251,19 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
} }
} }
//
Future<void> deleteKeyRequest() async {
ElectronicKeyListEntity entity =
await ApiRepository.to.deleteElectronicKey('0');
if (entity.errorCode!.codeIsSuccessful) {
print("删除电子钥匙成功");
Toast.show(msg: "删除成功");
setState(() {
Navigator.pop(context);
});
}
}
void showCupertinoAlertDialog( void showCupertinoAlertDialog(
BuildContext context, BuildContext context,
) { ) {

View File

@ -428,12 +428,26 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
), ),
OutLineBtn( OutLineBtn(
btnName: '标记为已入住', btnName: '标记为已入住',
onClick: () {}, onClick: () {
updateRoomCheckIn();
},
), ),
], ],
); );
} }
// isOn:: 1 2
Future<void> updateRoomCheckIn() async {
var entity = await ApiRepository.to.updateSetting('0', '1', '13');
if (entity.errorCode!.codeIsSuccessful) {
print("标记为已入住成功啦啦啦啦啦");
Toast.show(msg: "标记成功");
setState(() {});
} else {
Toast.show(msg: '操作失败');
}
}
// //
Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex) { Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex) {
return SizedBox( return SizedBox(

View File

@ -3,7 +3,10 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
import 'package:star_lock/tools/shareModule/sharePopup.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/toast.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
@ -163,7 +166,9 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {}), onClick: () {
deletePwdRequest();
}),
], ],
), ),
); );
@ -232,6 +237,19 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
); );
} }
//
Future<void> deletePwdRequest() async {
PasswordKeyEntity entity =
await ApiRepository.to.deleteKeyboardPwd('0', '1', '1');
if (entity.errorCode!.codeIsSuccessful) {
print("删除密码成功");
Toast.show(msg: "删除成功");
setState(() {
Navigator.pop(context);
});
}
}
void showCupertinoAlertDialog(BuildContext context) { void showCupertinoAlertDialog(BuildContext context) {
showDialog( showDialog(
context: context, context: context,

View File

@ -34,4 +34,5 @@ abstract class Api {
final String clearOperationRecordURL = '/lockRecords/clear'; // final String clearOperationRecordURL = '/lockRecords/clear'; //
final String addlockGroupURL = '/keyGroup/add'; // final String addlockGroupURL = '/keyGroup/add'; //
final String lockGroupListURL = '/authorizedAdmin/listGroup'; // final String lockGroupListURL = '/authorizedAdmin/listGroup'; //
final String updateSettingURL = '/room/updateSetting'; //
} }

View File

@ -250,24 +250,19 @@ class ApiProvider extends BaseProvider {
})); }));
// //
Future<Response> getLockInfo( Future<Response> getLockInfo(String lastUpdateDate, String pageNo) => post(
String lastUpdateDate, getLockInfoURL.toUrl,
String pageNo) => jsonEncode({
post( 'lastUpdateDate': lastUpdateDate,
getLockInfoURL.toUrl, "pageNo": pageNo,
jsonEncode({ }));
'lastUpdateDate': lastUpdateDate,
"pageNo": pageNo,
}));
// //
Future<Response> deletLockInfo( Future<Response> deletLockInfo(String lockId) => post(
String lockId) => deletLockURL.toUrl,
post( jsonEncode({
deletLockURL.toUrl, 'lockId': lockId,
jsonEncode({ }));
'lockId': lockId,
}));
Future<Response> passwordKeyList( Future<Response> passwordKeyList(
String keyStatus, String keyStatus,
@ -337,6 +332,10 @@ class ApiProvider extends BaseProvider {
'keyboardPwdId': keyboardPwdId, 'keyboardPwdId': keyboardPwdId,
'deleteType': deleteType 'deleteType': deleteType
})); }));
Future<Response> updateSetting(String lockId, String isOn, String type) =>
post(updateSettingURL.toUrl,
jsonEncode({'lockId': lockId, 'isOn': isOn, 'type': type}));
} }
extension ExtensionString on String { extension ExtensionString on String {

View File

@ -177,24 +177,17 @@ class ApiRepository {
} }
// //
Future<SaveLockEntity> bindingBlueAdmin({ Future<SaveLockEntity> bindingBlueAdmin(
required String bindingDate, {required String bindingDate,
required String hotelMode, required String hotelMode,
required String lockAlias, required String lockAlias,
required Map lockData, required Map lockData,
required String nbInitSuccess, required String nbInitSuccess,
required Map position, required Map position,
required Map bluetooth, required Map bluetooth,
required String deviceNo}) async { required String deviceNo}) async {
final res = await apiProvider.bindingBlueAdmin( final res = await apiProvider.bindingBlueAdmin(bindingDate, hotelMode,
bindingDate, lockAlias, lockData, nbInitSuccess, position, bluetooth, deviceNo);
hotelMode,
lockAlias,
lockData,
nbInitSuccess,
position,
bluetooth,
deviceNo);
return SaveLockEntity.fromJson(res.body); return SaveLockEntity.fromJson(res.body);
} }
@ -250,18 +243,14 @@ class ApiRepository {
} }
// //
Future<LockMainEntity> getLockInfo({ Future<LockMainEntity> getLockInfo(
required String lastUpdateDate, {required String lastUpdateDate, required String pageNo}) async {
required String pageNo}) async { final res = await apiProvider.getLockInfo(lastUpdateDate, pageNo);
final res = await apiProvider.getLockInfo(
lastUpdateDate,
pageNo);
return LockMainEntity.fromJson(res.body); return LockMainEntity.fromJson(res.body);
} }
// //
Future<LockMainEntity> deletLockData({ Future<LockMainEntity> deletLockData({required String lockId}) async {
required String lockId}) async {
final res = await apiProvider.deletLockInfo(lockId); final res = await apiProvider.deletLockInfo(lockId);
return LockMainEntity.fromJson(res.body); return LockMainEntity.fromJson(res.body);
} }
@ -311,16 +300,23 @@ class ApiRepository {
} }
// //
Future<LockGroupListEntity> deleteElectronicKey(String type) async { Future<ElectronicKeyListEntity> deleteElectronicKey(String keyId) async {
final res = await apiProvider.deleteElectronicKey(type); final res = await apiProvider.deleteElectronicKey(keyId);
return LockGroupListEntity.fromJson(res.body); return ElectronicKeyListEntity.fromJson(res.body);
} }
// //
Future<LockGroupListEntity> deleteKeyboardPwd( Future<PasswordKeyEntity> deleteKeyboardPwd(
String keyId, String keyboardPwdId, String deleteType) async { String keyId, String keyboardPwdId, String deleteType) async {
final res = final res =
await apiProvider.deleteKeyboardPwd(keyId, keyboardPwdId, deleteType); await apiProvider.deleteKeyboardPwd(keyId, keyboardPwdId, deleteType);
return LockGroupListEntity.fromJson(res.body); 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);
} }
} }