1,修改实名认证点击逻辑

2,授权管理员角色新增联系管理员
This commit is contained in:
Daisy 2024-05-14 17:08:35 +08:00
parent d23e0a121f
commit 317013eb98
7 changed files with 116 additions and 91 deletions

View File

@ -228,20 +228,23 @@ class AuthorizedAdminLogic extends BaseGetXController {
// //
Future<void> keyCheckFace() async { Future<void> keyCheckFace() async {
AdvancedFunctionRecordEntity entity = await ApiRepository.to.keyCheckFace( AdvancedFunctionRecordEntity entity = await ApiRepository.to.keyCheckFace(
countryCode: int.parse(state.countryCode.value), lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
account: state.emailOrPhoneController.text); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
// //
state.isRequireAuth.value = true; state.isRequireAuth.value = true;
state.isAuthentication.value = true; state.isAuthentication.value = true;
} else { } else if (entity.errorCode == 432) {
//432-- //432--
ShowTipView().showBuyTipWithContentAlert( ShowCupertinoAlertView().showBuyTipWithContentAlert(
titleStr: '实名认证为付费功能,请购买后再使用'.tr, titleStr: '实名认证为付费功能,请购买后再使用'.tr,
sureClick: () { sureClick: () {
Get.toNamed(Routers.advancedFeaturesWebPage, Get.toNamed(Routers.advancedFeaturesWebPage,
arguments: {'isShop': false}); arguments: {'isShop': false});
}); });
} else if (entity.errorCode == 433) {
//
ShowCupertinoAlertView().showContactAdministratorBuyAlert();
} }
} }

View File

@ -185,20 +185,23 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
// //
Future<void> keyCheckFace() async { Future<void> keyCheckFace() async {
AdvancedFunctionRecordEntity entity = await ApiRepository.to.keyCheckFace( AdvancedFunctionRecordEntity entity = await ApiRepository.to.keyCheckFace(
countryCode: int.parse(state.countryCode), lockId: CommonDataManage().currentKeyInfo.lockId ?? 0,
account: state.emailOrPhoneController.text); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
// //
state.isRequireAuth.value = true; state.isRequireAuth.value = true;
state.isAuthentication.value = true; state.isAuthentication.value = true;
} else { } else if (entity.errorCode == 432) {
//432-- //432--
ShowTipView().showBuyTipWithContentAlert( ShowCupertinoAlertView().showBuyTipWithContentAlert(
titleStr: '实名认证为付费功能,请购买后再使用'.tr, titleStr: '实名认证为付费功能,请购买后再使用'.tr,
sureClick: () { sureClick: () {
Get.toNamed(Routers.advancedFeaturesWebPage, Get.toNamed(Routers.advancedFeaturesWebPage,
arguments: {'isShop': false}); arguments: {'isShop': false});
}); });
} else if (entity.errorCode == 433) {
//
ShowCupertinoAlertView().showContactAdministratorBuyAlert();
} }
} }

View File

@ -643,8 +643,8 @@ class _LockDetailPageState extends State<LockDetailPage>
: false, : false,
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
ShowCupertinoAlertView() ShowCupertinoAlertView().isToRemoteUnLockAlert(
.isToRemoteUnLockAlert((idCard, name) { remoteUnlockAction: () {
if (state.keyInfos.value.hasGateway != 1) { if (state.keyInfos.value.hasGateway != 1) {
logic.showToast('附近没有可用网关'); logic.showToast('附近没有可用网关');
} }
@ -1316,7 +1316,9 @@ class _LockDetailPageState extends State<LockDetailPage>
// //
isNeedRealNameAuthThenOpenLock() { isNeedRealNameAuthThenOpenLock() {
state.nextAuthTime.value = state.keyInfos.value.nextFaceValidateTime ?? 0; state.nextAuthTime.value = state.keyInfos.value.nextFaceValidateTime ?? 0;
if (state.keyInfos.value.faceAuthentication == 1 && state.nextAuthTime.value > 0 && DateTool().compareTimeIsOvertime(state.nextAuthTime.value) == true) { if (state.keyInfos.value.faceAuthentication == 1 &&
state.nextAuthTime.value > 0 &&
DateTool().compareTimeIsOvertime(state.nextAuthTime.value) == true) {
AliyunRealNameAuthProvider( AliyunRealNameAuthProvider(
getLockInfo: state.keyInfos.value, getLockInfo: state.keyInfos.value,
onCertifyResultWithTime: ((bool isSuccess, int getNextAuthTime) { onCertifyResultWithTime: ((bool isSuccess, int getNextAuthTime) {

View File

@ -184,8 +184,7 @@ class ApiProvider extends BaseProvider {
'electricQuantityStandby': electricQuantityStandby, 'electricQuantityStandby': electricQuantityStandby,
'lockId': lockId, 'lockId': lockId,
}), }),
isUnShowLoading: isUnShowLoading isUnShowLoading: isUnShowLoading);
);
Future<Response> modifyKeyName( Future<Response> modifyKeyName(
String keyId, String keyId,
@ -809,10 +808,8 @@ class ApiProvider extends BaseProvider {
})); }));
// //
Future<Response> getServerDatetimeLoadData() => post( Future<Response> getServerDatetimeLoadData() =>
getServerDatetimeUrl.toUrl, post(getServerDatetimeUrl.toUrl, jsonEncode({}), isUnShowLoading: true);
jsonEncode({}),
isUnShowLoading: true);
// //
Future<Response> setLockDiagnoseData( Future<Response> setLockDiagnoseData(
@ -1611,8 +1608,8 @@ class ApiProvider extends BaseProvider {
post(getUserInfoURL.toUrl, jsonEncode({'operatorUid': operatorUid})); post(getUserInfoURL.toUrl, jsonEncode({'operatorUid': operatorUid}));
// //
Future<Response> keyboardPwdReset(String lockId, List passwordKey) => Future<Response> keyboardPwdReset(String lockId, List passwordKey) => post(
post(keyboardPwdResetURL.toUrl, keyboardPwdResetURL.toUrl,
jsonEncode({ jsonEncode({
'lockId': lockId, 'lockId': lockId,
'passwordKey': passwordKey, 'passwordKey': passwordKey,
@ -2042,14 +2039,12 @@ class ApiProvider extends BaseProvider {
// //
Future<Response> keyCheckFace( Future<Response> keyCheckFace(
int countryCode, int lockId,
String account,
) => ) =>
post( post(
isFaceAuthenticationURL.toUrl, isFaceAuthenticationURL.toUrl,
jsonEncode({ jsonEncode({
'countryCode': countryCode, 'lockId': lockId,
'account': account,
})); }));
// certifyId // certifyId

View File

@ -2075,10 +2075,9 @@ class ApiRepository {
// //
Future<AdvancedFunctionRecordEntity> keyCheckFace({ Future<AdvancedFunctionRecordEntity> keyCheckFace({
required int countryCode, required int lockId,
required String account,
}) async { }) async {
final res = await apiProvider.keyCheckFace(countryCode, account); final res = await apiProvider.keyCheckFace(lockId);
return AdvancedFunctionRecordEntity.fromJson(res.body); return AdvancedFunctionRecordEntity.fromJson(res.body);
} }

View File

@ -276,7 +276,7 @@ class ShowCupertinoAlertView {
} }
// //
void isToRemoteUnLockAlert(AuthInfoCallback callback) { void isToRemoteUnLockAlert({required Function remoteUnlockAction}) {
showCupertinoDialog( showCupertinoDialog(
context: Get.context!, context: Get.context!,
builder: (BuildContext context) { builder: (BuildContext context) {
@ -296,7 +296,7 @@ class ShowCupertinoAlertView {
CupertinoDialogAction( CupertinoDialogAction(
onPressed: () { onPressed: () {
// //
callback(null, null); remoteUnlockAction();
Get.back(); Get.back();
}, },
child: Text( child: Text(
@ -309,4 +309,59 @@ class ShowCupertinoAlertView {
}, },
); );
} }
//
void showBuyTipWithContentAlert(
{required String titleStr, required Function sureClick}) {
showCupertinoDialog(
context: Get.context!,
builder: (context) {
return CupertinoAlertDialog(
title: Text(titleStr),
actions: [
CupertinoDialogAction(
child: Text(
'取消'.tr,
style: TextStyle(color: AppColors.mainColor),
),
onPressed: () {
Get.back();
},
),
CupertinoDialogAction(
child:
Text('购买'.tr, style: TextStyle(color: AppColors.mainColor)),
onPressed: () {
Get.back();
sureClick();
},
),
],
);
},
);
}
//
void showContactAdministratorBuyAlert() {
showCupertinoDialog(
context: Get.context!,
builder: (context) {
return CupertinoAlertDialog(
title: const Text('实名认证为付费功能,请联系锁的管理员购买后再使用'),
actions: [
CupertinoDialogAction(
child: Text(
'确定'.tr,
style: TextStyle(color: AppColors.mainColor),
),
onPressed: () {
Get.back();
},
),
],
);
},
);
}
} }

View File

@ -122,36 +122,4 @@ class ShowTipView {
}, },
); );
} }
//
void showBuyTipWithContentAlert(
{required String titleStr, required Function sureClick}) {
showCupertinoDialog(
context: Get.context!,
builder: (context) {
return CupertinoAlertDialog(
title: Text(titleStr),
actions: [
CupertinoDialogAction(
child: Text(
'取消'.tr,
style: TextStyle(color: AppColors.mainColor),
),
onPressed: () {
Get.back();
},
),
CupertinoDialogAction(
child:
Text('购买'.tr, style: TextStyle(color: AppColors.mainColor)),
onPressed: () {
Get.back();
sureClick();
},
),
],
);
},
);
}
} }