// // YOUPAIZYSeeVideosVC.m // VQU // // Created by Elaine on 2020/11/17. // Copyright © 2020 leo. All rights reserved. // #import "YOUPAIZYSeeVideosVC.h" #import "YOUPAIZYVideoModel.h" #import "YOUPAIEyeCatchingWaiterCell.h" #import "ZFPlayer.h" #import "ZFAVPlayerManager.h" #import "YOUPAIZFDouYinControlView.h" #import "YOUPAILZUserShowVC.h" #import "YOUPAILCIMSessionVC.h" #import "YOUPAILZCommonGiftView.h" #import "UIViewController+TFPresent.h" #import "YOUPAIXRWalletVC.h" @interface YOUPAIZYSeeVideosVC () @property (nonatomic, strong) UITableView *youpaiptableView; @property (nonatomic, strong) ZFPlayerController *youpaipzFplayer; @property (nonatomic, strong) YOUPAIZFDouYinControlView *youpaipcontrolView; @property(nonatomic,assign)NSInteger youpaipcurrentPage;//代表当前页码 @property(nonatomic,assign)NSInteger youpaiptotalPage;//总页码 @property (nonatomic,assign)BOOL youpaipisLeavePage;// 是否离开 @end @implementation YOUPAIZYSeeVideosVC - (UIStatusBarStyle)preferredStatusBarStyle{ return UIStatusBarStyleLightContent; } -(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; // self.navigationController.navigationBar.translucent = YES; // [self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:HexColorFromRGBA(0xffffff, 0) size:CGSizeMake(KScreenWidth, NavBarHeight)] forBarMetrics:(UIBarMetricsDefault)]; self.youpaipisLeavePage = NO; [self.youpaipzFplayer.currentPlayerManager play]; [self.youpaipcontrolView youpaifresetControlView]; self.navigationController.navigationBar.translucent = YES; UIImage *img = [UIImage imageWithColor:[LCBkgColor colorWithAlphaComponent:0.0f] size:CGSizeMake(KScreenWidth, NavBarHeight)]; [self.navigationController.navigationBar setBackgroundImage:img forBarMetrics:(UIBarMetricsDefault)]; [self.navigationController.navigationBar setBackgroundColor:[LCBkgColor colorWithAlphaComponent:0.0f]]; if (@available(iOS 15.0, *)) { [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundColor:[LCBkgColor colorWithAlphaComponent:0.0f]]; [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundImage:img]; [self.navigationController.navigationBar.standardAppearance setBackgroundColor:[LCBkgColor colorWithAlphaComponent:0.0f]]; [self.navigationController.navigationBar.standardAppearance setBackgroundImage:img]; } } -(void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; // [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; // self.navigationController.navigationBar.translucent = NO; self.youpaipisLeavePage = YES; [self.youpaipzFplayer.currentPlayerManager pause]; UIImage *img = [UIImage imageWithColor:LCNavColor size:CGSizeMake(KScreenWidth, NavBarHeight)]; [self.navigationController.navigationBar setBackgroundImage:img forBarMetrics:UIBarMetricsDefault]; [self.navigationController.navigationBar setBackgroundColor:LCNavColor]; if (@available(iOS 15.0, *)) { [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundColor:LCNavColor]; [self.navigationController.navigationBar.scrollEdgeAppearance setBackgroundImage:img]; [self.navigationController.navigationBar.standardAppearance setBackgroundColor:LCNavColor]; [self.navigationController.navigationBar.standardAppearance setBackgroundImage:img]; } self.navigationController.navigationBar.translucent = NO; } - (void)viewDidLoad { [super viewDidLoad]; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(youpaifrefreshSeeVideoVCGuanZhuNotic:) name:@"refreshSeeVideoVCGuanZhu" object:nil];; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(youpaifrefreshSeeVideoVCGuanZhuNotic:) name:@"ChangeFollowState" object:nil];; self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifbackClick) image:[UIImage imageNamed:@"vqu_images_navigation_back_black"]]; if([self.youpaipuserId isEqualToString:[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id]){ self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifmoreClick) image:[UIImage imageNamed:@"vqu_images_more2"]]; } [self youpaifinitTableView]; [self.youpaiptableView scrollToRowAtIndexPath:self.youpaipindexPath atScrollPosition:UITableViewScrollPositionTop animated:YES]; self.youpaipzFplayer.assetURLs = self.youpaipmp4UrlArray; [self youpaifplayTheVideoAtIndexPath:self.youpaipindexPath]; [self youpaifplayScrollVideo:NO is_follow:3]; } -(void)youpaifplayScrollVideo:(BOOL)changeStatus is_follow:(NSInteger)is_follow{ @weakify(self); self.youpaipzFplayer.zf_playerShouldPlayInScrollView = ^(NSIndexPath * _Nonnull indexPath) { NSLog(@"%@",indexPath); @strongify(self); YOUPAIEyeCatchingWaiterCell *cell = (YOUPAIEyeCatchingWaiterCell*)[self.youpaiptableView cellForRowAtIndexPath:indexPath]; if (changeStatus) { cell.model.youpaipis_follow = is_follow; }else{ } for(UIView*firstView in cell.subviews) { for(UIView*lastView in firstView.subviews) { if(lastView.tag == 100) { for(UIView*playerPresentView in lastView.subviews) { playerPresentView.backgroundColor= [UIColor clearColor]; } } } } }; } -(void)youpaifrefreshSeeVideoVCGuanZhuNotic:(NSNotification*)notification{ NSDictionary *dict = [notification userInfo]; NSString *idStr = dict[@"follow_uid"]; NSInteger isfollow = [dict[@"is_follow"] intValue]; NSArray *arr = self.youpaipvideoDataArray; if (arr.count>0) { NSIndexPath *index; NSMutableArray *arrM = [NSMutableArray new]; for (int i = 0; i_youpaipvideoDataArray[row]; [LCHttpHelper requestWithURLString:TrendsDelete parameters:@{@"vt_id":model.youpaipvideoId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) {//成功 // [self.videoDataArray removeObjectAtIndex:row]; // [self.mp4UrlArray removeObjectAtIndex:row]; // [self.tableView reloadData]; [self.youpaiptableView.mj_header beginRefreshing]; } } failure:^(NSError *error) { }]; }];; ZCAlertSheetView* alertSheet = [[ZCAlertSheetView alloc]initWithTitle:nil andShowCancelButton:YES andAction:@[action]]; alertSheet.alertWindow.hidden = NO; [alertSheet show]; } - (void)youpaifloadNewData{ self.youpaiptableView.mj_footer.hidden = YES; [self.youpaiptableView.mj_footer endRefreshing];//先结束上拉,假如有的话 [self.youpaiptableView.mj_footer endRefreshingWithNoMoreData]; self.youpaiptableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(youpaifloadMoreData)]; self.youpaipcurrentPage = 1; [LCHttpHelper requestWithURLString:TrendsLists parameters:@{@"page":@(self.youpaipcurrentPage),@"user_id":self.youpaipuserId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) {//成功 [self.youpaipvideoDataArray removeAllObjects]; [self.youpaipmp4UrlArray removeAllObjects]; self.youpaipvideoDataArray = [YOUPAIZYVideoModel mj_objectArrayWithKeyValuesArray:[[dict objectForKey:@"data"] objectForKey:@"list"]]; self.youpaiptotalPage = [[[dict objectForKey:@"data"] objectForKey:@"total_page"] integerValue]; NSInteger currentPage = [[[dict objectForKey:@"data"] objectForKey:@"page"] integerValue]; self.youpaipcurrentPage = currentPage; for (YOUPAIZYVideoModel *model in self.youpaipvideoDataArray) { [self.youpaipmp4UrlArray addObject:[NSURL URLWithString:model.youpaipfile_url]]; } NSLog(@"%@",self.youpaipmp4UrlArray); self.youpaipzFplayer.assetURLs = self.youpaipmp4UrlArray; [self.youpaiptableView reloadData]; [self.youpaipzFplayer.currentPlayerManager pause]; if (self.youpaipvideoDataArray.count != 0) { NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; [self youpaifplayTheVideoAtIndexPath:indexPath]; if (self.youpaipisLeavePage) { [self.youpaipzFplayer.currentPlayerManager pause]; } } // __weak typeof(self) weakSelf = self; // [self.zFplayer zf_filterShouldPlayCellWhileScrolled:^(NSIndexPath *indexPath) { // [weakSelf youpaifplayTheVideoAtIndexPath:indexPath]; // NSLog(@"%@",indexPath); // }]; if (currentPage>=self.youpaiptotalPage) { [self.youpaiptableView.mj_footer endRefreshingWithNoMoreData]; self.youpaiptableView.mj_footer.hidden = YES; } [self.youpaiptableView.mj_header endRefreshing]; }else{ [self.youpaiptableView.mj_header endRefreshing]; } } failure:^(NSError *error) { [self.youpaiptableView.mj_header endRefreshing]; }]; } - (void)youpaifloadMoreData{ //先结束下拉 假如有的话 [self.youpaiptableView.mj_header endRefreshing]; [LCHttpHelper requestWithURLString:TrendsLists parameters:@{@"page":@(self.youpaipcurrentPage+1),@"user_id":self.youpaipuserId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) {//成功 NSInteger count = self.youpaipvideoDataArray.count; NSMutableArray* modelArray = [YOUPAIZYVideoModel mj_objectArrayWithKeyValuesArray:[[dict objectForKey:@"data"]objectForKey:@"list"]]; [self.youpaipvideoDataArray addObjectsFromArray:modelArray]; self.youpaiptotalPage = [[[dict objectForKey:@"data"] objectForKey:@"total_page"] integerValue]; NSInteger currentPage = [[[dict objectForKey:@"data"] objectForKey:@"page"] integerValue]; self.youpaipcurrentPage = currentPage; for (YOUPAIZYVideoModel *model in modelArray) { [self.youpaipmp4UrlArray addObject:[NSURL URLWithString:model.youpaipfile_url]]; } self.youpaipzFplayer.assetURLs = self.youpaipmp4UrlArray; [self.youpaiptableView reloadData]; NSIndexPath* indexPath = [NSIndexPath indexPathForRow:count inSection:0]; [self.youpaiptableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES]; [self youpaifplayTheVideoAtIndexPath:indexPath]; if (self.youpaipisLeavePage) { [self.youpaipzFplayer.currentPlayerManager pause]; } // __weak typeof(self) weakSelf = self; // [self.zFplayer zf_filterShouldPlayCellWhileScrolled:^(NSIndexPath *indexPath) { // [weakSelf youpaifplayTheVideoAtIndexPath:indexPath]; // }]; if (currentPage>=self.youpaiptotalPage) { [self.youpaiptableView.mj_footer endRefreshingWithNoMoreData]; self.youpaiptableView.mj_footer.hidden = YES; } [self.youpaiptableView.mj_header endRefreshing]; } [self.youpaiptableView.mj_footer endRefreshing]; } failure:^(NSError *error) { [self.youpaiptableView.mj_footer endRefreshing]; }]; } -(void)youpaifinitTableView { _youpaiptableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0,KScreenWidth, KScreenHeight) style:UITableViewStylePlain]; NSLog(@"%lf",_youpaiptableView.frame.size.height); _youpaiptableView.pagingEnabled = YES; [_youpaiptableView registerClass:[YOUPAIEyeCatchingWaiterCell class] forCellReuseIdentifier:@"YOUPAIEyeCatchingWaiterCell"]; _youpaiptableView.backgroundColor = [UIColor blackColor]; _youpaiptableView.delegate = self; _youpaiptableView.dataSource = self; _youpaiptableView.separatorStyle = UITableViewCellSeparatorStyleNone; _youpaiptableView.showsVerticalScrollIndicator = NO; _youpaiptableView.scrollsToTop = NO; if (@available(iOS 11.0, *)) { _youpaiptableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; } else { self.automaticallyAdjustsScrollViewInsets = NO; } _youpaiptableView.estimatedRowHeight = 0; _youpaiptableView.estimatedSectionFooterHeight = 0; _youpaiptableView.estimatedSectionHeaderHeight = 0; _youpaiptableView.rowHeight = KScreenHeight; _youpaiptableView.scrollsToTop = NO; _youpaiptableView.mj_header = [LCRefreshDotGiftHeader headerWithRefreshingTarget:self refreshingAction:@selector(youpaifloadNewData)]; if (@available(iOS 15.0, *)) { _youpaiptableView.sectionHeaderTopPadding = 0; } NSLog(@"%lf",_youpaiptableView.frame.size.height); [self.view addSubview:_youpaiptableView]; } /// play the video - (void)youpaifplayTheVideoAtIndexPath:(NSIndexPath *)indexPath { [self.youpaipzFplayer playTheIndexPath:indexPath]; [self.youpaipcontrolView youpaifresetControlView]; YOUPAIZYVideoModel *model = self.youpaipvideoDataArray[indexPath.row]; [self youpaiftrendsBrowser:model]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ // self.tableView.mj_footer.hidden = self.videoDataArray.count>0?NO:YES; return self.youpaipvideoDataArray.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ YOUPAIEyeCatchingWaiterCell * cell = [tableView dequeueReusableCellWithIdentifier:@"YOUPAIEyeCatchingWaiterCell" forIndexPath:indexPath]; self.youpaipindexPath = indexPath; cell.backgroundColor = [UIColor blackColor]; YOUPAIZYVideoModel *model = self.youpaipvideoDataArray[indexPath.row]; cell.model = model; cell.delegate = self; cell.hidesBottomBar = self.hidesBottomBarWhenPushed; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [self youpaifplayTheVideoAtIndexPath:indexPath]; } #pragma mark - UIScrollViewDelegate 列表播放必须实现 - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { [scrollView zf_scrollViewDidEndDecelerating]; } - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { [scrollView zf_scrollViewDidEndDraggingWillDecelerate:decelerate]; } - (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView { [scrollView zf_scrollViewDidScrollToTop]; } - (void)scrollViewDidScroll:(UIScrollView *)scrollView { [scrollView zf_scrollViewDidScroll]; } - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { [scrollView zf_scrollViewWillBeginDragging]; } #pragma mark --- 懒加载 - (YOUPAIZFDouYinControlView *)youpaipcontrolView { if (!_youpaipcontrolView) { _youpaipcontrolView = [YOUPAIZFDouYinControlView new]; } return _youpaipcontrolView; } - (ZFPlayerController *)youpaipzFplayer{ if (_youpaipzFplayer == nil) { ZFAVPlayerManager *playerManager = [[ZFAVPlayerManager alloc] init]; _youpaipzFplayer = [ZFPlayerController playerWithScrollView:self.youpaiptableView playerManager:playerManager containerViewTag:100]; _youpaipzFplayer.disableGestureTypes = ZFPlayerDisableGestureTypesDoubleTap | ZFPlayerDisableGestureTypesPan | ZFPlayerDisableGestureTypesPinch; _youpaipzFplayer.allowOrentitaionRotation = NO; _youpaipzFplayer.WWANAutoPlay = YES; _youpaipzFplayer.playerDisapperaPercent = 1.0; _youpaipzFplayer.controlView = self.youpaipcontrolView; __weak typeof(self) weakSelf = self; _youpaipzFplayer.playerDidToEnd = ^(id _Nonnull asset) { // 播放结束后重新播放 [weakSelf.youpaipzFplayer.currentPlayerManager replay]; }; _youpaipzFplayer.presentationSizeChanged = ^(id _Nonnull asset, CGSize size) { // 视频画面显示的模式 NSInteger index = [weakSelf.youpaipmp4UrlArray indexOfObject:asset.assetURL]; if (weakSelf.youpaipvideoDataArray.count >= index) { YOUPAIZYVideoModel *model = weakSelf.youpaipvideoDataArray[index]; if (model.youpaipmode == 0) { if (size.width >= size.height) { model.youpaipmode = UIViewContentModeScaleAspectFit; } else { model.youpaipmode = UIViewContentModeScaleAspectFill; } } if (model.youpaipmode == UIViewContentModeScaleAspectFit) { weakSelf.youpaipzFplayer.currentPlayerManager.scalingMode = ZFPlayerScalingModeAspectFit; }else{ weakSelf.youpaipzFplayer.currentPlayerManager.scalingMode = ZFPlayerScalingModeAspectFill; } } }; [_youpaipzFplayer setPlayerPrepareToPlay:^(id _Nonnull asset, NSURL * _Nonnull assetURL) { NSInteger index = [weakSelf.youpaipmp4UrlArray indexOfObject:asset.assetURL]; if (weakSelf.youpaipvideoDataArray.count >= index) { YOUPAIZYVideoModel *model = weakSelf.youpaipvideoDataArray[index]; if (model.youpaipmode == UIViewContentModeScaleAspectFit) { weakSelf.youpaipzFplayer.currentPlayerManager.scalingMode = ZFPlayerScalingModeAspectFit; }else{ weakSelf.youpaipzFplayer.currentPlayerManager.scalingMode = ZFPlayerScalingModeAspectFill; } } }]; /// 停止的时候找出最合适的播放 _youpaipzFplayer.zf_scrollViewDidEndScrollingCallback = ^(NSIndexPath * _Nonnull indexPath) { if (weakSelf.youpaipzFplayer.playingIndexPath) return; /// 加载下一页数据 weakSelf.youpaipzFplayer.assetURLs = weakSelf.youpaipmp4UrlArray; [weakSelf.youpaiptableView reloadData]; [weakSelf youpaifplayTheVideoAtIndexPath:indexPath]; }; } return _youpaipzFplayer; } #pragma EyeCatchingWaiterCellDelegate //cell的代理 - (void)youpaifclickAvatar:(YOUPAIZYVideoModel*)model;//点击了头像 { //LCUserShowVC* userShow = [[LCUserShowVC alloc]init]; YOUPAILZUserShowVC *userShow = [[YOUPAILZUserShowVC alloc] init]; userShow.youpaipuserId = model.youpaipuser_id; // userShow.videoModel = model; // userShow.delegate = self; [self.navigationController pushViewController:userShow animated:YES]; } -(void)youpaifclickNikname:(YOUPAIZYVideoModel *)model { YOUPAILZUserShowVC *userShow = [[YOUPAILZUserShowVC alloc] init]; userShow.youpaipuserId = model.youpaipuser_id; // userShow.videoModel = model; // userShow.delegate = self; [self.navigationController pushViewController:userShow animated:YES]; } - (void)youpaifclickAttention:(YOUPAIZYVideoModel*)model;//点击了关注 { if (model.youpaipis_follow == 0) {//+关注 [LCCommonHttp followUserId:model.youpaipuser_id]; model.youpaipis_follow = 1; [self.youpaiptableView reloadData]; }else{ [LCCommonHttp followUserId:model.youpaipuser_id]; model.youpaipis_follow = 0; [self.youpaiptableView reloadData]; } } - (void)youpaifclickSupport:(YOUPAIZYVideoModel*)model;//点击了点赞 { [self.youpaiptableView reloadData]; } -(void)youpaifclickImVideo:(YOUPAIZYVideoModel *)model;//点击了视频 { if ([YOUPAILZChatRoomManager shareManager].chatroomWindow != nil && [YOUPAILZChatRoomManager shareManager].chatroomWindow.hidden == NO) { [ZCHUDHelper showTitle:@"你正在房间中,暂不可拨打视频"]; return; } [UCAuthorityManager cameraAuthority:^{ [LCHttpHelper requestWithURLString:CallChatType parameters:@{@"to_uid":model.youpaipuser_id,@"type":@"0"} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) {//成功 YOUPAILCVideoChatModel* videoModel = [YOUPAILCVideoChatModel mj_objectWithKeyValues:[dict objectForKey:@"data"]]; [[YOUPAILZChatRoomManager shareManager] youpaifcloseChatRoom]; [[NSNotificationCenter defaultCenter] postNotificationName:@"MeCallVideo" object:nil userInfo:nil]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ YOUPAILCVideoRequestVC* chatRequest = [[YOUPAILCVideoRequestVC alloc]init]; chatRequest.youpaipvideoModel = videoModel; //modify by leo fix bug ios13 ZCBaseNavigationVC *nav = [[ZCBaseNavigationVC alloc]initWithRootViewController:chatRequest]; chatRequest.view.backgroundColor = HexColorFromRGBA(0x000000, 0.55); chatRequest.definesPresentationContext = YES; nav.modalPresentationStyle = UIModalPresentationOverCurrentContext; [self.navigationController presentViewController:nav animated:YES completion:^{ // chatRequest.view.backgroundColor = HexColorFromRGBA(0x000000, 0.55); }]; }); } } failure:^(NSError *error) { }]; } denied:^{ dispatch_async(dispatch_get_main_queue(), ^{ UIAlertController *systemAlert = [UIAlertController alertControllerWithTitle:@"请在iphone的“设置-隐私-相机”选项中,允许APP访问您的相机。" message:nil preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"现在去设置" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action){ if ([[UIDevice currentDevice].systemVersion floatValue] < 10.0) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; } else { // 去系统设置页面 if (@available(iOS 10.0, *)) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil]; } else { // Fallback on earlier versions } } }]; UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil]; [systemAlert addAction:cancelAction]; [systemAlert addAction:action]; [self presentViewController: systemAlert animated: YES completion: nil]; }); }]; } //累加视频动态浏览量 -(void)youpaiftrendsBrowser:(YOUPAIZYVideoModel *)model{ [LCHttpHelper requestWithURLString:TrendsBrowser parameters:@{@"vt_id":model.youpaipvideoId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) {//成功 NSString *view_count = [NSString stringWithFormat:@"%@",[[dict objectForKey:@"data"] objectForKey:@"view_count"]]; model.youpaipview_count = [view_count integerValue]; [self.youpaiptableView reloadData]; } } failure:^(NSError *error) { }]; } // 点击了礼物 - (void)youpaifclickGift:(YOUPAIZYVideoModel *)model{ YOUPAILZCommonGiftView *view = [YOUPAILZCommonGiftView new]; view.isTouchDismiss = YES; view.youpaipisAnchor = NO; [view setJumToWalletBlock1:^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [[NSNotificationCenter defaultCenter] postNotificationName:@"InsufficientBalanceNotice" object:nil userInfo:nil]; YOUPAIXRWalletVC *coinRecharge = [[YOUPAIXRWalletVC alloc]init]; [self.navigationController pushViewController:coinRecharge animated:YES]; }); }]; [view setYoupaiplzgiftblock:^(YOUPAILCGiftModel * _Nonnull giftModel, NSInteger count,NSString *categoryID) { [LCHttpHelper requestWithURLString:SendGift_New parameters:@{@"type":@(6),@"to_uid":model.youpaipuser_id,@"gift_id":giftModel.youpaipid,@"num":@(count),@"gift_type_id":categoryID} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) {//成功 [ZCHUDHelper showTitle:@"礼物赠送成功"]; } } failure:^(NSError *error) { }]; }]; [self TFPresentVC:view completion:^{ }]; } //#pragma mark -- LZUserShowVCDelegate //-(void)youpaifclickUserShowVCAttention:(YOUPAIZYVideoModel *)model //{ // [self.tableView reloadData]; //} @end