本文主要是介绍iOS工作记录11:提现功能 绑定淘宝账号功能,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
//只能提供给看得懂代码的人看,希望有帮助
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = @"我";
//显示基本信息MyAccountView--》为自定义View你们可以自己定义
self.accountView = [[MyAccountView alloc] initWithFrame:CGRectMake(0, 64, VIEW_WIDTH, 210)];
_accountView.backgroundColor = PRICE_TINTCOLOR;
[self.view addSubview:_accountView];
self.manager = [[DataRequestManager alloc] init];//初始化网络请求请求调用方法
_manager.delegate = self;
//提现按钮
[_accountView.getCashButton addTarget:self action:@selector(getCash) forControlEvents:UIControlEventTouchUpInside];
}
//提现按钮
- (void)getCash
{
if ([_numberTextFiled.text isEqual: @""] || [_apilyTextFiled.text isEqual: @""]) {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"支付宝账号和提现金额都不能为空哦" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
return;
}
if ([_numberTextFiled.text floatValue] > [_residueLabel.text floatValue]) {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"余额不足哦" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
return;
}
if (![_defaults objectForKey:@"apilyNum"]) {
[_defaults setObject:_apilyTextFiled.text forKey:@"apilyNum"];
[_defaults synchronize];
}
if (![_apilyTextFiled.text isEqualToString:[_defaults objectForKey:@"apilyNum"]]){
[_defaults setObject:_apilyTextFiled.text forKey:@"apilyNum"];
NSDictionary * dic = @{@"openid": USER_ID, @"alipay": _apilyTextFiled.text};
[_manager methodPostWithURL:ALIPAY parameters:dic];
return;
}
if ([_apilyTextFiled.text isEqualToString:[_defaults objectForKey:@"apilyNum"]]){
NSDictionary * dic = @{@"openid": USER_ID, @"credits": [NSNumber numberWithInt:[_numberTextFiled.text floatValue] * 100]};
[_manager methodPostWithURL:WITHDRAWAL parameters:dic];
}
}
这篇关于iOS工作记录11:提现功能 绑定淘宝账号功能的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!