// // QXLoginViewController.m // QXLive // // Created by 启星 on 2025/4/24. // #import "QXLoginViewController.h" #import "QXLoginTextField.h" #import "QXLoginBottomView.h" #import "QXFillUserInfoViewController.h" #import "QXForgotPwdViewController.h" #import #import #import "ATAuthSDK/TXCommonHandler.h" #import "ATAuthSDK/PNSReturnCode.h" #import "QXLoginNetwork.h" #import "QXAccountListViewController.h" // 多账号 #import "AppDelegate+Login.h" #import "QXLoginProtocolViewController.h" @interface QXLoginViewController () @property (nonatomic,strong)UIImageView *logoImageView; @property (nonatomic,strong)UILabel *welcomeLabel; @property (nonatomic,strong)UILabel *subTitleLabel; @property (nonatomic,strong)QXLoginTextField *accountTextField; @property (nonatomic,strong)QXLoginTextField *codeTextField; @property (nonatomic,strong)QXLoginTextField *passwordTextField; /// 是否为验证码登录 默认为验证码登录 @property (nonatomic,assign)BOOL isCodeLogin; /// 是否同意用户协议和隐私政策 @property (nonatomic,assign)BOOL isAgree; @property (nonatomic,strong)UIButton *changeTypeBtn; @property (nonatomic,strong)UIButton *loginBtn; @property (nonatomic,strong)UIButton *forgotBtn; @property (nonatomic,strong)UIButton *backBtn; @property (nonatomic,strong)QXLoginBottomView *thirdLoginView; //微信登录 @property (nonatomic,strong)NSString *wechatOpenId; @property (nonatomic,strong)NSString *wxaccess_token; @end @implementation QXLoginViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. } -(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [self.navigationController setNavigationBarHidden:YES animated:YES]; } -(void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appleLogin:) name:noticeAppleLogin object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(wechatLoginAction:) name:noticeWeChatLogin object:nil]; } -(void)viewDidDisappear:(BOOL)animated{ [super viewDidDisappear:animated]; [[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self]; } -(void)viewWillDisappear:(BOOL)animated{ [super viewWillDisappear:animated]; // [self.navigationController setNavigationBarHidden:NO animated:YES]; } -(void)initSubViews{ self.backBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, kSafeAreaTop+5, 40, 40)]; [self.backBtn setImage:[UIImage imageNamed:@"back"] forState:(UIControlStateNormal)]; [self.backBtn addTarget:self action:@selector(backAction) forControlEvents:(UIControlEventTouchUpInside)]; [self.view addSubview:self.backBtn]; self.isCodeLogin = YES; // self.welcomeLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, kSafeAreaTop+86, SCREEN_WIDTH-32, 36)]; // self.welcomeLabel.font = [UIFont boldSystemFontOfSize:24]; //// self.welcomeLabel.text = QXText(@"欢迎来到秘地"); //// welcome_midi // self.welcomeLabel.textColor = QXConfig.textColor; // [self.view addSubview:self.welcomeLabel]; self.logoImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"welcome_midi"]]; self.logoImageView.frame = CGRectMake(16, NavContentHeight+19, 170, 120); [self.view addSubview:self.logoImageView]; self.subTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, self.logoImageView.bottom+15, SCREEN_WIDTH-32, 27)]; self.subTitleLabel.font = [UIFont boldSystemFontOfSize:18]; self.subTitleLabel.text = QXText(@"验证码登录"); self.subTitleLabel.textColor = QXConfig.textColor; [self.view addSubview:self.subTitleLabel]; self.accountTextField = [[QXLoginTextField alloc] initWithFrame:CGRectMake(16, self.subTitleLabel.bottom+16, SCREEN_WIDTH-32, 44) type:(LoginTextTypeAccount)]; self.accountTextField.backgroundColor = RGB16(0xF0EEF7); [self.accountTextField addRoundedCornersWithRadius:22]; [self.view addSubview:self.accountTextField]; self.codeTextField = [[QXLoginTextField alloc] initWithFrame:CGRectMake(16, self.accountTextField.bottom+16, SCREEN_WIDTH-32, 44) type:(LoginTextTypeCode)]; self.codeTextField.backgroundColor = RGB16(0xF0EEF7); [self.codeTextField addRoundedCornersWithRadius:22]; self.codeTextField.delegate = self; [self.view addSubview:self.codeTextField]; self.passwordTextField = [[QXLoginTextField alloc] initWithFrame:CGRectMake(16, self.accountTextField.bottom+16, SCREEN_WIDTH-32, 44) type:(LoginTextTypePassword)]; self.passwordTextField.backgroundColor = RGB16(0xF0EEF7); [self.passwordTextField addRoundedCornersWithRadius:22]; [self.view addSubview:self.passwordTextField]; self.passwordTextField.hidden = YES; self.changeTypeBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-16-145, self.codeTextField.bottom, 145, 40)]; [self.changeTypeBtn setImage:[UIImage imageNamed:@"login_exchanged"] forState:(UIControlStateNormal)]; [self.changeTypeBtn setTitle:QXText(@"切换为密码登录") forState:(UIControlStateNormal)]; [self.changeTypeBtn setTitle:QXText(@"切换为验证码登录") forState:(UIControlStateSelected)]; [self.changeTypeBtn setTitleColor:QXConfig.textColor forState:(UIControlStateNormal)]; self.changeTypeBtn.titleLabel.font = [UIFont systemFontOfSize:14]; [self.changeTypeBtn addTarget:self action:@selector(changeAction:) forControlEvents:(UIControlEventTouchUpInside)]; [self.view addSubview:self.changeTypeBtn]; self.loginBtn = [[UIButton alloc] initWithFrame:CGRectMake(38, self.codeTextField.bottom+55, SCREEN_WIDTH-38*2, 42)]; [self.loginBtn setTitle:QXText(@"验证并登录") forState:(UIControlStateNormal)]; [self.loginBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)]; [self.loginBtn addTarget:self action:@selector(loginAction:) forControlEvents:(UIControlEventTouchUpInside)]; [self.loginBtn addRoundedCornersWithRadius:21]; self.loginBtn.titleLabel.font = [UIFont systemFontOfSize:14]; self.loginBtn.backgroundColor = QXConfig.themeColor; [self.view addSubview:self.loginBtn]; self.forgotBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-38-75, self.loginBtn.bottom, 75, 33)]; [self.forgotBtn setTitle:[NSString stringWithFormat:@"%@?",QXText(@"忘记密码")] forState:(UIControlStateNormal)]; [self.forgotBtn setTitleColor:QXConfig.themeColor forState:(UIControlStateNormal)]; self.forgotBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentTrailing; [self.forgotBtn addTarget:self action:@selector(forgotAction:) forControlEvents:(UIControlEventTouchUpInside)]; self.forgotBtn.titleLabel.font = [UIFont systemFontOfSize:12]; [self.view addSubview:self.forgotBtn]; self.thirdLoginView = [[QXLoginBottomView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT-200, SCREEN_WIDTH, 200)]; NSArray *thirdArray = @[ @{@"type":@(1),@"icon":@"third_login_wechat"}, @{@"type":@(2),@"icon":@"third_login_alipay"}, @{@"type":@(3),@"icon":@"third_login_apple"}, ]; self.thirdLoginView.thirdArray = thirdArray; self.thirdLoginView.delegate = self; self.thirdLoginView.isDefaultAgree = YES; self.isAgree = YES; [self.view addSubview:self.thirdLoginView]; [self checkEnvAvailableLogin]; } - (void)checkEnvAvailableLogin { TXCustomModel *model = [self setLoginModel]; MJWeakSelf //检测当前环境是否支持一键登录 if ([QXGlobal shareGlobal].canOneLogin) { [[TXCommonHandler sharedInstance] checkEnvAvailableWithAuthType:PNSAuthTypeLoginToken complete:^(NSDictionary * _Nullable resultDic) { if ([PNSCodeSuccess isEqualToString:[resultDic objectForKey:@"resultCode"]]) { //success [weakSelf startLoginWithModel:model complete:^{ }]; }else{ } }]; } } - (void)startLoginWithModel:(TXCustomModel *)model complete:(void (^)(void))completion { MJWeakSelf //调用取号接口,加速授权页的弹起 [[TXCommonHandler sharedInstance] accelerateLoginPageWithTimeout:5 complete:^(NSDictionary * _Nonnull resultDic) { if ([PNSCodeSuccess isEqualToString:[resultDic objectForKey:@"resultCode"]] == NO) { completion(); return ; } //调用获取登录Token接口,可以立马弹起授权页 [[TXCommonHandler sharedInstance] getLoginTokenWithTimeout:5 controller:weakSelf model:model complete:^(NSDictionary * _Nonnull resultDic) { completion(); NSString *code = [resultDic objectForKey:@"resultCode"]; if ([PNSCodeLoginControllerPresentFailed isEqualToString:code]) { return; } if ([PNSCodeLoginControllerPresentSuccess isEqualToString:code]) { // [SRToastTool showSuccess:@"弹起授权页成功"]; } else if ([PNSCodeLoginControllerClickCancel isEqualToString:code]) { // [SRToastTool showSuccess:@"点击了授权页的返回"]; } else if ([PNSCodeLoginControllerClickChangeBtn isEqualToString:code]) { // [SRToastTool showSuccess:@"点击切换其他登录方式按钮"]; // [LoginAnalyticsManager analyticsOneClickOtherLogin]; [[TXCommonHandler sharedInstance] cancelLoginVCAnimated:YES complete:nil]; } else if ([PNSCodeLoginControllerClickLoginBtn isEqualToString:code]) { // [SRToastTool showSuccess:@"点击了登录按钮,checkbox关闭(不必选中),SDK内部接着会去获取登陆Token"]; } else if ([PNSCodeLoginControllerClickCheckBoxBtn isEqualToString:code]) { // [SRToastTool showSuccess:@"点击check box"]; } else if ([PNSCodeLoginControllerClickProtocol isEqualToString:code]) { // [SRToastTool showSuccess:@"点击了协议富文本"]; } else if ([PNSCodeSuccess isEqualToString:code]) { //点击登录按钮获取登录Token成功回调 NSString *token = [resultDic objectForKey:@"token"]; if (!token || token.length == 0) { showToast(QXText(@"暂不支持一键登录")); [[TXCommonHandler sharedInstance] cancelLoginVCAnimated:YES complete:nil]; return; }else{ [self loginAndGetAccountListWithType:LoginTypeOne user_login:@"" sms_code:@"" password:@"" code:@"" login_token:token auth_code:@""]; } } else { // [SRToastTool showError:@"获取登录Token失败"]; [[TXCommonHandler sharedInstance] cancelLoginVCAnimated:YES complete:nil]; } }]; }]; } #pragma mark - 配置登录对象 - (TXCustomModel *)setLoginModel { TXCustomModel *model = [TXCustomModel new]; // model.contentViewFrameBlock = ^CGRect(CGSize screenSize, CGSize superViewSize, CGRect frame) { // return CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); // }; // UIImageView *bgImage = [[UIImageView alloc] initWithImage:Image(@"app_bg")]; // bgImage.contentMode = UIViewContentModeScaleAspectFill; // bgImage.frame = CGRectMake(0, 0, ScreenWidth, ScreenHeight); model.customViewBlock = ^(UIView * _Nonnull superCustomView) { // bgImage.frame = superCustomView.frame; // [superCustomView insertSubview:bgImage atIndex:0]; }; model.backgroundImage = [UIImage imageNamed:@"app_bg"]; model.navColor = [UIColor clearColor]; model.backgroundColor = [UIColor clearColor]; // model.preferredStatusBarStyle = UIStatusBarStyleLightContent; model.supportedInterfaceOrientations = UIInterfaceOrientationMaskPortrait; model.navIsHidden = YES; model.preferredStatusBarStyle = UIStatusBarStyleDarkContent; model.logoImage = [UIImage imageNamed:@"login_logo"]; model.logoFrameBlock = ^CGRect(CGSize screenSize, CGSize superViewSize, CGRect frame) { frame.origin = CGPointMake((SCREEN_WIDTH - 170) * .5, 75+ kSafeAreaTop); frame.size = CGSizeMake(170, 170); return frame; }; model.sloganText = [[NSAttributedString alloc] initWithString:@"本机号码" attributes:@{NSForegroundColorAttributeName : RGB16(0x666666),NSFontAttributeName : [UIFont systemFontOfSize:12]}]; model.sloganFrameBlock = ^CGRect(CGSize screenSize, CGSize superViewSize, CGRect frame) { frame.origin.y = 280+kSafeAreaTop+40; return frame; }; model.numberColor = QXConfig.textColor; model.numberFont = [UIFont boldSystemFontOfSize:30]; model.numberFrameBlock = ^CGRect(CGSize screenSize, CGSize superViewSize, CGRect frame) { frame.origin.y = kSafeAreaTop+280; return frame; }; model.loginBtnText = [[NSAttributedString alloc] initWithString:@"一键登录" attributes:@{NSForegroundColorAttributeName : QXConfig.btnTextColor,NSFontAttributeName : [UIFont systemFontOfSize:15]}]; model.loginBtnFrameBlock = ^CGRect(CGSize screenSize, CGSize superViewSize, CGRect frame) { frame.origin.y = 380+kSafeAreaTop; frame.origin.x = 38; frame.size = CGSizeMake(SCREEN_WIDTH-76, 42); return frame; }; model.loginBtnBgImgs = @[[[UIImage imageNamed:@"login_btn_bg"] imageByTintColor:QXConfig.themeColor],[[UIImage imageNamed:@"login_btn_bg"]imageByTintColor:QXConfig.themeColor],[[UIImage imageNamed:@"login_btn_bg"]imageByTintColor:QXConfig.themeColor]]; model.changeBtnTitle = [[NSAttributedString alloc] initWithString:@"其他手机号登录" attributes:@{NSForegroundColorAttributeName : QXConfig.textColor,NSFontAttributeName : [UIFont systemFontOfSize:15]}]; model.changeBtnFrameBlock = ^CGRect(CGSize screenSize, CGSize superViewSize, CGRect frame) { frame.origin.y = 380+kSafeAreaTop+12+42; frame.origin.x = 38; frame.size = CGSizeMake(SCREEN_WIDTH-76, 42); return frame; }; model.checkBoxImages = @[[UIImage imageNamed:@"login_agreement_nor"],[UIImage imageNamed:@"login_agreement_sel"]]; model.checkBoxWH = 30; model.privacyNavBackImage = [UIImage imageNamed:@"back"]; model.checkBoxIsChecked = YES; model.privacyOne = @[[NSString stringWithFormat:@"%@",QXText(@"《用户使用协议》")],[NSString stringWithFormat:@"%@%@?id=6",ServerUrl,QXAppProtocol]]; model.privacyTwo = @[[NSString stringWithFormat:@"%@",QXText(@"《隐私政策》")],[NSString stringWithFormat:@"%@%@?id=4",ServerUrl,QXAppProtocol]]; model.privacyOperatorPreText = @"《"; model.privacyOperatorSufText = @"》"; model.privacyColors = @[RGB16(0x333333),QXConfig.themeColor]; model.privacyAlignment = NSTextAlignmentCenter; return model; } -(void)wechatLoginAction:(NSNotification*)notice{ MJWeakSelf SendAuthResp *response = (SendAuthResp *)notice.object; _wechatOpenId = response.code; // NSString *url = [NSString stringWithFormat:@"https://api.weixin.qq.com/sns/oauth2/access_token?appid=%@&secret=%@&code=%@&grant_type=authorization_code",WechatAppId ,WechatAppSecret,_wechatOpenId]; // [[QXRequset shareInstance] getWithUrl:url parameters:@{} needCache:NO success:^(id responseObject) { // QXLOG(@"%@",responseObject); // self->_wxaccess_token = [NSString stringWithFormat:@"%@",responseObject[@"access_token"]]; [weakSelf loginAndGetAccountListWithType:LoginTypeWechat user_login:@"" sms_code:@"" password:@"" code:_wechatOpenId login_token:@"" auth_code:@""]; // } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { // // }]; } #pragma mark - QXThirdLoginViewDelegate -(void)thirdLoginWithType:(NSInteger)type{ switch (type) { case 1:{ QXLOG(@"微信登录"); [self jumpWechat]; // [self loginSuccess]; } break; case 2:{ QXLOG(@"支付宝登录"); // [self loginSuccess]; [self jumpAli]; } break; case 3:{ QXLOG(@"苹果登录"); // [self loginSuccess]; AppDelegate *appdelegate = (AppDelegate*)[UIApplication sharedApplication].delegate; [appdelegate authorizationAppleID]; } break; default: break; } } -(void)appleLogin:(NSNotification*)notice{ NSString *token = notice.object; [self loginAndGetAccountListWithType:(LoginTypeApple) user_login:@"" sms_code:@"" password:@"" code:token login_token:@"" auth_code:@""]; } -(void)jumpWechat{ SendAuthReq *req = [[SendAuthReq alloc] init]; req.state = @"wx_oauth_authorization_state"; req.scope = @"snsapi_userinfo"; [WXApi sendAuthReq:req viewController:self delegate:self completion:^(BOOL success) { }]; } -(void)jumpAli{ MJWeakSelf [QXLoginNetwork getAliAuthInfosuccessBlock:^(NSString * _Nonnull authStr) { [AlipaySDK startLogWithBlock:^(NSString *log) { QXLOG(@"alilog-----%@",log); }]; [[AlipaySDK defaultService] auth_V2WithInfo:authStr fromScheme:@"QXLive" callback:^(NSDictionary *resultDic) { NSString *result = resultDic[@"result"]; NSString *authCode = nil; if (result.length>0) { NSArray *resultArr = [result componentsSeparatedByString:@"&"]; for (NSString *subResult in resultArr) { if (subResult.length > 10 && [subResult hasPrefix:@"auth_code="]) { authCode = [subResult substringFromIndex:10]; break; } } } QXLOG(@"authcode = %@",authCode); [weakSelf loginAndGetAccountListWithType:LoginTypeAli user_login:@"" sms_code:@"" password:@"" code:@"" login_token:@"" auth_code:authCode]; }]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { }]; } -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ [self.view endEditing:YES]; } -(void)didClickAgree:(BOOL)isAgree{ self.isAgree = isAgree; } -(void)didClickAgreementLoginWithUrl:(NSString *)url type:(NSInteger)type{ QXLOG(type==1?@"点击了用户协议":@"点击了隐私政策"); if (type == 1) { QXLoginProtocolViewController *vc = [[QXLoginProtocolViewController alloc] init]; vc.type = 6; [self.navigationController pushViewController:vc animated:YES]; }else{ QXLoginProtocolViewController *vc = [[QXLoginProtocolViewController alloc] init]; vc.type = 4; [self.navigationController pushViewController:vc animated:YES]; } } #pragma mark - action -(void)backAction{ [self.navigationController dismissViewControllerAnimated:YES completion:nil]; QXGlobal.shareGlobal.isShowLoginVC = NO; } -(void)changeAction:(UIButton*)sender{ sender.selected = !sender.selected; self.isCodeLogin = !sender.selected; self.passwordTextField.hidden = !sender.selected; self.codeTextField.hidden = sender.selected; self.passwordTextField.textField.text = @""; self.codeTextField.textField.text = @""; self.subTitleLabel.text = sender.selected?QXText(@"密码登录"):QXText(@"验证码登录"); [self.loginBtn setTitle:sender.selected?QXText(@"登录"):QXText(@"验证并登录") forState:(UIControlStateNormal)]; } -(void)forgotAction:(UIButton*)sender{ QXForgotPwdViewController *vc = [[QXForgotPwdViewController alloc] init]; [self.navigationController pushViewController:vc animated:YES]; } -(void)loginAction:(UIButton*)sender{ if (!self.isAgree) { NSString *str = [NSString stringWithFormat:@"%@%@%@%@",QXText(@"请先阅读并同意"),QXText(@"《用户使用协议》"),QXText(@"和"),QXText(@"《隐私政策》")]; showToast(str); return; } NSString *account = self.accountTextField.textField.text; NSString *password = self.passwordTextField.textField.text; NSString *code = self.codeTextField.textField.text; if (self.accountTextField.textField.text.length < 11) { showToast(QXText(@"请输入正确的手机号码")); return; } LoginType loginType = LoginTypePhoneCode; if (self.isCodeLogin) { loginType = LoginTypePhoneCode; if (code.length == 0) { showToast(QXText(@"请输入验证码")); return; } }else{ loginType = LoginTypePassword; if (password.length == 0) { showToast(QXText(@"请输入密码")); return; } } [self loginAndGetAccountListWithType:loginType user_login:account sms_code:code password:password code:@"" login_token:@"" auth_code:@""]; } -(void)loginAndGetAccountListWithType:(LoginType)type user_login:(NSString*)user_login sms_code:(NSString*)sms_code password:(NSString*)password code:(NSString*)code login_token:(NSString*)login_token auth_code:(NSString*)auth_code{ if (type == LoginTypeOne) { [[TXCommonHandler sharedInstance] cancelLoginVCAnimated:YES complete:nil]; } MJWeakSelf showLoadingInView(self.view); [QXLoginNetwork loginGetAccountWithType:type user_login:user_login sms_code:sms_code password:password code:code login_token:login_token auth_code:auth_code successBlock:^(NSArray * _Nonnull accountList) { if (accountList.count > 1) { hideLoadingInView(self.view); QXAccountListViewController *vc = [[QXAccountListViewController alloc] init]; vc.accountList = accountList; [weakSelf.navigationController pushViewController:vc animated:YES]; }else{ QXLoginModel *model = accountList.firstObject; [weakSelf accountLoginWithUser_login:model.user_id]; } } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { hideLoadingInView(self.view); showToast(msg); }]; } -(void)accountLoginWithUser_login:(NSString*)user_login{ MJWeakSelf [QXLoginNetwork loginAccountWithUser_login:user_login successBlock:^(QXLoginModel * _Nonnull loginModel) { hideLoadingInView(self.view); [[NSUserDefaults standardUserDefaults] setInteger:loginModel.is_can_chat forKey:kIsCanChat]; [[NSUserDefaults standardUserDefaults] setObject:loginModel.can_chat_money forKey:kIsCanChatMoney]; [[NSUserDefaults standardUserDefaults] synchronize]; [[QXGlobal shareGlobal] saveLoginData:[loginModel yy_modelToJSONString]]; AppDelegate *delegate = (AppDelegate*)[UIApplication sharedApplication].delegate; [delegate tencentLogin]; if ([loginModel.sex isEqualToString:@"0"]) { // 没有完善个人信息 QXFillUserInfoViewController *fillVC = [[QXFillUserInfoViewController alloc] init]; [weakSelf.navigationController pushViewController:fillVC animated:YES]; }else{ [weakSelf.navigationController dismissViewControllerAnimated:YES completion:^{ QXGlobal.shareGlobal.isShowLoginVC = NO; }]; } } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { hideLoadingInView(self.view); }]; } #pragma mark - QXLoginTextFieldDelegate -(void)didClickSendCode:(UIButton *)sender{ if (self.accountTextField.textField.text.length < 11) { showToast(QXText(@"请输入正确的手机号码")); return; } MJWeakSelf [QXLoginNetwork getSmscodeWithMobile:self.accountTextField.textField.text type:GetSmscodeTypeLogin successBlock:^(id _Nonnull responseObject) { [weakSelf.codeTextField startTimeDown]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { }]; } @end