发送短信验证码

// 短信验证码倒计时,aSecond参数表示总计倒计时多少秒
- (void)setButtonTimeVaule:(NSString* )aSecond {
   
int iSecond = aSecond.intValue;
   
buttonGetVericationCode.backgroundColor = [UIColor lightGrayColor];
   
buttonGetVericationCode.enabled = NO;
   
buttonGetVericationCode.titleLabel.text = [NSString stringWithFormat:@"倒计时%@", aSecond];
    [
buttonGetVericationCode setTitle:[NSString stringWithFormat:@"倒计时%@", aSecond] forState:UIControlStateNormal];
   
   
if (--iSecond < 0) {
       
buttonGetVericationCode.backgroundColor = TITLE_COLOR;
       
buttonGetVericationCode.enabled = YES;
       
buttonGetVericationCode.titleLabel.text = @"获取验证码";
        [
buttonGetVericationCode setTitle:@"获取验证码" forState:UIControlStateNormal];
       
return;
    }
    [
self performSelector:@selector(setButtonTimeVaule:) withObject:[NSString stringWithFormat:@"%d", iSecond] afterDelay:1.0f];
}

// 获取短信验证码 和 验证码确定提交 通过block传给弹框层view
if ([UserInfoModel currentUser].Mobile.intValue == 0) {
       
ResumeRetrievalView* viewRetrieval = [[ResumeRetrievalView alloc] init];
        [viewRetrieval
animatedIn];
       
       
__block ResumeRetrievalView* TmpRetrieval = viewRetrieval;
       
       
//获取验证码
        viewRetrieval.
ResumeRetrievalGetVaildCodeBlock = ^(NSString* aMobile) {
            [
self startLoading];
               
NSDictionary * dic = @{@"MemberId":[UserInfoModel currentUser].MemberId,
                                      
@"Mobile":aMobile};
            __block NSString* sMobile = aMobile;
                // 调用获取验证码的接口
                [WWInterface GetVerifyCode:dic result:^(WWServiceResponse *response, NSError *error)                 {
                    [self stopLoading];
                   
if (response != nil) {
                        if ([self responseState:response error:error]) {
                            // 将发送验证码的号码保存起来
                            TmpRetrieval.sVaildMobile = sMobile;
                            [TmpRetrieval
setButtonTimeVaule:@"120"];
                        }
                    }
else{
                        [
self showError:error];
                    }
                }];
        };
       
//确定提交
        viewRetrieval.
ResumeRetrievalConfirmBlock = ^(NSString* aMobile, NSString* aCode) {
            [
self startLoading];
            [
WWInterface PostUserTel:[UserInfoModel currentUser].MemberId Mobile:aMobile VaildCode:aCode result:^(WWServiceResponse *response, NSError *error) {
                [
self stopLoading];
               
if (response != nil) {
                    if ([self responseState:response error:error]) {
                     // 验证码提交之后,将手机号码信息进行归档
                        [ UserInfoModel currentUser ]. Mobile = [ NSNumber numberWithDouble :aMobile. doubleValue ];
                        [UserInfoModel syncCurrentUserToDisk];
                        [TmpRetrieval
animatedOut];
                       
ResumeSearchItemModel* dataItem = dataModel.arrayResumeInfo[aIndex];
                       
PayResumeViewController* viewController = [[PayResumeViewController alloc] init];
                        viewController.
sResumeId = dataItem.ResumeId;
                       
                       
if ([sSearchType isEqualToString:@"传统算法"])
                            viewController.
sType = @"1";
                       
else if ([sSearchType isEqualToString:@"VIP算法"])
                            viewController.
sType = @"0";
                        [
self.navigationController pushViewController:viewController animated:YES];
                    }
                }
else{
                    [
self showError:error];
                }
            }];
        };
       
return;
    }
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值