// // YOUPAIBBProfileVC.m // VQU // // Created by Elaine on 2021/10/19. // Copyright © 2021 MS. All rights reserved. // #import "YOUPAIBBProfileVC.h" #import "YOUPAIBBProfileHeaderView.h" #import "YOUPAILZProfileMenuItemCell.h" #import "YOUPAILZUnionsPopularizeVC.h" #import "YOUPAILCIMSessionVC.h" #import "YOUPAILCVerifyBigCastVC.h" #import "YOUPAILCBigCastSetVC.h" #import "LPBeautySetVC.h" #import "YOUPAILZVipVC.h" #import "YOUPAILPYoungSettingVC.h" #import "YOUPAIBBSettingVC.h" #import "YOUPAILZGameListVC.h" #import "YOUPAILZGameAccompanyListVC.h" #import #import "YOUPAIXRWalletVC.h" #import "YOUPAILZPersonalizedDressVC.h" #import "YOUPAIBBBaseBackpackVC.h" #import "YOUPAILZBadgeVC.h" #import "YOUPAILCNewChatNoticationVC.h" #import "YOUPAILCBlackListVC.h" #import "YOUPAIBBReceiveGiftVC.h" #import "YOUPAIHRsendRankVC.h" #import "YOUPAIHRGuildCenterSearchVC.h" #import "YOUPAIHRGuildCenterDetailVC.h" #import "YOUPAILCSettingVC.h" #import "YOUPAILZLiveVerifyResultVC.h" #import "YOUPAIRealPersonFaceVC.h" #import #import "YOUPAILCUploadCameraAuditVC.h" #define kHeaderViewHeight (206.0f + NavBarHeight) @interface YOUPAIBBProfileVC () @property (nonatomic, weak) UITableView* youpaiptableView; @property (nonatomic, strong) NSMutableArray *youpaipdataSource; @property (nonatomic, strong) YOUPAIBBProfileHeaderView *youpaipheaderView; @property (nonatomic, weak) UIImageView *youpaipavatarImgV; @property (nonatomic, strong) NSString *youpaipweiguiUrl; @property (nonatomic, strong) NSString *youpaipinviteUrl; @property(nonatomic,assign)NSInteger youpaipguild;//0:未加入公会;1:已加入公会;2:已加入公会会长 @end @implementation YOUPAIBBProfileVC - (void)dealloc{ [[NSNotificationCenter defaultCenter] removeObserver:self]; } - (void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [self.navigationController setNavigationBarHidden:YES animated:animated]; } - (void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; if ([LCSaveData getIsspecial]== NO && [LCSaveModel getUserModel].youpaipuserinfo.youpaipgender ==1){ [self youpaifcheckSetting]; } [self youpaifrefreshData]; } - (void)viewWillDisappear:(BOOL)animated{ [super viewWillDisappear:animated]; [self.navigationController setNavigationBarHidden:NO animated:animated]; } - (void)viewDidLoad { [super viewDidLoad]; [self youpaifinitUI]; } - (void)youpaifreloadDataSource{ self.youpaipdataSource = [NSMutableArray array]; YOUPAILCBaseInfo *userinfo = [LCSaveModel getUserModel].youpaipuserinfo; NSString *vip_des = userinfo.youpaipvip_des; NSString *badgeCount ; if (userinfo.youpaipbadge_all.count>0) { badgeCount = [NSString stringWithFormat:@"我的勋章(%ld)",userinfo.youpaipbadge_all.count]; }else{ badgeCount = [NSString stringWithFormat:@"我的勋章"]; } // // 勿扰模式 // [self.dataSource addObject:@{ // @"type":@"mine_darao", // @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_mine_darao"], // @"title":@"勿扰模式", // @"accessoryType":@(LZTableViewCellAccessorySwitch), // @"rightText":@"", // @"subTitle":[LCSaveModel getUserModel].userinfo.is_anchor == 1 ? @"(开启后用户将无法给你拨打视频)" : @"(开启后女神不可群发打招呼给你)", // }]; // 我的勋章 // [self.youpaipdataSource addObject:@{ // @"type":@"my_badge", // @"image":[UIImage imageNamed:@"vqu_images_ic_profile_bedge"], // @"title":badgeCount, // @"accessoryType":@(LZTableViewCellAccessoryRightImage), // @"rightText":@"", // }]; // 会员权益 [self.youpaipdataSource addObject:@{ @"type":@"vip", @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_vip"], @"title":@"贵族中心", @"accessoryType":@(LZTableViewCellAccessoryRightTitle), @"rightText":vip_des, }]; // [self.youpaipdataSource addObject:@{ // @"type":@"gift", // @"image":[UIImage imageNamed:@"vqu_images_sendRank"], // @"title":@"我的礼物", // @"accessoryType":@(LZTableViewCellAccessoryRightTitle), // @"rightText":@"", // }]; //我的认证 [self.youpaipdataSource addObject:@{ @"type":@"my_face", @"image":[UIImage imageNamed:@"vqu_images_my_face"], @"title":@"我的认证", @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator), @"rightText":@"", }]; //公会中心 // [self.youpaipdataSource addObject:@{ // @"type":@"guild", // @"image":[UIImage imageNamed:@"vqu_images_mine_guild"], // @"title":@"公会中心", // @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator), // @"rightText":@"", // }]; // 个性装扮 // [self.youpaipdataSource addObject:@{ // @"type":@"personalizedDress", // @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_personalized_dress"], // @"title":@"个性装扮", // @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator), // @"rightText":@"", // }]; //我的背包 [self.youpaipdataSource addObject:@{ @"type":@"mine_beibao", @"image":[UIImage imageNamed:@"vqu_images_my_backpack"], @"title":@"我的背包", @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator), @"rightText":@"", }]; // 女神认证 // if (userinfo.gender == 1) { //女 // NSString *title = @""; // if (userinfo.is_anchor == 0) { // title = @"成为女神"; // }else{ // title = @"女神设置"; // } // // 女神认证 // [self.dataSource addObject:@{ // @"type":@"big_cast", // @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_NvShen"], // @"title":title, // @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator), // @"rightText":@"", // }]; // } // 美颜设置 [self.youpaipdataSource addObject:@{ @"type":@"beauty_set", @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_beauty_set"], @"title":@"美颜设置", @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator), @"rightText":@"", }]; // // 邀请有奖 // if ([LCSaveData getOnlineVersion]) { // [self.dataSource addObject:@{ // @"type":@"invite", // @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_invite"], // @"title":@"邀请有奖", // @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator), // @"rightText":@"", // }]; // } // // 推广制度 // [self.dataSource addObject:@{ // @"type":@"unions", // @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_unions"], // @"title":@"推广制度", // @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator), // @"rightText":@"", // }]; // 违规公布 [self.youpaipdataSource addObject:@{ @"type":@"weiguigongbu", @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_weiguigongbu"], @"title":@"违规公布", @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator), @"rightText":@"", }]; // 在线客服 [self.youpaipdataSource addObject:@{ @"type":@"im_service", @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_im_service"], @"title":@"在线客服", @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator), @"rightText":@"", }]; // //黑名单 // [self.youpaipdataSource addObject:@{ // @"type":@"BlackList", // @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_set"], // @"title":@"黑名单", // @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator), // @"rightText":@"", // }]; // // // //消息通知 // [self.youpaipdataSource addObject:@{ // @"type":@"ChatNotication", // @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_set"], // @"title":@"消息通知", // @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator), // @"rightText":@"", // }]; // 使用帮助 // if (userinfo.youpaipgender==1) { //女 // [self.youpaipdataSource addObject:@{ // @"type":@"help", // @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_beauty_set"], // @"title":@"使用帮助", // @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator), // }]; // } // 青少年模式 // if (userinfo.youpaipgender != 1) { //男 // [self.youpaipdataSource addObject:@{ // @"type":@"vqu_images_ic_my_young", // @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_Young"], // @"title":@"青少年模式", // @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator), // @"rightText":@"", // }]; // } // 设置 [self.youpaipdataSource addObject:@{ @"type":@"set", @"image":[UIImage imageNamed:@"vqu_images_P_mine_Set"], @"title":@"设置", @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator), @"rightText":@"", }]; [self.youpaiptableView reloadData]; } - (void)youpaifinitUI{ UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectMake(0,0, KScreenWidth, KScreenHeight-TabbarHeight) style:UITableViewStyleGrouped]; tableView.showsVerticalScrollIndicator = NO; tableView.separatorStyle = UITableViewCellSeparatorStyleNone; tableView.backgroundColor = [UIColor clearColor]; tableView.dataSource = self; tableView.delegate = self; [self.view addSubview:tableView]; self.youpaiptableView = tableView; UIImageView *youpaipavatarImgV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kHeaderViewHeight)]; youpaipavatarImgV.contentMode = UIViewContentModeScaleAspectFill; youpaipavatarImgV.clipsToBounds = YES; youpaipavatarImgV.image = [UIImage imageNamed:@"vqu_images_mine_bg_top"]; [self.youpaiptableView addSubview:youpaipavatarImgV]; self.youpaipavatarImgV = youpaipavatarImgV; YOUPAIBBProfileHeaderView *youpaipheaderView = [[YOUPAIBBProfileHeaderView alloc] initWithFrame:youpaipavatarImgV.bounds]; self.youpaiptableView.tableHeaderView = youpaipheaderView; youpaipheaderView.youpaipinfoModel = [LCSaveModel getUserModel].youpaipuserinfo; self.youpaipheaderView = youpaipheaderView; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return self.youpaipdataSource.count*71+20; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return 1; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ NSString *cellID = @"YOUPAILZProfileMenuItemCell"; YOUPAILZProfileMenuItemCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; cell = [[YOUPAILZProfileMenuItemCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; @weakify(self) [cell setVqupaipDidSelectBlock:^(NSString * _Nonnull title) { @strongify(self) [self youpaifgoPageWithType:title]; }]; cell.countArr = self.youpaipdataSource; return cell; } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ return CGFLOAT_MIN; } - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ return CGFLOAT_MIN; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ NSMutableDictionary *cellData = self.youpaipdataSource[indexPath.row]; [self youpaifgoPageWithType:cellData[@"type"]]; } - (void)youpaifgoPageWithType:(NSString *)type{ if ([type isEqualToString:@"unions"]) { YOUPAILZUnionsPopularizeVC *unions = [[YOUPAILZUnionsPopularizeVC alloc]init]; [self.navigationController pushViewController:unions animated:YES]; }else if ([type isEqualToString:@"wallet"]) { YOUPAIXRWalletVC *wallet = [[YOUPAIXRWalletVC alloc]init]; [self.navigationController pushViewController:wallet animated:YES]; }else if ([type isEqualToString:@"invite"]){ // YOUPAILCInviteVC *invite = [[YOUPAILCInviteVC alloc]init]; // [self.navigationController pushViewController:invite animated:YES]; ZCBaseWebVC * vc = [[ZCBaseWebVC alloc]init]; vc.contentUrl = self.youpaipinviteUrl; [self.navigationController pushViewController:vc animated:YES]; }else if ([type isEqualToString:@"mine_beibao"]){ YOUPAIBBBaseBackpackVC *invite = [[YOUPAIBBBaseBackpackVC alloc]init]; [self.navigationController pushViewController:invite animated:YES]; }else if ([type isEqualToString:@"help"]){ NSString *urlStr; if ([LCSaveModel getUserModel].youpaipuserinfo.youpaipgender==1) { urlStr = [NSString stringWithFormat:@"%@%@",[LCSaveData getBaseURL]?[LCSaveData getBaseURL]:BaseURL,HelpBigCastH5]; }else{ urlStr = [NSString stringWithFormat:@"%@%@",[LCSaveData getBaseURL]?[LCSaveData getBaseURL]:BaseURL,HelpNormalH5]; } if([LCSaveData getIsspecial]){ urlStr = [NSString stringWithFormat:@"%@%@",[LCSaveData getBaseURL]?[LCSaveData getBaseURL]:BaseURL,HelpSpecialH5]; } ZCBaseWebVC * vc = [[ZCBaseWebVC alloc]init]; vc.contentUrl = urlStr; [self.navigationController pushViewController:vc animated:YES]; }else if ([type isEqualToString:@"im_service"]){ NIMSession *session = [NIMSession session:[LCSaveData getServerId] type:NIMSessionTypeP2P]; if (session) { @weakify(self); [ZCHUDHelper show]; [[[NIMSDK sharedSDK] userManager] fetchUserInfos:@[session.sessionId] completion:^(NSArray * _Nullable users, NSError * _Nullable error) { @strongify(self); [ZCHUDHelper dismiss]; YOUPAILCIMSessionVC *vc = [[YOUPAILCIMSessionVC alloc] initWithSession:session]; [self.navigationController pushViewController:vc animated:YES]; }]; } }else if ([type isEqualToString:@"my_face"]){ YOUPAILCBaseInfo *userinfo = [LCSaveModel getUserModel].youpaipuserinfo; if (userinfo.youpaipgender == 1){//女 if (userinfo.youpaipis_anchor ==1) { YOUPAILZLiveVerifyResultVC *vc = [[YOUPAILZLiveVerifyResultVC alloc] init]; vc.youpaipstate = LZLiveVerifyStateWithSuccess; [self.navigationController pushViewController:vc animated:YES]; }else{ [self youpaifrealNameAuthentication]; } }else{//男 if (userinfo.youpaipis_auth == 1) { YOUPAILZLiveVerifyResultVC *vc = [[YOUPAILZLiveVerifyResultVC alloc] init]; vc.youpaipstate = LZLiveVerifyStateWithSuccess; [self.navigationController pushViewController:vc animated:YES]; }else{ YOUPAIRealPersonFaceVC *vc = [YOUPAIRealPersonFaceVC new]; [self.navigationController pushViewController:vc animated:YES]; } } } else if ([type isEqualToString:@"big_cast"]){ if ([LCSaveModel getUserModel].youpaipuserinfo.youpaipis_anchor == 0) { YOUPAILCVerifyBigCastVC* verifyBigCast = [[YOUPAILCVerifyBigCastVC alloc]init]; [self.navigationController pushViewController:verifyBigCast animated:YES]; }else{ YOUPAILCBigCastSetVC* bigCast = [[YOUPAILCBigCastSetVC alloc]init]; [self.navigationController pushViewController:bigCast animated:YES]; } }else if([type isEqualToString:@"beauty_set"]){ LPBeautySetVC* beautySet = [[LPBeautySetVC alloc]init]; //modify by leo fix ios13 bug beautySet.modalPresentationStyle =0; [self.navigationController presentViewController:beautySet animated:YES completion:^{ }]; }else if([type isEqualToString:@"set"]){ YOUPAILCSettingVC* setting = [[YOUPAILCSettingVC alloc]init]; [self.navigationController pushViewController:setting animated:YES]; }else if([type isEqualToString:@"vip"]){ YOUPAILZVipVC* setting = [[YOUPAILZVipVC alloc]init]; [self.navigationController pushViewController:setting animated:YES]; }else if([type isEqualToString:@"personalizedDress"]){ YOUPAILZPersonalizedDressVC* vc = [[YOUPAILZPersonalizedDressVC alloc]init]; [self.navigationController pushViewController:vc animated:YES]; }else if([type isEqualToString:@"my_badge"]){ YOUPAILZBadgeVC *vc = [[YOUPAILZBadgeVC alloc] init]; [self.navigationController pushViewController:vc animated:YES]; }else if([type isEqualToString:@"vqu_images_ic_my_young"]){ YOUPAILPYoungSettingVC* setting = [[YOUPAILPYoungSettingVC alloc]init]; [self.navigationController pushViewController:setting animated:YES]; }else if ([type isEqualToString:@"weiguigongbu"]){ ZCBaseWebVC * vc = [[ZCBaseWebVC alloc]init]; vc.contentUrl = self.youpaipweiguiUrl; [self.navigationController pushViewController:vc animated:YES]; }else if ([type isEqualToString:@"gameCertification"]) { YOUPAILZGameListVC *vc = [[YOUPAILZGameListVC alloc] init]; [self.navigationController pushViewController:vc animated:YES]; }else if ([type isEqualToString:@"gameAccompany"]){ YOUPAILZGameAccompanyListVC *vc = [[YOUPAILZGameAccompanyListVC alloc] init]; [self.navigationController pushViewController:vc animated:YES]; }else if ([type isEqualToString:@"ChatNotication"]){ YOUPAILCNewChatNoticationVC * noti = [[YOUPAILCNewChatNoticationVC alloc]init]; [self.navigationController pushViewController:noti animated:YES]; }else if ([type isEqualToString:@"BlackList"]){ YOUPAILCBlackListVC* black = [[YOUPAILCBlackListVC alloc]init]; [self.navigationController pushViewController:black animated:YES]; }else if ([type isEqualToString:@"gift"]){ YOUPAIHRsendRankVC* black = [[YOUPAIHRsendRankVC alloc]init]; [self.navigationController pushViewController:black animated:YES]; }else if ([type isEqualToString:@"guild"]){//公会中心 if (self.youpaipguild ==0) {//0:未加入公会;1:已加入公会;2:已加入公会会长 YOUPAIHRGuildCenterSearchVC *vc = [YOUPAIHRGuildCenterSearchVC new]; [self.navigationController pushViewController:vc animated:YES]; }else{ YOUPAIHRGuildCenterDetailVC *vc = [YOUPAIHRGuildCenterDetailVC new]; vc.youpaipguild = self.youpaipguild; [self.navigationController pushViewController:vc animated:YES]; } } } /// 阿里实名认证 - (void)youpaifrealNameAuthentication{ [UCAuthorityManager cameraAuthority:^{ YMCustomCameraViewModel *customCameraVM = [[YMCustomCameraViewModel alloc]initWithParams:@{}]; [YMRouter openURL:stringFormat(@"%@%@",YM_ROUTER_URL_PREFIX,YM_ROUTER_CUSTOM_CAMERA) withUserInfo:@{ RouterViewModel:customCameraVM } completion:nil]; } denied:^{ YMTipsPopupView *customView = [[YMTipsPopupView alloc]init]; [customView configutationWithTips:@"请在iphone的“设置-隐私-相机”选项中,允许APP访问您的相机。" TipsAlignment:NSTextAlignmentCenter IsHideTitle:NO IsHideSingleButton:NO]; YMPopupView *popupView = [YMPopupView initWithCustomView:customView parentView:[YMGlobalUtils getCurrentVC].view popStyle:YMPopupStyleFade dismissStyle:YMDismissStyleFade]; popupView.priority = 999; popupView.cornerRadius = adapt(10); popupView.rectCorners = UIRectCornerAllCorners; popupView.positionStyle = YMPositionStyleCenter; popupView.isHideBg = NO; popupView.bgAlpha = 0.3; @weakify(popupView) customView.buttonBlock = ^(BOOL isConfirm) { @strongify(popupView) if (isConfirm) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil]; } [popupView dismissWithStyle:YMDismissStyleFade duration:2.0]; }; [popupView pop]; }]; // WeakSelf; // [LCHttpHelper requestWithURLString:GetLiveVerifyToken parameters:@{} needToken:YES type:HttpRequestTypePost success:^(id responseObject) { // NSDictionary* dict = (NSDictionary*)responseObject; // NSInteger code = [[dict objectForKey:@"code"] integerValue]; // if (code == 0) { // NSString *token = dict[@"data"][@"VerifyToken"]; // NSString *BizId = dict[@"data"][@"BizId"]; // [weakSelf youpaifpushToAliSdk:token BizId:BizId]; // // }else{ // // [ZCHUDHelper showTitle:[dict objectForKey:@"message"]]; // } // // // // } failure:^(NSError *error) { // [ZCHUDHelper showTitle:error.localizedDescription]; // // }]; // } -(void)youpaifpushToAliSdk:(NSString*)token BizId:(NSString*)bizIdStr{ RPConfiguration *configuration = [RPConfiguration configuration]; NSString *filePath1 = [[NSBundle mainBundle] pathForResource:@"RPCustomUI" ofType:@"bundle"]; configuration.customUIPath = filePath1; [RPSDK startWithVerifyToken:token viewController:self configuration:configuration completion:^(RPResult * _Nonnull result) { NSLog(@"实人认证结果:%@==%@", result,result.message); switch (result.state) { case RPStatePass: // 认证通过。 [self youpaifpostBizId:bizIdStr]; break; case RPStateFail: // 认证不通过。 [ZCHUDHelper showTitle:@"认证失败,请重新认证"]; break; case RPStateNotVerify: // 未认证。 // 通常是用户主动退出或者姓名身份证号实名校验不匹配等原因导致。 // 具体原因可通过result.errorCode来区分(详见文末错误码说明表格)。 break; } }]; } -(void)youpaifpostBizId:(NSString*)ID{ NSMutableDictionary *dict = [NSMutableDictionary new]; [dict setObject:ID forKey:@"BizId"]; WeakSelf; [LCHttpHelper requestWithURLString:LiveVerifyTokenSuccess parameters:dict needToken:YES type:HttpRequestTypePost success:^(id responseObject) { NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code == 0) { YOUPAILZLiveVerifyResultVC *vc = [[YOUPAILZLiveVerifyResultVC alloc] init]; vc.youpaipstate = LZLiveVerifyStateWithInReview; vc.youpaipcontent_str = [dict objectForKey:@"message"]; [weakSelf.navigationController pushViewController:vc animated:YES]; }else{ [ZCHUDHelper showTitle:[dict objectForKey:@"message"]]; } } failure:^(NSError *error) { [ZCHUDHelper showTitle:error.localizedDescription]; }]; } - (void)scrollViewDidScroll:(UIScrollView *)scrollView{ CGFloat y = scrollView.contentOffset.y; if(y > 0){ self.youpaipavatarImgV.mj_y = 0; self.youpaipavatarImgV.transform = CGAffineTransformMakeScale(1.0f, 1.0f); }else{ y = -y; CGFloat scale = y / kHeaderViewHeight; self.youpaipavatarImgV.mj_y = -y; self.youpaipavatarImgV.transform = CGAffineTransformMakeScale(1.0f + scale, 1.0f + scale); } } - (void)youpaifcheckSetting{ if ([LCTools canShowNoticationTip]) { UIUserNotificationSettings *setting = [[UIApplication sharedApplication] currentUserNotificationSettings]; if (UIUserNotificationTypeNone == setting.types) { UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:@"您的系统关闭了花蝶的通知提醒,会导致您错过重要的视频通话,需要您前往打开通知" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action){ }]; UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action){ NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString]; if ([[UIApplication sharedApplication] canOpenURL:url]) { [[UIApplication sharedApplication] openURL:url]; } }]; [alertController addAction:cancelAction]; [alertController addAction:okAction]; [self presentViewController:alertController animated:YES completion:nil]; } } } - (void)youpaifcheckAppraise{//盈利大于1000提示 if (@available(iOS 10.3, *)) { if ([LCTools canShowAppraise]) {//判断时间 一个月只弹一次 if([SKStoreReviewController respondsToSelector:@selector(requestReview)]){ [SKStoreReviewController requestReview]; } } } } - (void)youpaifrefreshData{ [LCHttpHelper requestWithURLString:UserCenter parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) {//成功 NSDictionary *anchor = [[dict objectForKey:@"data"]objectForKey:@"anchor"]; NSDictionary *info = [[dict objectForKey:@"data"]objectForKey:@"userinfo"]; if ([[anchor allKeys] containsObject:@"open_video_status"]) { if ([[anchor objectForKey:@"open_video_status"] integerValue] == 0) {//0 未开启 1 已开启 [LCSaveData saveVideoOpenStatu:NO]; }else{ [LCSaveData saveVideoOpenStatu:YES]; } } NSInteger guild = [[[dict objectForKey:@"data"]objectForKey:@"guild"] integerValue]; self.youpaipguild = guild; if ([[anchor allKeys] containsObject:@"order_switch"]) { if ([[anchor objectForKey:@"order_switch"] integerValue] == 1) {//1隐藏 2不隐藏 [LCSaveData saveOrderOpenStatu:YES]; }else{ [LCSaveData saveOrderOpenStatu:NO]; } } if ([[info allKeys] containsObject:@"is_msg_refuse"]) { if ([[info objectForKey:@"is_msg_refuse"] integerValue] == 1) {//1开启 0关闭 [LCSaveData saveProfileWuraoStatus:YES]; }else{ [LCSaveData saveProfileWuraoStatus:NO]; } } if ([[[dict objectForKey:@"data"] allKeys] containsObject:@"webUrl"]) { self.youpaipweiguiUrl = [NSString stringWithFormat:@"%@",[[[dict objectForKey:@"data"]objectForKey:@"webUrl"] objectForKey:@"publish"]]; self.youpaipinviteUrl = [NSString stringWithFormat:@"%@",[[[dict objectForKey:@"data"]objectForKey:@"webUrl"] objectForKey:@"share"]]; } YOUPAILCBaseInfo* userinfo = [YOUPAILCBaseInfo mj_objectWithKeyValues:[[dict objectForKey:@"data"]objectForKey:@"userinfo"]]; if (userinfo.youpaipalbum_list_new.count>0) { NSMutableArray *arrm = [NSMutableArray new]; [userinfo.youpaipalbum_list_new enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { album_list_newModel *model = [album_list_newModel mj_objectWithKeyValues:obj]; [arrm addObject:model]; }]; userinfo.youpaipalbum_list_new = arrm; } YOUPAILCUserModel* userModel = [LCSaveModel getUserModel]; userModel.youpaipuserinfo = userinfo; [LCSaveModel saveUserModel:userModel]; [self.youpaipheaderView youpaifreloadUserInfoWithModel:userModel]; YOUPAILCUserCountModel* userCount = [YOUPAILCUserCountModel mj_objectWithKeyValues:[[dict objectForKey:@"data"]objectForKey:@"usercount"]]; [self.youpaipheaderView youpaifreloadCountWithModel:userCount]; [self.youpaipheaderView youpaifreloadUserLevelModel:[YOUPAILZLiveCardModel mj_objectWithKeyValues:[[dict objectForKey:@"data"]objectForKey:@"gr"]]]; [self youpaifreloadDataSource]; } } failure:^(NSError *error) { }]; [LCHttpHelper requestWithURLString:WalletInit parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) {//成功 CGFloat coin = [[[[dict objectForKey:@"data"]objectForKey:@"account"]objectForKey:@"coin"]integerValue]; NSString *income_coin = [[[dict objectForKey:@"data"]objectForKey:@"account"]objectForKey:@"income_coin_money"]; [self.youpaipheaderView youpaifreloadAccountWithBalance:coin profit:income_coin]; } } failure:^(NSError *error) { }]; } - (void)youpaifopenDontDisturb{ NSString *status = [LCSaveData getProfileWuraoStatus] ? @"0" : @"1"; [LCHttpHelper requestWithURLString:SetWuRaoStatus parameters:@{@"is_msg_refuse":status} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) { if ([status isEqualToString:@"1"]) { [ZCHUDHelper showTitle:@"打开勿打扰"]; [LCSaveData saveProfileWuraoStatus:YES]; [self.youpaiptableView reloadData]; }else{ [ZCHUDHelper showTitle:@"关闭勿打扰"]; [LCSaveData saveProfileWuraoStatus:NO]; [self.youpaiptableView reloadData]; } } } failure:^(NSError *error) { }]; } - (void)youpaifvideoSwitchValueChange:(UIButton*)switchView{ NSInteger status = 0; if (switchView.selected == NO) {//将状态置为1空闲 status = 0; }else{ status = 1; } [LCHttpHelper requestWithURLString:BigCastSetVideoStatus parameters:@{@"status":@(status)} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) { if (status==0) { [ZCHUDHelper showTitle:@"关闭视频"]; [LCSaveData saveVideoOpenStatu:NO]; }else{ [ZCHUDHelper showTitle:@"打开视频"]; [LCSaveData saveVideoOpenStatu:YES]; } } [self.youpaiptableView reloadData]; } failure:^(NSError *error) { }]; } @end