123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488 |
- //
- // YOUPAIXRWalletVC.m
- // VQU
- //
- // Created by 肖浩然的mac on 2021/7/29.
- // Copyright © 2021 leo. All rights reserved.
- //
- #import "YOUPAIXRWalletVC.h"
- #import "YOUPAILCRechargeModel.h"
- //#import "YOUPAILCIAPHelper.h"
- #import "YOUPAILCBillDetailVC.h"
- //#import <AlibabaSDK/AlibabaSDK.h>
- //#import "WXApi.h"
- #import "YOUPAIZYRechargeBtn.h"
- #import "UIViewController+TFPresent.h"
- //#import "WXApiObject.h"
- #import "SDCycleScrollView.h"
- #import "YOUPAILCFirstRechargeModel.h"
- #import "UIViewController+TFPresent.h"
- #import "YOUPAIHRBillDetailVC.h"
- #import "IPAManager.h"
- static CGFloat const BANNER_HEIGHT = 173.0f;
- @interface YOUPAIXRWalletVC ()<SDCycleScrollViewDelegate,UITextViewDelegate>
- @property(nonatomic,strong)UILabel* youpaiprechargeTotalLabel;
- @property(nonatomic,strong)UIView* youpaiprechargeView;
- @property(nonatomic,strong)NSMutableArray* youpaipgoodList;
- @property(nonatomic,strong)YOUPAILCRechargeModel* youpaipcurrentModel;
- @property(nonatomic,strong)NSMutableArray* youpaipbtnArray;
- @property(nonatomic,strong)UIButton* youpaipbuyBtn;
- @property(nonatomic,strong)UIScrollView* youpaipscrollView;
- @property(nonatomic,strong)SDCycleScrollView* youpaipSDCscrollView;
- //@property(nonatomic,strong)UIView* scrollBkgView;
- @property(nonatomic,strong)UIButton* youpaipcancelBtn;
- @property (strong, nonatomic) YOUPAILCFirstRechargeModel *youpaipfirstRechargeModel;
- @property (nonatomic, strong) NSString *youpaipwx_official; // 公众号
- @property (nonatomic, strong) NSString *youpaiprecharge_agreement; // 相语欢颜充值服务协议
- @property (nonatomic, strong) NSString *youpaipjuvenile_protection; // 相语欢颜未成年人保护计划
- @end
- @implementation YOUPAIXRWalletVC
- - (void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
- [self youpaifinitDataWithType:2];
- }
- - (UIScrollView *)youpaipscrollView{
- if (!_youpaipscrollView) {
- _youpaipscrollView = [[UIScrollView alloc]initWithFrame:self.view.bounds];
- _youpaipscrollView.scrollEnabled = YES;
- _youpaipscrollView.pagingEnabled = NO;
- _youpaipscrollView.bounces = YES;
- _youpaipscrollView.showsVerticalScrollIndicator = NO;
- _youpaipscrollView.showsHorizontalScrollIndicator = NO;
- _youpaipscrollView.backgroundColor = [UIColor whiteColor];
- }
- return _youpaipscrollView;
- }
- -(void)viewWillDisappear:(BOOL)animated{
- [super viewWillDisappear:animated];
-
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- [UMengRecordTool umengEventCountWithId:EnterRechargePage];
- self.youpaipbtnArray = [NSMutableArray array];
- self.title = @"账户余额";
- [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(youpaifApplePaySuccess:) name:@"yqApplePaySuccess" object:nil];
- [self youpaifloadFirstRecharge];
- [self youpaifsetupUI];
- [self youpaifrequestWalleetInfo];
- }
- -(void)youpaifsetupUI{
-
- [self.view addSubview:self.youpaipscrollView];
- self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifrechargeRecordAction) title:LCStr(word5) font:LCFont14 titleColor:LZA3AABEColor highlightedColor:LZA3AABEColor titleEdgeInsets:UIEdgeInsetsZero];//收支明细
-
- // 充值
- UIImageView *rechargeV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_P_wallet_profit_bg"]];
- [self.youpaipscrollView addSubview:rechargeV];
- [rechargeV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.offset(13.0f+NavBarHeight);
- make.left.offset(14);
- make.width.offset(KScreenWidth - 28.0f);
- make.height.offset(BANNER_HEIGHT - 26.0f);
- }];
-
-
- UILabel *rechargeDescL = [[UILabel alloc] init];
- rechargeDescL.font = LCFont14;
- rechargeDescL.text = @"我的钻石";
- rechargeDescL.textColor = [UIColor whiteColor];
- [rechargeV addSubview:rechargeDescL];
- [rechargeDescL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(ScaleSize(28.0f));
- make.top.offset(25.5f);
- }];
-
- UILabel *rechargeL = [[UILabel alloc] init];
- rechargeL.font = LZDinFont(36.0f);
- rechargeL.text = @"0";
- rechargeL.textColor = [UIColor whiteColor];
- [rechargeV addSubview:rechargeL];
- self.youpaiprechargeTotalLabel = rechargeL;
- [rechargeL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(ScaleSize(28.0f));
- make.top.equalTo(rechargeDescL.mas_bottom).offset(16.0f);
- }];
- UILabel *labe1 = [[UILabel alloc] init];
- [self.youpaipscrollView addSubview:labe1];
- [labe1 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(rechargeV.mas_bottom).offset(19);
- make.left.mas_equalTo(14);
-
- }];
- labe1.text = @"请选择充值钻石:";
- labe1.textColor = LZA3AABEColor;
- labe1.font = LCFont(12);
-
- self.youpaiprechargeView = [[UIView alloc] init];
- [self.youpaipscrollView addSubview:self.youpaiprechargeView];
- [self.youpaiprechargeView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(14);
- make.width.mas_equalTo(KScreenWidth - 28.0f);
- make.top.mas_equalTo(labe1.mas_bottom).offset(12);
- make.height.mas_equalTo(400);
- }];
- NSMutableAttributedString *str = [[NSMutableAttributedString alloc]initWithString:@""];
- if (![LCSaveData getWhiteVersion]) {
- NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
- [paragraphStyle setLineSpacing:6];
- NSString *text = @"1、充值即代表已阅读并同意《相语欢颜充值服务协议》\n2、关注“相语欢颜交友”公众号,领取惊喜礼包 复制公众号\n3、前往收支记录,可查询充值订单详情和消费详情\n4、禁止未成年人进行充值,点击详见《相语欢颜未成年人保护计划》\n5、在充值过程中如遇任何问题,可联系官方客服";
- str = [[NSMutableAttributedString alloc]initWithString:text];
-
- [str addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [text length])];
-
- [str addAttribute:NSLinkAttributeName value:@"rechargeProtocol://" range:[text rangeOfString:@"《相语欢颜充值服务协议》"]];
- [str addAttribute:NSLinkAttributeName value:@"officialAccount://" range:[text rangeOfString:@"复制公众号"]];
- [str addAttribute:NSLinkAttributeName value:@"youngProtect://" range:[text rangeOfString:@"《相语欢颜未成年人保护计划》"]];
- }
-
-
- UITextView * textview = [[UITextView alloc]init];
- textview.editable = NO;
- textview.scrollEnabled = NO;
- textview.delegate = self;
- textview.backgroundColor = [UIColor clearColor];
- textview.font = LCFont(10);
- textview.attributedText = str;
- textview.textColor = LZA3AABEColor;
- // textview.textAlignment = NSTextAlignmentCenter;
- textview.linkTextAttributes = @{NSForegroundColorAttributeName:LZ7C69FEColor,
- NSUnderlineStyleAttributeName:[NSNumber numberWithInt:NSUnderlineStyleNone]
- };
- [self.youpaipscrollView addSubview:textview];
- [textview mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(14);
- make.width.mas_equalTo(KScreenWidth - 28.0f);
- make.top.mas_equalTo(self.youpaiprechargeView.mas_bottom).offset(20.0f);
- make.height.offset(130.0f);
- }];
-
- UIButton* buyBtn = [[UIButton alloc]init];
- [self.view addSubview:buyBtn];
- [buyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.equalTo(-SafeHeight-10);
- make.size.mas_equalTo(CGSizeMake(KScreenWidth-120, 48));
- make.centerX.mas_equalTo(0);
- }];
- buyBtn.userInteractionEnabled = NO;
- buyBtn.backgroundColor = LCGray;
- buyBtn.layer.cornerRadius = 24.0;
- buyBtn.layer.masksToBounds = YES;
- buyBtn.titleLabel.font = LCFont17;
- [buyBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
- [buyBtn setTitle:@"立即充值" forState:(UIControlStateNormal)];
- [buyBtn addTarget:self action:@selector(youpaifbuyBtnClick) forControlEvents:(UIControlEventTouchUpInside)];
- self.youpaipbuyBtn = buyBtn;
-
-
- // NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithObject:LCFont(10.0f) forKey:NSFontAttributeName];
- // CGSize size = [textview.text boundingRectWithSize:CGSizeMake(MAXFLOAT, 10.0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil].size;
- // UIView *xiyiBgView = [UIView new];
- // [self.view addSubview:xiyiBgView];
- // [xiyiBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.width.mas_equalTo(size.width+45);
- // make.centerX.mas_equalTo(0);
- // make.bottom.mas_equalTo(self.view.bottom).offset(-40);
- // make.height.mas_equalTo(@30);
- // }];
- // [xiyiBgView addSubview:textview];
-
- CGFloat contentHeight = CGRectGetMaxY(_youpaiprechargeView.frame) + 100 + 90 + SafeHeight;
- contentHeight = contentHeight > KScreenHeight - NavBarHeight + 68.0f ? contentHeight : KScreenHeight - NavBarHeight + 68.0f;
- self.youpaipscrollView.contentSize = CGSizeMake(0,contentHeight);
- SDCycleScrollView *bannerView1 = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(KScreenWidth - 12.0f - 49.0f, KScreenHeight - 12.0f - 49.0f - SafeHeight - 50.0f, 50, 50.0f) delegate:self placeholderImage:[UIImage imageNamed:@""]];
- self.youpaipSDCscrollView = bannerView1;
-
- bannerView1.bannerImageViewContentMode = UIViewContentModeScaleAspectFit;
- bannerView1.autoScrollTimeInterval = 3.0;//2s轮播
- bannerView1.pageControlStyle = SDCycleScrollViewPageContolStyleNone;
- bannerView1.backgroundColor = [UIColor clearColor];
- [self.view addSubview:bannerView1];
-
- }
- #pragma mark --UITextViewDelegate
- - (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange interaction:(UITextItemInteraction)interaction{
-
- if ([[URL scheme]isEqualToString:@"rechargeProtocol"]) {// 进入《流光花舞充值服务协议》
- ZCBaseWebVC * vc = [[ZCBaseWebVC alloc]init];
- vc.contentUrl = self.youpaiprecharge_agreement;
- [self.navigationController pushViewController:vc animated:YES];
- return NO;
- }
- if ([[URL scheme]isEqualToString:@"officialAccount"]) {// 复制公众号
- UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
- pasteboard.string = self.youpaipwx_official;
- [ZCHUDHelper showTitle:@"复制成功"];
- return NO;
- }
-
- if ([[URL scheme]isEqualToString:@"youngProtect"]) {// 进入《相语欢颜未成年人保护计划》
- ZCBaseWebVC * vc = [[ZCBaseWebVC alloc]init];
- vc.contentUrl = self.youpaipjuvenile_protection;
- [self.navigationController pushViewController:vc animated:YES];
- return NO;
- }
- return YES;
- }
- #pragma mark - SDCycleScrollViewDelegate
- - (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
- {
- YOUPAILCBannerModel* model = self.youpaipfirstRechargeModel.youpaiplist[index];
- if (model.youpaiplink_type==1) {
- ZCBaseWebVC* baseWeb = [[ZCBaseWebVC alloc]init];
- baseWeb.contentUrl = model.youpaiplink_url;
- [self.navigationController pushViewController:baseWeb animated:YES];
- }else if (model.youpaiplink_type==2||model.youpaiplink_type==3){
- [self youpaifpageToStr:model.youpaiplink_url];
- }
- }
- -(void)youpaifloadFirstRecharge{
- [LCHttpHelper requestWithURLString:GetAdvert parameters:@{@"position":@"2"} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- self.youpaipfirstRechargeModel = [YOUPAILCFirstRechargeModel mj_objectWithKeyValues:dict[@"data"]];
-
- NSMutableArray *imgUrlArray = [NSMutableArray new];
- for (YOUPAILCBannerModel* model in self.youpaipfirstRechargeModel.youpaiplist) {
- [imgUrlArray addObject:[LCTools getImageUrlWithAddress:model.youpaipimage]];
- }
-
- self.youpaipSDCscrollView.imageURLStringsGroup = imgUrlArray;
- if (self.youpaipfirstRechargeModel.youpaipis_open == 1) {
- self.youpaipSDCscrollView.hidden = NO;
-
- }else{
- self.youpaipSDCscrollView.hidden = YES;
-
- }
- }
- } failure:^(NSError *error) {}];
-
- }
- -(void)youpaifbuyBtnClick{
- [self applePay];
- }
- - (void)applePay{
- self.youpaipbuyBtn.userInteractionEnabled = NO;
- /// 内购
- [ZCHUDHelper showWithStatus:@"支付中..."];
- NSLog(@"%@",self.youpaipcurrentModel.youpaipios_product_id);
- [[IPAManager shareIAPManager] startPurchWithID:self.youpaipcurrentModel.youpaipios_product_id completeHandle:^(IAPPurchType type, NSString *data) {
-
- NSLog(@"type = %ld",type);
- if (type == IAPPurchSuccess) {
- [LCSaveData saveReceiptData:data];
- [self requestApplePayBack:data];
- }else{
- dispatch_async(dispatch_get_main_queue(), ^{
- self.youpaipbuyBtn.userInteractionEnabled = YES;
- });
- NSString *title = @"";
- switch (type) {
- case IAPPurchFailed:
- title = @"购买失败";
- break;
- case IAPPurchCancle:
- title = @"已取消购买";
- break;
- case IAPPurchVerFailed:
- title = @"订单校验失败";
- break;
- // case IAPPurchVerSuccess:
- // NSLog(@"订单校验成功");
- // break;
- case IAPPurchNotArrow:
- title = @"不允许程序内付费";
- break;
- default:
- break;
- }
- if (title.length == 0) {
- [ZCHUDHelper dismiss];
- }else{
- [ZCHUDHelper showTitle:title];
- }
- }
- }];
- }
- - (void)requestApplePayBack:(NSString *)receipt_data{
-
- [LCHttpHelper requestWithURLString:ApplePayBack parameters:@{@"receipt_data":receipt_data} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- dispatch_async(dispatch_get_main_queue(), ^{
- self.youpaipbuyBtn.userInteractionEnabled = YES;
- });
- if (code == 0) {
- [LCSaveData removeReceiptData:receipt_data];
- NSInteger type = 4;
- // if (![LCSaveData getOnlineVersion]) {
- // type = 4;
- // }
- [self youpaifinitDataWithType:type];
- // if (self.paySuccessBlock != nil) {
- // self.paySuccessBlock();
- // }
- }
- [ZCHUDHelper showTitle:[dict objectForKey:@"message"]];
- } failure:^(NSError *error) {
- dispatch_async(dispatch_get_main_queue(), ^{
- self.youpaipbuyBtn.userInteractionEnabled = YES;
- });
- [ZCHUDHelper showTitle:error.localizedDescription];
- }];
- }
- -(void)youpaifrechargeRecordAction
- {
- YOUPAIHRBillDetailVC *vc = [YOUPAIHRBillDetailVC new];
- vc.youpaipcate_id = 1;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)youpaifupdateView{
-
-
- if (self.youpaipbtnArray.count>0) {
- for (YOUPAIZYRechargeBtn* btn in self.youpaipbtnArray) {
- [btn removeFromSuperview];
- }
- }
- [self.youpaipbtnArray removeAllObjects];
-
- for (UIView *view in self.youpaiprechargeView.subviews) {
- [view removeFromSuperview];
- }
-
- CGFloat space = ScaleSize(6.0f);
- CGFloat width = (KScreenWidth - 24.0f - space) / 2.0f;
- CGFloat height = ScaleSize(74.0f);
-
- CGFloat rechargeViewHeight = 0.0f;
- for (NSInteger i = 0; i<self.youpaipgoodList.count; i++) {
- YOUPAILCRechargeModel* model = self.youpaipgoodList[i];
- model.youpaipreward = model.youpaipreward.length == 0 ? @"0" : model.youpaipreward;
-
- NSInteger col = i % 2;
- NSInteger row = i / 2;
-
- YOUPAIZYRechargeBtn* btn = [[YOUPAIZYRechargeBtn alloc]initWithFrame:CGRectMake(col * width + col * space, row * height + row * space,width,height) model:model];
- btn.layer.cornerRadius = ScaleSize(6.0f);
- btn.layer.borderWidth = ScaleSize(1.0f);
- btn.layer.borderColor = LZF5F4F7Color.CGColor;
-
- btn.youpaippriceLabel.text = [NSString stringWithFormat:@"¥%@",model.youpaipprice];
-
- NSString *amountText = [NSString stringWithFormat:@"%@钻石",model.youpaipamount];
- NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:amountText];
- NSRange range = NSMakeRange(model.youpaipamount.length, 2);
- [attrStr addAttribute:NSFontAttributeName value:LCFont(ScaleSize(14.0f)) range:range];
- [attrStr addAttribute:NSForegroundColorAttributeName value:LZ273145Color range:range];
- btn.youpaipgoodLabel.attributedText = attrStr.copy;
-
- if (model.youpaipbtn_text.count != 0) {
- btn.youpaipgiveLabel.text = model.youpaipbtn_text[0];
- }
-
- [btn addTarget:self action:@selector(youpaifrechargeBtnClick:) forControlEvents:(UIControlEventTouchUpInside)];
- [self.youpaiprechargeView addSubview:btn];
- [self.youpaipbtnArray addObject:btn];
-
- if (i==1) {
- [self youpaifrechargeBtnClick:btn];
- }
- rechargeViewHeight = CGRectGetMaxY(btn.frame);
- }
-
- // CGRect rechargeRect = self.rechargeView.frame;
- // rechargeRect.size.height = rechargeViewHeight;
- // self.rechargeView.frame = rechargeRect;
- [self.youpaiprechargeView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(rechargeViewHeight);
- }];
-
- // [self.buyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.top.mas_equalTo(self.rechargeView.mas_bottom).offset(35);
- // make.size.mas_equalTo(CGSizeMake(KScreenWidth-120, 48));
- // make.centerX.mas_equalTo(0);
- // }];
- [self.view layoutIfNeeded];
- CGFloat contentHeight = CGRectGetMaxY(_youpaiprechargeView.frame) + 100 + 90 + SafeHeight;
- contentHeight = contentHeight > KScreenHeight - NavBarHeight + 68.0f ? contentHeight : KScreenHeight - NavBarHeight + 68.0f;
- self.youpaipscrollView.contentSize = CGSizeMake(0,contentHeight);
- }
- - (void)youpaifrechargeBtnClick:(YOUPAIZYRechargeBtn*)reBtn{
- self.youpaipcurrentModel = reBtn.youpaipreModel;
- [self.youpaipbuyBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(KScreenWidth-120, 48) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:(GradientLeftToRight)] forState:(UIControlStateNormal)];
- self.youpaipbuyBtn.userInteractionEnabled = YES;
-
- for (YOUPAIZYRechargeBtn* btn in self.youpaipbtnArray) {
- btn.layer.cornerRadius = ScaleSize(6.0f);
- btn.layer.borderWidth = ScaleSize(1.0f);
- btn.layer.borderColor = LZF5F4F7Color.CGColor;
- btn.selected = NO;
-
- btn.youpaipgoodLabel.textColor = LZ273145Color;
- btn.youpaipgiveLabel.textColor = LZA3AABEColor;
- btn.youpaippriceLabel.textColor = LZA3AABEColor;
- }
-
- reBtn.layer.cornerRadius = ScaleSize(6.0f);
- reBtn.layer.borderWidth = ScaleSize(1.5f);
- reBtn.layer.borderColor = LZ7C69FEColor.CGColor;
- reBtn.selected = YES;
-
- reBtn.youpaipgoodLabel.textColor = LZ7C69FEColor;
- reBtn.youpaipgiveLabel.textColor = LZ7C69FEColor;
- reBtn.youpaippriceLabel.textColor = LZ273145Color;
-
- }
- #pragma mark - Request
- - (void)youpaifrequestWalleetInfo{
- @weakify(self);
- [LCHttpHelper requestWithURLString:WalletInit parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- @strongify(self);
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- // CGFloat incomeCoin = [[[[dict objectForKey:@"data"]objectForKey:@"account"]objectForKey:@"income_coin"] floatValue];
- self.youpaipwx_official = [[[dict objectForKey:@"data"]objectForKey:@"webUrl"]objectForKey:@"wx_official"];
- self.youpaipjuvenile_protection = [[[dict objectForKey:@"data"]objectForKey:@"webUrl"]objectForKey:@"juvenile_protection"];
- self.youpaiprecharge_agreement = [[[dict objectForKey:@"data"]objectForKey:@"webUrl"]objectForKey:@"recharge_agreement"];
- }
- } failure:^(NSError *error) {
-
- }];
- }
- - (void)youpaifinitDataWithType:(NSInteger)type{
- [LCHttpHelper requestWithURLString:WalletGoodList parameters:@{@"type":@(type)} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- self.youpaiprechargeTotalLabel.text = [NSString stringWithFormat:@"%.0f",[[[dict objectForKey:@"data"]objectForKey:@"coin"]floatValue]];
-
- self.youpaipgoodList = [YOUPAILCRechargeModel mj_objectArrayWithKeyValuesArray:[[dict objectForKey:@"data"]objectForKey:@"list"]];
- [self youpaifupdateView];
-
- }
- } failure:^(NSError *error) {
-
- }];
- }
- - (void)youpaifApplePaySuccess:(NSNotification*)noti{
- [self youpaifinitDataWithType:4];
- }
- @end
|