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

View File

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

View File

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

View File

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

View File

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

View File

@ -276,7 +276,7 @@ class ShowCupertinoAlertView {
}
//
void isToRemoteUnLockAlert(AuthInfoCallback callback) {
void isToRemoteUnLockAlert({required Function remoteUnlockAction}) {
showCupertinoDialog(
context: Get.context!,
builder: (BuildContext context) {
@ -296,7 +296,7 @@ class ShowCupertinoAlertView {
CupertinoDialogAction(
onPressed: () {
//
callback(null, null);
remoteUnlockAction();
Get.back();
},
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();
},
),
],
);
},
);
}
}