123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925 |
- //
- // YOUPAILZLiveAudienceVC.m
- // TIANYAN
- //
- // Created by CY on 2021/5/8.
- // Copyright © 2021 leo. All rights reserved.
- //
- #import "YOUPAILZLiveAudienceVC.h"
- #import "YOUPAILZBadgeButton.h"
- #import "YOUPAILZAudienceMenuView.h"
- #import "YOUPAILCReportVC.h"
- #import "YOUPAILPGuardHerVC.h"
- #import "UIViewController+TFPresent.h"
- #import "YOUPAILZLiveCloseAudienceWindow.h"
- #import "YOUPAILZRecommendAnchorView.h"
- #import "LZLiveAnimation.h"
- #import "YOUPAILCUserShowModel.h"
- #import "YOUPAILZLiveMemberListVC.h"
- #import "YOUPAILZUserShowVC.h"
- #import "SDCycleScrollView.h"
- #import "YOUPAILZLiveBoardCycleViewCell.h"
- #import "YOUPAILZLiveMemberButton.h"
- #import "YOUPAILZLiveAnchorHotWindow.h"
- #import "YOUPAILZLiveSendFestivalAlertVC.h"
- #import "UIViewController+TFPresent.h"
- #import "YOUPAILZCommonGiftView.h"
- @interface YOUPAILZLiveAudienceVC () <NIMConversationManagerDelegate,LPGuardHerDelegate,SDCycleScrollViewDelegate>
- @property (nonatomic, weak) UIButton *youpaipsendMessageBtn; // 发送消息按钮
- @property (nonatomic, weak) UIButton *youpaipvoiceBtn; // 喇叭按钮
- @property (nonatomic, weak) UIButton *youpaipbeautyBtn; // 美颜按钮
- @property (nonatomic, weak) UIButton *youpaipcloseCameraBtn; // 关闭相机按钮
- @property (nonatomic, weak) UIButton *youpaipchangeCameraBtn; // 切换摄像头
- //@property (nonatomic, weak) YOUPAILZBadgeButton *messageCountBtn; // 新消息
- @property (nonatomic, weak) UILabel *youpaipliveMemberCountL; // 直播人数
- @property (nonatomic, strong) NSMutableArray <YOUPAILZLiveMemberButton *> *youpaipmemberBtns; ///直播榜单人数
- @property (nonatomic, weak) YOUPAILZBadgeButton *youpaipmessageCountBtn; // 新消息
- @property (nonatomic, weak) UIView *youpaiprankBgV; // 排行背景View
- //@property (nonatomic, weak) UILabel *youpaipcharmValueL; // 魅力值
- @property (nonatomic, weak) SDCycleScrollView *youpaipboardCycleView; // 当前直播间上榜信息View
- @property (nonatomic, weak) UILabel *youpaipfansCountL; // 粉丝数
- @property (nonatomic, weak) UIButton *youpaipfollowBtn; //关注按钮
- @property (nonatomic, strong) YOUPAILZAudienceMenuView *youpaipmenuView;
- @end
- @implementation YOUPAILZLiveAudienceVC
- - (void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
- // [IQKeyboardManager sharedManager].enable = NO;
- // [IQKeyboardManager sharedManager].enableAutoToolbar = NO;
- [[NIMSDK sharedSDK].conversationManager addDelegate:self];
- }
- - (void)viewWillDisappear:(BOOL)animated{
- [super viewWillDisappear:animated];
- // [IQKeyboardManager sharedManager].enable = YES;
- // [IQKeyboardManager sharedManager].enableAutoToolbar = YES;
- [[NIMSDK sharedSDK].conversationManager removeDelegate:self];
- }
- - (void)viewDidDisappear:(BOOL)animated{
- [super viewDidDisappear:animated];
- if (!self.youpaipisNotPanClose) {
- [self youpaifleaveChannel];
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- }
- }
- - (void)dealloc{
- NSString *cls = NSStringFromClass([self class]);
- NSLog(@"销毁:--%@ dealloc",cls);
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.sx_disableInteractivePop = NO;
- [self youpaifsetupHeaderView];
- [self youpaifsetupFooterView];
- [self youpaifupdateUnread];
- [self youpaifhandleBlock];
- [self youpaifhandlePKDataInfo];
- [self youpaifloadAdvertRecharge];
- [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(youpaifendLive) name:@"CallVideo" object:nil];
- [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(youpaifendLiveTwo) name:@"MeCallVideo" object:nil];
-
- /// 关注状态改变,接收通知
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youpaifchangeFollowStateNotification:) name:@"ChangeFollowState" object:nil];
-
- UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(youpaifhandleTapGesture:)];
- tapGesture.numberOfTapsRequired = 2;
- [self.view addGestureRecognizer:tapGesture];
- }
- - (void)youpaifchangeFollowStateNotification:(NSNotification *)notification{
- NSDictionary *dict = [notification userInfo];
- if ([dict[@"follow_uid"] isEqual:self.youpaipliveModel.youpaipuser_info.youpaipuser_id]) {
- if ([dict[@"is_follow"] integerValue] != 0) { // 加关注
- [self.youpaipfollowBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(34.0f, 23.0f) FromColors:@[HexColorFromRGB(0xF7AC00),HexColorFromRGB(0xFD7E00)] ByGradientType:GradientLeftToRight] forState:UIControlStateNormal];
- [self.youpaipfollowBtn setTitle:@"守护" forState:UIControlStateNormal];
- [self.youpaipfollowBtn removeTarget:self action:@selector(youpaiffollowBtnClick:) forControlEvents:UIControlEventTouchUpInside];
- [self.youpaipfollowBtn addTarget:self action:@selector(youpaifguardBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [self youpaiffollow];
- }else{ // 取消关注
- [self.youpaipfollowBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(34.0f, 23.0f) FromColors:@[HexColorFromRGB(0xFF0084),HexColorFromRGB(0xFF3A00)] ByGradientType:GradientLeftToRight] forState:UIControlStateNormal];
- [self.youpaipfollowBtn setTitle:@"关注" forState:UIControlStateNormal];
- [self.youpaipfollowBtn removeTarget:self action:@selector(youpaifguardBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [self.youpaipfollowBtn addTarget:self action:@selector(youpaiffollowBtnClick:) forControlEvents:UIControlEventTouchUpInside];
- }
- }
- }
- /// 女神直播回调
- - (void)youpaifhandleBlock{
- @weakify(self);
- [self setYoupaipliveCloseBlock:^{
- @strongify(self);
- [self youpaifleaveChannel];
- [self youpaifrequestLiveCloseData];
- }];
- [self setYoupaipaudienceRecommendMoreAnchorBlock:^{
- @strongify(self);
- [self youpaifgoRecommendAnchorPage];
- }];
- [self setYoupaipclickRemoteVideoViewBlock:^(NSString * _Nonnull uid, NSString * _Nonnull room_id) {
- @strongify(self);
- if (room_id.length != 0) {
- [self youpaifjoinLiveWithRoomId:room_id];
- }
- }];
- }
- // 处理pk
- - (void)youpaifhandlePKDataInfo{
- if (self.youpaipliveModel.youpaippk_info != nil) {
- self.youpaippkdataView.hidden = NO;
- [self.youpaippkdataView youpaifreloadWithAttachment:self.youpaipliveModel.youpaippk_info];
- }
- }
- /// 设置headerView
- - (void)youpaifsetupHeaderView{
- UIView *headerView = [[UIView alloc] init];
- [self.view addSubview:headerView];
- [headerView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(0.0f);
- make.height.offset(70.0f);
- make.top.offset(StatusBarHeight);
- }];
-
- UIButton *anchorInfoBgBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- anchorInfoBgBtn.layer.cornerRadius = 17.5f;
- anchorInfoBgBtn.clipsToBounds = YES;
- anchorInfoBgBtn.tag = [self.youpaipliveModel.youpaipuser_info.youpaipuser_id integerValue];
- [anchorInfoBgBtn addTarget:self action:@selector(youpaifshowUserInfoClick:) forControlEvents:UIControlEventTouchUpInside];
- anchorInfoBgBtn.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3f];
- [headerView addSubview:anchorInfoBgBtn];
- [anchorInfoBgBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(12.0f);
- make.top.offset(5.0f);
- make.height.offset(35.0f);
- make.width.lessThanOrEqualTo(160.0f);
- make.right.offset(0.0f);
- }];
-
- UIImageView *youpaipavatarImgV = [[UIImageView alloc] init];
- youpaipavatarImgV.contentMode = UIViewContentModeScaleAspectFill;
- youpaipavatarImgV.layer.cornerRadius = 16.5f;
- youpaipavatarImgV.clipsToBounds = YES;
- [youpaipavatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipliveModel.youpaipuser_info.youpaipavatar]];
- [anchorInfoBgBtn addSubview:youpaipavatarImgV];
- [youpaipavatarImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.top.offset(1.0f);
- make.size.mas_offset(CGSizeMake(33.0f, 33.0f));
- }];
-
- UIImageView *anchorTagImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_anchor_vlog"]];
- [anchorInfoBgBtn addSubview:anchorTagImgV];
- [anchorTagImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(youpaipavatarImgV.mas_right).offset(0.0f);
- make.bottom.equalTo(youpaipavatarImgV.mas_bottom).offset(0.0f);
- make.size.mas_offset(CGSizeMake(10.0f, 10.0f));
- }];
-
- UIButton *youpaipfollowBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- youpaipfollowBtn.layer.cornerRadius = 11.5f;
- youpaipfollowBtn.clipsToBounds = YES;
- youpaipfollowBtn.titleLabel.font = LCFont(12.0f);
- [youpaipfollowBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
-
- if(self.youpaipliveModel.youpaipuser_info.youpaipis_follow == 0){
- [youpaipfollowBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(34.0f, 23.0f) FromColors:@[HexColorFromRGB(0xFF0084),HexColorFromRGB(0xFF3A00)] ByGradientType:GradientLeftToRight] forState:UIControlStateNormal];
- [youpaipfollowBtn setTitle:@"关注" forState:UIControlStateNormal];
- [youpaipfollowBtn addTarget:self action:@selector(youpaiffollowBtnClick:) forControlEvents:UIControlEventTouchUpInside];
- }else{
- [youpaipfollowBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(34.0f, 23.0f) FromColors:@[HexColorFromRGB(0xF7AC00),HexColorFromRGB(0xFD7E00)] ByGradientType:GradientLeftToRight] forState:UIControlStateNormal];
- [youpaipfollowBtn setTitle:@"守护" forState:UIControlStateNormal];
- [youpaipfollowBtn addTarget:self action:@selector(youpaifguardBtnClick) forControlEvents:UIControlEventTouchUpInside];
- }
- [anchorInfoBgBtn addSubview:youpaipfollowBtn];
- self.youpaipfollowBtn = youpaipfollowBtn;
- [youpaipfollowBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(-4.0f);
- make.width.offset(34.0f);
- make.height.offset(23.0f);
- make.centerY.equalTo(anchorInfoBgBtn.mas_centerY);
- }];
-
- UILabel *youpaipnicknameL = [[UILabel alloc] init];
- youpaipnicknameL.font = LCBoldFont(11.0f);
- youpaipnicknameL.textColor = [UIColor whiteColor];
- youpaipnicknameL.text = self.youpaipliveModel.youpaipuser_info.youpaipnickname;
- [anchorInfoBgBtn addSubview:youpaipnicknameL];
- [youpaipnicknameL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(youpaipavatarImgV.mas_right).offset(4.0f);
- make.right.equalTo(youpaipfollowBtn.mas_left).offset(-12.0f);
- make.top.offset(5.0f);
- // make.height.offset(17.5f);
- }];
-
- UILabel *youpaipfansCountL = [[UILabel alloc] init];
- youpaipfansCountL.font = LCFont(8.0f);
- youpaipfansCountL.textColor = [UIColor whiteColor];
- youpaipfansCountL.text = [NSString stringWithFormat:@"粉丝:%@",self.youpaipliveModel.youpaipfans_count];
- [anchorInfoBgBtn addSubview:youpaipfansCountL];
- self.youpaipfansCountL = youpaipfansCountL;
- [youpaipfansCountL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(youpaipavatarImgV.mas_right).offset(4.0f);
- make.right.equalTo(youpaipfollowBtn.mas_left).offset(-12.0f);
- make.bottom.offset(-5.0f);
- // make.height.offset(17.5f);
- }];
-
-
- UIButton *closeLiveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [closeLiveBtn setImage:[UIImage imageNamed:@"vqu_images_L_live_anchor_close"] forState:UIControlStateNormal];
- [closeLiveBtn setImage:[UIImage imageNamed:@"vqu_images_L_live_anchor_close"] forState:UIControlStateHighlighted];
- [closeLiveBtn addTarget:self action:@selector(youpaifendLive) forControlEvents:UIControlEventTouchUpInside];
- [self.view addSubview:closeLiveBtn];
- [closeLiveBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(-12.0f);
- make.top.offset(7.0f + StatusBarHeight);
- make.height.offset(31.0f);
- make.width.offset(19.0f);
- }];
-
- UIButton *liveMemberCountBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- liveMemberCountBtn.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3f];
- liveMemberCountBtn.layer.cornerRadius = 15.5f;
- liveMemberCountBtn.clipsToBounds = YES;
- [liveMemberCountBtn addTarget:self action:@selector(youpaifliveMemberCountBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [self.youpaipchatBgView addSubview:liveMemberCountBtn];
- [liveMemberCountBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(-1.0f-19.0f-12.0f);
- make.top.offset(7.0f + StatusBarHeight);
- make.height.offset(31.0f);
- make.width.greaterThanOrEqualTo(31.0f);
- }];
- UILabel *youpaipliveMemberCountL = [[UILabel alloc] init];
- youpaipliveMemberCountL.font = LCFont(12.0f);
- youpaipliveMemberCountL.textColor = [UIColor whiteColor];
- youpaipliveMemberCountL.textAlignment = NSTextAlignmentCenter;
- youpaipliveMemberCountL.text = @"0";
- [liveMemberCountBtn addSubview:youpaipliveMemberCountL];
- self.youpaipliveMemberCountL = youpaipliveMemberCountL;
- [youpaipliveMemberCountL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(7.0f);
- make.top.bottom.offset(0.0f);
- make.right.offset(-7.0f);
- }];
- @weakify(self);
- [self setYoupaipliveMemberCountChangeBlock:^(NSInteger memberCount) {
- @strongify(self);
- self.youpaipliveMemberCountL.text = [NSString stringWithFormat:@"%@",@(memberCount)];
- }];
-
- UIView *youpaiprankBgV = [[UIView alloc] init];
- [self.youpaipchatBgView addSubview:youpaiprankBgV];
- self.youpaiprankBgV = youpaiprankBgV;
- [youpaiprankBgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(liveMemberCountBtn.mas_left).offset(-4.0f);
- // make.right.offset(-7.0f-31.0f-12.0f);
- make.top.offset(7.0f + StatusBarHeight);
- make.height.offset(31.0f);
- make.width.offset(0.0f);
- }];
-
- [self youpaifupdateMemberInfo];
- [self setYoupaipliveMemberListChangeBlock:^(NSArray * _Nonnull members) {
- @strongify(self);
- self.youpaipliveModel.youpaiplive_top_three = [LZLiveTopThreeModel mj_objectArrayWithKeyValuesArray:members];
- [self youpaifupdateMemberInfo];
- }];
- NSMutableArray *arr = [NSMutableArray array];
- if (self.youpaipliveModel.youpaipanchor_rank_info.youpaiptotalMoney.youpaipval.length != 0) {
- [arr addObject:@"totalMoney"];
- }
- if (self.youpaipliveModel.youpaipanchor_rank_info.youpaipgapMoney.youpaipval.length != 0) {
- [arr addObject:@"gapMoney"];
- }
- if (self.youpaipliveModel.youpaipanchor_rank_info.youpaipno.youpaipval.length != 0) {
- [arr addObject:@"no"];
- }
- SDCycleScrollView *youpaipboardCycleView = [[SDCycleScrollView alloc] init];
- youpaipboardCycleView.backgroundColor = [UIColor clearColor];
- youpaipboardCycleView.scrollDirection = UICollectionViewScrollDirectionVertical;
- youpaipboardCycleView.autoScrollTimeInterval = 5.0f/arr.count;
- youpaipboardCycleView.autoScroll = YES;
- youpaipboardCycleView.imageURLStringsGroup = arr.copy;
- youpaipboardCycleView.titleLabelTextColor = [UIColor redColor];
- youpaipboardCycleView.showPageControl = NO;
- youpaipboardCycleView.delegate = self;
- [headerView addSubview:youpaipboardCycleView];
- self.youpaipboardCycleView = youpaipboardCycleView;
- [youpaipboardCycleView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(14.0f);
- make.top.equalTo(anchorInfoBgBtn.mas_bottom).offset(10.0f);
- make.height.offset(20.0f);
- make.width.offset(150.0f);
- }];
- [self setYoupaipliveInfoUpdateBlock:^(NSString * _Nonnull anchor_charm, NSString * _Nonnull fans, NSDictionary * _Nonnull anchor_rank_info) {
- @strongify(self);
- self.youpaipfansCountL.text = [NSString stringWithFormat:@"粉丝:%@",fans];
- self.youpaipliveModel.youpaipanchor_rank_info = [LZLiveAnchorRankInfoModel mj_objectWithKeyValues:anchor_rank_info];
- NSMutableArray *arr = [NSMutableArray array];
- if (self.youpaipliveModel.youpaipanchor_rank_info.youpaiptotalMoney.youpaipval.length != 0) {
- [arr addObject:@"totalMoney"];
- }
- if (self.youpaipliveModel.youpaipanchor_rank_info.youpaipgapMoney.youpaipval.length != 0) {
- [arr addObject:@"gapMoney"];
- }
- if (self.youpaipliveModel.youpaipanchor_rank_info.youpaipno.youpaipval.length != 0) {
- [arr addObject:@"no"];
- }
- self.youpaipboardCycleView.imageURLStringsGroup = arr.copy;
- self.youpaipboardCycleView.autoScrollTimeInterval = 5.0f/arr.count;
- }];
-
- // UIView *userIdBgV = [[UIView alloc] init];
- // userIdBgV.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.2f];
- // userIdBgV.layer.cornerRadius = 8.5f;
- // userIdBgV.clipsToBounds = YES;
- // [self.youpaipchatBgView addSubview:userIdBgV];
- // [userIdBgV mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.right.offset(-12.0f);
- // make.top.equalTo(youpaiprankBgV.mas_bottom).offset(8.0f);
- // make.height.offset(17.0f);
- // }];
-
- // UILabel *userIdL = [[UILabel alloc] init];
- // userIdL.font = LCFont(7.0f);
- // userIdL.textColor = HexColorFromRGB(0xDDDDDD);
- // userIdL.text = [NSString stringWithFormat:@"花舞号 %@",self.youpaipliveModel.user_info.usercode];
- // [self.youpaipchatBgView addSubview:userIdL];
- // [userIdL mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.right.offset(-12.0f);
- // make.top.equalTo(youpaiprankBgV.mas_bottom).offset(3.0f);
- // }];
-
- UIButton *recommendBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- recommendBtn.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.2f];
- recommendBtn.frame = CGRectMake(0, 0, 73.0f, 20.0f);
- [LCTools clipCorner:UIRectCornerTopLeft|UIRectCornerBottomLeft View:recommendBtn size:CGSizeMake(10.0f, 10.0f)];
- [recommendBtn addTarget:self action:@selector(youpaifgoRecommendAnchorPage) forControlEvents:UIControlEventTouchUpInside];
- [self.youpaipchatBgView addSubview:recommendBtn];
- [recommendBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(0.0f);
- make.top.equalTo(anchorInfoBgBtn.mas_bottom).offset(10.0f);
- make.size.mas_offset(CGSizeMake(73.0f, 20.0f));
- }];
-
-
- UILabel *youpaiprecommendL = [[UILabel alloc] init];
- youpaiprecommendL.font = LCBoldFont(11.0f);
- youpaiprecommendL.textColor = HexColorFromRGB(0xEEEEEE);
- youpaiprecommendL.text = @"更多直播";
- [recommendBtn addSubview:youpaiprecommendL];
- [youpaiprecommendL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(6.0f);
- make.top.bottom.offset(0.0f);
- }];
-
- UIImageView *arrowImgV = [[UIImageView alloc] init];
- arrowImgV.image = [UIImage imageNamed:@"vqu_images_L_live_recommend_arrow_left"];
- [recommendBtn addSubview:arrowImgV];
- [arrowImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(youpaiprecommendL.mas_right).offset(1.0f);
- make.centerY.equalTo(recommendBtn.mas_centerY);
- make.size.mas_offset(CGSizeMake(8.0f, 8.0f));
- }];
-
-
- }
- - (void)youpaifupdateMemberInfo{
- [self youpaifeditBtnCountWithCount:self.youpaipliveModel.youpaiplive_top_three.count > 3 ? 3 : self.youpaipliveModel.youpaiplive_top_three.count];
- [self.youpaiprankBgV updateConstraints:^(MASConstraintMaker *make) {
- make.width.offset(self.youpaipmemberBtns.count * 31.0f + (self.youpaipmemberBtns.count - 1.0f) * 4.0f);
- }];
-
- NSArray <UIColor *>*borderColors = @[[HexColorFromRGB(0xFF0000) colorWithAlphaComponent:0.47f],[HexColorFromRGB(0xFFD043) colorWithAlphaComponent:0.47f],[HexColorFromRGB(0x6EF467) colorWithAlphaComponent:0.47f]];
- NSArray <UIColor *>*titleBgColors = @[[HexColorFromRGB(0xF46767) colorWithAlphaComponent:0.41f],[HexColorFromRGB(0xFFC104) colorWithAlphaComponent:0.41f],[HexColorFromRGB(0x6EF467) colorWithAlphaComponent:0.41f]];
- // for (NSInteger i = 0; i < self.youpaipmemberBtns.count; i ++) {
- // YOUPAILZLiveMemberButton *imgBtn = self.youpaipmemberBtns[i];
- // imgBtn.layer.cornerRadius = 15.5f;
- // imgBtn.clipsToBounds = YES;
- // imgBtn.tag = [self.youpaipliveModel.youpaiplive_top_three[i].youpaipid integerValue];
- // [imgBtn addTarget:self action:@selector(youpaifshowUserInfoClick:) forControlEvents:UIControlEventTouchUpInside];
- // [imgBtn sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipliveModel.youpaiplive_top_three[i].youpaipavatar] forState:UIControlStateNormal];
- // imgBtn.frame = CGRectMake(i * 31.0f + i * 4.0f, 0, 31.0f, 31.0f);
- // imgBtn.youpaipcountL.text = self.youpaipliveModel.youpaiplive_top_three[i].youpaipscore;
- // imgBtn.layer.borderColor = borderColors[i].CGColor;
- // imgBtn.layer.borderWidth = 1.0f;
- // imgBtn.youpaipcountL.mj_w = 31.0f;
- // imgBtn.youpaipcountL.backgroundColor = titleBgColors[i];
- // [LCTools clipCorner:UIRectCornerTopLeft|UIRectCornerTopRight View:imgBtn.youpaipcountL size:CGSizeMake(6.0f, 6.0f)];
- // }
- }
- /// 设置FooterView
- - (void)youpaifsetupFooterView{
- UIView *youpaipfooterView = [[UIView alloc] init];
- [self.youpaipchatBgView addSubview:youpaipfooterView];
- [youpaipfooterView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.left.offset(0.0f);
- make.height.offset(40.0f);
- make.bottom.offset(-SafeHeight - 10.0f);
- }];
-
- UIButton *sendMessageBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- sendMessageBtn.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.2f];
- sendMessageBtn.layer.cornerRadius = 20.0f;
- sendMessageBtn.clipsToBounds = YES;
- [sendMessageBtn addTarget:self action:@selector(youpaifsendMessageBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [youpaipfooterView addSubview:sendMessageBtn];
- self.youpaipsendMessageBtn = sendMessageBtn;
- [sendMessageBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.bottom.offset(0.0f);
- make.height.offset(40.0f);
- make.bottom.offset(0.0f);
- make.width.offset(155.0f);
- }];
-
- UILabel *youpaiptextL = [[UILabel alloc] init];
- youpaiptextL.font = LCFont16;
- youpaiptextL.textColor = HexColorFromRGB(0xDDDDDD);
- youpaiptextL.text = @"聊聊天…";
- [sendMessageBtn addSubview:youpaiptextL];
- [youpaiptextL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(16.0f);
- make.top.bottom.offset(0.0f);
- }];
-
- UIButton *moreBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [moreBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_L_live_audience_more"] forState:UIControlStateNormal];
- [moreBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_L_live_audience_more"] forState:UIControlStateHighlighted];
- [moreBtn addTarget:self action:@selector(youpaifmoreBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [youpaipfooterView addSubview:moreBtn];
- [moreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(-12.0f);
- make.top.offset(0.0f);
- make.size.mas_offset(CGSizeMake(40.0f, 40.0f));
- }];
-
- // // 新消息
- // YOUPAILZBadgeButton *messageCountBtn = [YOUPAILZBadgeButton buttonWithType:UIButtonTypeCustom];
- // messageCountBtn.youpaipbadgeSize = CGSizeMake(20.0f, 20.0f);
- // [messageCountBtn setImage:[UIImage imageNamed:@"vqu_images_L_live_new_message"] forState:(UIControlStateNormal)];
- // [messageCountBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_L_live_new_message"] forState:UIControlStateHighlighted];
- // [messageCountBtn addTarget:self action:@selector(youpaifnewMessageBtnClick) forControlEvents:(UIControlEventTouchUpInside)];
- // [youpaipfooterView addSubview:messageCountBtn];
- // self.messageCountBtn = messageCountBtn;
- // [messageCountBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.right.equalTo(moreBtn.mas_left).offset(-9.0f);
- // make.top.offset(0.0f);
- // make.size.mas_offset(CGSizeMake(40.0f, 40.0f));
- // }];
-
- // 礼物
- UIButton *giftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [giftBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_L_live_gift"] forState:UIControlStateNormal];
- [giftBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_L_live_gift"] forState:UIControlStateHighlighted];
- [giftBtn addTarget:self action:@selector(youpaifgiftBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [youpaipfooterView addSubview:giftBtn];
- [giftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(moreBtn.mas_left).offset(-9.0f);
- make.top.offset(0.0f);
- make.size.mas_offset(CGSizeMake(40.0f, 40.0f));
- }];
-
- // // 守护
- // UIButton *guardBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- // [guardBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_L_live_guard"] forState:UIControlStateNormal];
- // [guardBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_L_live_guard"] forState:UIControlStateHighlighted];
- // [guardBtn addTarget:self action:@selector(youpaifguardBtnClick) forControlEvents:UIControlEventTouchUpInside];
- // [youpaipfooterView addSubview:guardBtn];
- // [guardBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.right.equalTo(giftBtn.mas_left).offset(-9.0f);
- // make.top.offset(0.0f);
- // make.size.mas_offset(CGSizeMake(40.0f, 40.0f));
- // }];
-
- if (self.youpaipliveModel.youpaiprecommend_gift.youpaipid.length != 0) { // 节日特别礼物
- UIButton *festivalBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [festivalBtn sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipliveModel.youpaiprecommend_gift.youpaipimg] forState:UIControlStateNormal];
- [festivalBtn addTarget:self action:@selector(youpaiffestivalBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [youpaipfooterView addSubview:festivalBtn];
- [festivalBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(giftBtn.mas_left).offset(-9.0f);
- make.top.offset(0.0f);
- make.size.mas_offset(CGSizeMake(40.0f, 40.0f));
- }];
- }
-
- }
- #pragma mark - Click
- - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
- [self youpaifhideKayboard];
- // UITouch *touch = [touches allObjects].lastObject;
- // CGPoint point = [touch locationInView:self.view];
- // [LZLiveAnimation showAnimationWithPoint:point baseView:self.view];
- }
- - (void)youpaifhandleTapGesture:(UITapGestureRecognizer *)recognizer{
- CGPoint point = [recognizer locationInView:self.view];
- [LZLiveAnimation showAnimationWithPoint:point baseView:self.view];
- }
- /// 关注
- - (void)youpaiffollowBtnClick:(UIButton *)sender{
- [LCCommonHttp followUserId:self.youpaipliveModel.youpaipuser_info.youpaipuser_id liveId:@"1"];
- }
- /// 查看在线人员列表
- - (void)youpaifliveMemberCountBtnClick{
- YOUPAILZLiveMemberListVC *memberVc = [[YOUPAILZLiveMemberListVC alloc] init];
- memberVc.youpaiplive_id = self.youpaipliveModel.youpaiplive_id;
- memberVc.isTouchDismiss = YES;
- memberVc.youpaipisAnchor = NO;
- @weakify(self);
- [memberVc setSelectedMemberBlock:^(YOUPAILZLiveMemberModel * _Nonnull member) {
- @strongify(self);
- [self youpaifshowUserInfoWithUserId:member.youpaipid];
- }];
- [self TFPresentVC:memberVc completion:^{}];
- }
- /// 更多按钮点击事件
- - (void)youpaifmoreBtnClick{
- [self.youpaipmenuView youpaifshowAnimation];
- }
- /// 喇叭
- - (void)youpaifvoice:(BOOL)isOpen{
- if (isOpen) {
- [self.youpaipagoraKit disableAudio];
- }else{
- [self.youpaipagoraKit enableAudio];
- }
- }
- /// 发送消息按钮点击事件
- - (void)youpaifsendMessageBtnClick{
- [self youpaifsendMessageBecomeFirstResponder];
- }
- /// 赠送礼物按钮点击事件
- - (void)youpaifgiftBtnClick{
- //
- YOUPAILZCommonGiftView *view = [YOUPAILZCommonGiftView new];
- view.isTouchDismiss = YES;
- view.youpaipisAnchor = YES;
- view.youpaipcountDown = 3;
- @weakify(self);
- [view setYoupaiplzgiftblock:^(YOUPAILCGiftModel * _Nonnull model, NSInteger count,NSString*categoryID) {
- @strongify(self);
- [LCHttpHelper requestWithURLString:SendGift_New parameters:@{@"type":@(4),@"to_uid":self.youpaipliveModel.youpaipuser_info.youpaipuser_id,@"gift_id":model.youpaipid,@"num":@(count),@"live_id":self.youpaipliveModel.youpaiplive_id,@"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) {
-
- }];
-
- }];
-
- [view setYoupaiptouchAdvertBlock:^(YOUPAILCBannerModel * _Nonnull bannerModel) {
- @strongify(self);
- if (bannerModel.youpaiplink_type==1) {
- ZCBaseWebVC* baseWeb = [[ZCBaseWebVC alloc]init];
- baseWeb.contentUrl = bannerModel.youpaiplink_url;
- self.youpaipisNotPanClose = YES;
- [self.navigationController pushViewController:baseWeb animated:YES];
- }else if (bannerModel.youpaiplink_type==2||bannerModel.youpaiplink_type==3){
- [self youpaifpageToStr:bannerModel.youpaiplink_url];
- }
-
- }];
- [self TFPresentVC:view completion:^{
-
-
- }];
- }
- /// 守护按钮点击事件
- - (void)youpaifguardBtnClick{
- @weakify(self);
- [LCHttpHelper requestWithURLString:UserShowPage parameters:@{@"user_id":[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id,@"no_visitor":@"1"} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- @strongify(self);
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- YOUPAILCUserShowModel *showModel = [YOUPAILCUserShowModel mj_objectWithKeyValues:[dict objectForKey:@"data"]];
- YOUPAILPGuardHerVC *VC= [[YOUPAILPGuardHerVC alloc]init];
- VC.youpaipdelegate = self;
- VC.youpaipuser_id = self.youpaipliveModel.youpaipuser_info.youpaipuser_id;
- VC.vWidth = KScreenWidth-54;
- VC.vHeight = ((KScreenWidth-54)*165)/321.0+261.5;
- VC.youpaipinfoModel = showModel.youpaipguard;
- VC.youpaipliveid = self.youpaipliveModel.youpaiplive_id;
- VC.isTouchDismiss = YES;
- if(VC.youpaipinfoModel!=nil)
- [self TFPresentVC:VC completion:^{
-
- }];
- }else{
- [ZCHUDHelper showTitle:[dict objectForKey:@"message"]];
- }
- } failure:^(NSError *error) {
- [ZCHUDHelper showTitle:error.localizedDescription];
- }];
- }
- /// 节日特别礼物点击事件
- - (void)youpaiffestivalBtnClick{
- if ([LCSaveData getLiveSendFirstRecommendGift] != YES) {
- YOUPAILZLiveSendFestivalAlertVC *VC= [[YOUPAILZLiveSendFestivalAlertVC alloc]init];
- VC.isTouchDismiss = YES;
- VC.youpaipgiftName = self.youpaipliveModel.youpaiprecommend_gift.youpaipname;
- VC.youpaippriceStr = [NSString stringWithFormat:@"%@",self.youpaipliveModel.youpaiprecommend_gift.youpaipprice];
- @weakify(self);
- [VC setYoupaipconfirmClickBlock:^(BOOL youpaipisSelect) {
- @strongify(self);
- if (youpaipisSelect) {
- [LCSaveData saveLiveSendFirstRecommendGift:YES];
- }
- [self youpaifsendFestivalGift];
- }];
- [self TFPresentVC:VC completion:^{
- }];
- }else{
- [self youpaifsendFestivalGift];
- }
- }
- - (void)youpaifsendFestivalGift{
- NSMutableDictionary *params = @{@"gift_type_id":@(1),@"to_uid":self.youpaipliveModel.youpaipuser_info.youpaipuser_id,@"gift_id":self.youpaipliveModel.youpaiprecommend_gift.youpaipid,@"num":@(1),@"live_id":self.youpaipliveModel.youpaiplive_id}.mutableCopy;
- [LCHttpHelper requestWithURLString:SendGift_New parameters:params.copy 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) {
-
- }];
- }
- /// 点击新消息数
- - (void)youpaifnewMessageBtnClick{
- // YOUPAILZLiveAudienceMessageListVC *vc = [[YOUPAILZLiveAudienceMessageListVC alloc] init];
- // ZCBaseNavigationVC *navigationVC = [[ZCBaseNavigationVC alloc] initWithRootViewController:vc];
- // [self TFPresentViewController:navigationVC presentSize:CGSizeMake(KScreenWidth, KScreenHeight * 0.6f) direction:TFDirectionBottom completion:^{
- //
- // }];
- }
- /// 更新信息数
- - (void)youpaifupdateUnread{
- NSInteger badge = [[NIMSDK sharedSDK].conversationManager allUnreadCount];
- self.youpaipmessageCountBtn.youpaipbadgeValue = badge;
- }
- /// 获取用户信息
- - (void)youpaifshowUserInfoClick:(UIButton *)sender{
- [self youpaifshowUserInfoWithUserId:[NSString stringWithFormat:@"%@",@(sender.tag)]];
- }
- #pragma mark - SDCycleScrollViewDelegate
- //- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index{
- //
- //}
- - (Class)customCollectionViewCellClassForCycleScrollView:(SDCycleScrollView *)view{
- return [YOUPAILZLiveBoardCycleViewCell class];
- }
- - (void)setupCustomCell:(UICollectionViewCell *)cell forIndex:(NSInteger)index cycleScrollView:(SDCycleScrollView *)view{
- YOUPAILZLiveBoardCycleViewCell *boardCell = (YOUPAILZLiveBoardCycleViewCell *)cell;
- if (view == self.youpaipboardCycleView) {
- NSString *type = view.imageURLStringsGroup[index];
- @weakify(self);
- [boardCell youpaifreloadWithModel:[self.youpaipliveModel.youpaipanchor_rank_info valueForKey:type] type:type];
- [boardCell setYoupaipclickBlock:^{
- @strongify(self);
- YOUPAILZLiveAnchorHotWindow *memberVc = [[YOUPAILZLiveAnchorHotWindow alloc] init];
- memberVc.youpaiplive_id = self.youpaipliveModel.youpaiplive_id;
- memberVc.isTouchDismiss = YES;
- memberVc.youpaipisAnchor = NO;
-
- [memberVc setSelectedMemberBlock:^(YOUPAILZLiveMemberModel * _Nonnull member) {
- @strongify(self);
- [self youpaifshowUserInfoWithUserId:member.youpaipid];
- }];
- [self TFPresentVC:memberVc completion:^{}];
-
- }];
- }
-
- }
- #pragma mark - ZYGuardHerDelegate
- - (void)youpaifaddGuardSuccess{
-
- }
- #pragma mark - NIMConversationManagerDelegate
- - (void)didAddRecentSession:(NIMRecentSession *)recentSession
- totalUnreadCount:(NSInteger)totalUnreadCount{
- [self youpaifupdateUnread];
- }
- - (void)didUpdateRecentSession:(NIMRecentSession *)recentSession
- totalUnreadCount:(NSInteger)totalUnreadCount{
- [self youpaifupdateUnread];
- }
- - (void)didRemoveRecentSession:(NIMRecentSession *)recentSession
- totalUnreadCount:(NSInteger)totalUnreadCount{
- [self youpaifupdateUnread];
- }
- - (void)messagesDeletedInSession:(NIMSession *)session{
- [self youpaifupdateUnread];
- }
- - (void)allMessagesDeleted{
- [self youpaifupdateUnread];
- }
- /// 设置用户角色
- - (AgoraClientRole)youpaifclientRole{
- return AgoraClientRoleAudience;
- }
- /// 顶部榜单相关函数
- - (void)youpaifeditBtnCountWithCount:(NSInteger)count{
- if (count >= self.youpaipmemberBtns.count) {
- [self youpaifaddBtnWithCount:count - self.youpaipmemberBtns.count];
- }else{
- [self youpaifdeleteBtnWithCount:self.youpaipmemberBtns.count - count];
- }
- }
- - (void)youpaifdeleteBtnWithCount:(NSInteger)count{
- if (count != 0) {
- for (NSInteger i = 0; i < count; i ++) {
- YOUPAILZLiveMemberButton *btn = self.youpaipmemberBtns.lastObject;
- [self.youpaipmemberBtns removeLastObject];
- [btn removeFromSuperview];
- }
- }
- }
- - (void)youpaifaddBtnWithCount:(NSInteger)count{
- for (NSInteger i = 0; i < count; i ++) {
- [self youpaifcreateBtn];
- }
- }
- - (void)youpaifcreateBtn{
- YOUPAILZLiveMemberButton *btn = [[YOUPAILZLiveMemberButton alloc] init];
- btn.imageView.contentMode = UIViewContentModeScaleAspectFill;
- btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentFill;
- btn.contentVerticalAlignment = UIControlContentVerticalAlignmentFill;
- // btn.layer.cornerRadius = 3.0f;
- // btn.clipsToBounds = YES;
- [self.youpaiprankBgV addSubview:btn];
- [self.youpaipmemberBtns addObject:btn];
- }
- - (NSMutableArray<YOUPAILZLiveMemberButton *> *)youpaipmemberBtns{
- if (!_youpaipmemberBtns) {
- _youpaipmemberBtns = [NSMutableArray array];
- }
- return _youpaipmemberBtns;
- }
- - (YOUPAILZAudienceMenuView *)youpaipmenuView{
- if (!_youpaipmenuView) {
- _youpaipmenuView = [[YOUPAILZAudienceMenuView alloc] initWithSupView:self.view];
- @weakify(self);
- // 隐藏聊天记录
- [_youpaipmenuView setYoupaiphideChatMessageBlock:^{
- @strongify(self);
- [self youpaifhiddenChatList];
- }];
- // 黑名单
- [_youpaipmenuView setYoupaipblocklistBlock:^{
- @strongify(self);
- [LCCommonHttp blackUserId:self.youpaipliveModel.youpaipuser_info.youpaipuser_id];
- }];
- // 举报
- [_youpaipmenuView setYoupaipreportBlock:^{
- @strongify(self);
- YOUPAILCReportVC* report = [[YOUPAILCReportVC alloc]init];
- report.youpaipreport_uid = self.youpaipliveModel.youpaipuser_info.youpaipuser_id;
- report.youpaiptype = 5;
- [self.navigationController pushViewController:report animated:YES];
- }];
- // 静音
- [_youpaipmenuView setYoupaipcloseVoiceBlock:^(BOOL open) {
- @strongify(self);
- [self youpaifvoice:open];
- }];
- // 结束直播
- [_youpaipmenuView setYoupaipcloseBlock:^{
- @strongify(self);
- [self youpaifendLive];
- }];
- }
- return _youpaipmenuView;
- }
- /// 退出直播
- - (void)youpaifendLive{
- [self youpaifleaveChannel];
- [self.navigationController popViewControllerAnimated:YES];
- }
- - (void)youpaifendLiveTwo{
- [self youpaifleaveChannel];
- NSArray *vcs = self.navigationController.viewControllers;
- NSMutableArray *nvcs = [NSMutableArray array];
- for (UIViewController *vc in vcs) {
- if (![vc isKindOfClass:[self class]]) {
- [nvcs addObject:vc];
- }
- }
- [self.navigationController setViewControllers:nvcs.copy];
- }
- /// 请求直播结束后数据
- - (void)youpaifrequestLiveCloseData{
- @weakify(self);
- [LCHttpHelper requestWithURLString:GetUserCloseLive parameters:@{@"id":self.youpaipliveModel.youpaiplive_id} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- @strongify(self);
- YOUPAILZLiveCloseModel *model = [YOUPAILZLiveCloseModel mj_objectWithKeyValues:[dict objectForKey:@"data"]];
- YOUPAILZLiveCloseAudienceWindow *vc = [[YOUPAILZLiveCloseAudienceWindow alloc] initWithModel:model];
- [vc setYoupaipcloseBlock:^{
- [self.navigationController popViewControllerAnimated:YES];
- }];
- [vc setYoupaipitemClickBlock:^(YOUPAILZLiveListItemModel * _Nonnull itemModel) {
- [self youpaifjoinLiveWithRoomId:itemModel.youpaiproom_id];
- }];
- vc.isTouchDismiss = NO;
- [self TFPresentVC:vc completion:^{}];
- }else{
- [ZCHUDHelper showTitle:[dict objectForKey:@"message"]];
- }
- } failure:^(NSError *error) {
- [ZCHUDHelper showTitle:error.localizedDescription];
- }];
- }
- // 观众加入直播间
- - (void)youpaifjoinLiveWithRoomId:(NSString *)roomId{
-
- [ZCHUDHelper showWithStatus:nil];
- @weakify(self);
- [LCHttpHelper requestWithURLString:JoinLive parameters:@{@"room_id":roomId} needToken:YES type:HttpRequestTypePost success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code == 0) {
- @strongify(self);
- [ZCHUDHelper dismiss];
- [[YOUPAILZChatRoomManager shareManager] youpaifcloseChatRoom];
- YOUPAILZLiveModel *youpaipliveModel = [YOUPAILZLiveModel mj_objectWithKeyValues:[dict objectForKey:@"data"]];
- YOUPAILZLiveAudienceVC *audienceVC = [[YOUPAILZLiveAudienceVC alloc] initWithModel:youpaipliveModel];
- audienceVC.hidesBottomBarWhenPushed = YES;
- NSArray *vcs = self.navigationController.viewControllers;
- NSMutableArray <UIViewController *>*nVcs = [NSMutableArray array];
- for (UIViewController *vc in vcs) {
- if (![vc isKindOfClass:[YOUPAILZLiveAudienceVC class]]) {
- [nVcs addObject:vc];
- }
- }
-
- [nVcs addObject:audienceVC];
- [self.navigationController setViewControllers:nVcs.copy animated:YES];
- }else{
- [ZCHUDHelper showTitle:[dict objectForKey:@"message"]];
- }
- } failure:^(NSError *error) {
- [ZCHUDHelper showTitle:error.localizedDescription];
- }];
- }
- /// 更多推荐女神
- - (void)youpaifgoRecommendAnchorPage{
- self.sx_disableInteractivePop = YES;
- @weakify(self);
- [YOUPAILZRecommendAnchorView youpaifshowWithSuperView:self.view currentLiveId:self.youpaipliveModel.youpaiplive_id selectedBlock:^(YOUPAILZLiveListItemModel *model) {
- @strongify(self);
- [self youpaifjoinLiveWithRoomId:model.youpaiproom_id];
- } hiddenBlock:^{
- @strongify(self);
- self.sx_disableInteractivePop = NO;
- }];
- }
- @end
|