123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676 |
- //
- // YOUPAILCBaseDynamicVC.m
- // LiveChat
- //
- // Created by 张灿 on 2018/9/7.
- // Copyright © 2018年 caicai. All rights reserved.
- //
- #import "YOUPAILCBaseDynamicVC.h"
- #import "YOUPAILCDynamicCell.h"
- #import "YOUPAILCReportVC.h"
- #import "YOUPAILZUserShowVC.h"
- #import "YOUPAILCGiftSendView.h"
- #import "YOUPAILCIMSessionVC.h"
- #import "YOUPAILCTabBarVC.h"
- #import "YOUPAILCDynamicSendVideoByLinkVC.h"
- #import "YOUPAILZCommonGiftView.h"
- #import "UIViewController+TFPresent.h"
- #import "YBIBVideoData.h"
- #import "YOUPAIXRWalletVC.h"
- #import "LZAlertWindow.h"
- #import "YOUPAIHRRechargePayWindow.h"
- @interface YOUPAILCBaseDynamicVC ()<UITableViewDelegate,UITableViewDataSource,LCDynamicCellDelegate>
- @property(nonatomic,assign)NSInteger youpaipcurrentPage;
- @property(nonatomic,assign)NSInteger youpaipcurrentSize;
- @property(nonatomic,assign)NSInteger youpaiptotalPage;
- @property(nonatomic,strong)NSMutableArray* youpaipdynamicArray;
- @property(nonatomic,strong)NSMutableArray* youpaipdynamicIdArray;
- @property (nonatomic,strong) NSMutableDictionary *youpaipheightDict;
- @end
- @implementation YOUPAILCBaseDynamicVC
- -(void)dealloc
- {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- }
- - (NSMutableDictionary *)youpaipheightDict{
- if (_youpaipheightDict == nil) {
- _youpaipheightDict = [NSMutableDictionary dictionary];
- }
- return _youpaipheightDict;
- }
- -(void)youpaifsetDynamicType:(NSInteger)type andGender:(NSInteger)gender
- {
- self.youpaiptype = type;
- self.youpaipgender = gender;
- [self.tableView.mj_header beginRefreshing];
- }
- - (void)youpaifsetupTableView{
-
- self.tableView.frame = CGRectZero;
- self.tableView.showsVerticalScrollIndicator = NO;
- self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- self.tableView.estimatedRowHeight = 100;
- self.tableView.estimatedSectionFooterHeight = 0.0f;
- self.tableView.estimatedSectionHeaderHeight = 0.0f;
- self.tableView.delegate = self;
- self.tableView.dataSource= self;
- self.tableView.backgroundColor = LZFAFAFCColor;
- self.isAllowScroll = YES;
- [self.view addSubview:self.tableView];
- [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.top.bottom.right.offset(0.0f);
- }];
- self.tableView.mj_header = self.refreshHeader;
- self.tableView.mj_footer = self.noLoadMoreFooter;
-
- // self.tableView.mj_header = [LCRefreshDotGiftHeader headerWithRefreshingTarget:self refreshingAction:@selector(youpaifloadNewData)];
- // MJRefreshAutoNormalFooter* normalFooter = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(youpaifloadMoreData)];
- // [normalFooter setTitle:@"正在加载..." forState:(MJRefreshStateRefreshing)];
- // [normalFooter setTitle:@"" forState:(MJRefreshStateNoMoreData)];
- // self.tableView.mj_footer = normalFooter;
- // self.tableView.mj_footer.automaticallyHidden = YES;
- }
- /// 下拉刷新回调方法,具体实现代码需要子类实现
- - (void)headerRefreshing{
- self.youpaipcurrentPage = 1;
- [self getDynamicListData];
- }
- /// 上拉加载回调方法,具体实现代码需要子类实现
- - (void)footerRefreshing{
- self.youpaipcurrentPage++;
- [self getDynamicListData];
- }
- - (void)getDynamicListData{
- [LCHttpHelper requestWithURLString:DynamicList parameters:@{
- @"page":@(self.youpaipcurrentPage),
- @"type":@(self.youpaiptype),
- @"gender":@(self.youpaipgender)
- } needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code == 0) {
- NSDictionary *data = [dict dictionaryValueForKey:@"data" defaultValue:@{}];
- NSArray *result = [data arrayValueForKey:@"list" defaultValue:@[]];
- if (self.youpaipcurrentPage == 1) {
- [self.youpaipheightDict removeAllObjects];
- [self.youpaipdynamicArray removeAllObjects];
- [self.youpaipdynamicIdArray removeAllObjects];
- }
- //
- // NSArray* array = [[dict objectForKey:@"data"]objectForKey:@"list"];
- NSMutableArray* modelArray = [YOUPAILCDynamicModel mj_objectArrayWithKeyValuesArray:result];
- NSMutableArray* tempArray = [NSMutableArray arrayWithArray:(NSArray*)modelArray];
- for (YOUPAILCDynamicModel* model in modelArray) {
- if ([self.youpaipdynamicIdArray containsObject:model.youpaipdynamicId]) {
- [tempArray removeObject:model];
- }else{
- [self.youpaipdynamicIdArray addObject:model.youpaipdynamicId];
- }
- }
- [self.youpaipdynamicArray addObjectsFromArray:tempArray];
- // self.youpaiptotalPage = [[[dict objectForKey:@"data"]objectForKey:@"total_page"]integerValue];
- // self.youpaipcurrentPage = [[[dict objectForKey:@"data"]objectForKey:@"page"]integerValue];
- [self.tableView reloadData];
- self.tableView.mj_footer = result.count < self.youpaipcurrentSize ? self.noLoadMoreFooter : self.loadMoreFooter;
- // if (self.youpaipcurrentPage>=self.youpaiptotalPage) {
- // [self.tableView.mj_footer endRefreshingWithNoMoreData];
- // self.tableView.mj_footer.hidden = YES;
- // }
- if (self.youpaipdynamicArray.count != 0) {
- [self.tableView lz_hideEmptyView];
- }else{
- [self.tableView lz_showEmptyViewWithImage:[UIImage imageNamed:@"vqu_images_not_dynamic_data"] content:@"暂无发布动态"];
- }
- [self.tableView.mj_header endRefreshing];
- [self.tableView.mj_footer endRefreshing];
- }else{
- [self.tableView.mj_header endRefreshing];
- [self.tableView.mj_footer endRefreshing];
- }
- } failure:^(NSError *error) {
- if(self.youpaipcurrentPage != 1){
- self.youpaipcurrentPage--;
- }
- [self.tableView.mj_header endRefreshing];
- [self.tableView.mj_footer endRefreshing];
- }];
- }
- - (void)youpaifloadNewData{
- self.tableView.mj_footer.hidden = YES;
- [self.tableView.mj_footer endRefreshing];//先结束上拉,假如有的话
- self.youpaipcurrentPage = 1;
- [LCHttpHelper requestWithURLString:DynamicList parameters:@{@"page":@(self.youpaipcurrentPage),@"type":@(self.youpaiptype),@"gender":@(self.youpaipgender)} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- [self.youpaipheightDict removeAllObjects];
- [self.youpaipdynamicArray removeAllObjects];
- [self.youpaipdynamicIdArray removeAllObjects];
- NSArray* array = [[dict objectForKey:@"data"]objectForKey:@"list"];
- NSMutableArray* modelArray = [YOUPAILCDynamicModel mj_objectArrayWithKeyValuesArray:array];
- NSMutableArray* tempArray = [NSMutableArray arrayWithArray:(NSArray*)modelArray];
- for (YOUPAILCDynamicModel* model in modelArray) {
- if ([self.youpaipdynamicIdArray containsObject:model.youpaipdynamicId]) {
- [tempArray removeObject:model];
- }else{
- [self.youpaipdynamicIdArray addObject:model.youpaipdynamicId];
- }
- }
- [self.youpaipdynamicArray addObjectsFromArray:tempArray];
- self.youpaiptotalPage = [[[dict objectForKey:@"data"]objectForKey:@"total_page"]integerValue];
- self.youpaipcurrentPage = [[[dict objectForKey:@"data"]objectForKey:@"page"]integerValue];
- [self.tableView reloadData];
- if (self.youpaipcurrentPage>=self.youpaiptotalPage) {
- [self.tableView.mj_footer endRefreshingWithNoMoreData];
- self.tableView.mj_footer.hidden = YES;
- }
- if (self.youpaipdynamicArray.count != 0) {
- [self.tableView lz_hideEmptyView];
- }else{
- [self.tableView lz_showEmptyViewWithImage:[UIImage imageNamed:@"vqu_images_not_dynamic_data"] content:@"暂无发布动态"];
- }
- [self.tableView.mj_header endRefreshing];
- }else{
- [self.tableView.mj_header endRefreshing];
- }
- } failure:^(NSError *error) {
- [self.tableView.mj_header endRefreshing];
- }];
- }
- - (void)youpaifloadMoreData{
- //先结束下拉 假如有的话
- [self.tableView.mj_header endRefreshing];
- self.tableView.mj_footer.hidden = YES;
- [self.tableView.mj_footer endRefreshing];
- self.youpaipcurrentPage+=1;
- // AppDelegate* app =(AppDelegate*)[UIApplication sharedApplication].delegate;
- // YOUPAILCTabBarVC* tabbar = [[YOUPAILCTabBarVC alloc]init];
- // app.window.rootViewController = tabbar;
- [LCHttpHelper requestWithURLString:DynamicList parameters:@{@"page":@(self.youpaipcurrentPage),@"type":@(self.youpaiptype),@"gender":@(self.youpaipgender)} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- NSArray* array = [[dict objectForKey:@"data"]objectForKey:@"list"];
- NSMutableArray* modelArray = [YOUPAILCDynamicModel mj_objectArrayWithKeyValuesArray:array];
- NSMutableArray* tempArray = [NSMutableArray arrayWithArray:(NSArray*)modelArray];
- for (YOUPAILCDynamicModel* model in modelArray) {
- if ([self.youpaipdynamicIdArray containsObject:model.youpaipdynamicId]) {
- [tempArray removeObject:model];
- }else{
- [self.youpaipdynamicIdArray addObject:model.youpaipdynamicId];
- }
- }
- [self.youpaipdynamicArray addObjectsFromArray:tempArray];
- self.youpaiptotalPage = [[[dict objectForKey:@"data"]objectForKey:@"total_page"]integerValue];
- self.youpaipcurrentPage = [[[dict objectForKey:@"data"]objectForKey:@"page"] integerValue];
- [self.tableView reloadData];
- if (self.youpaipcurrentPage>=self.youpaiptotalPage) {
- [self.tableView.mj_footer endRefreshingWithNoMoreData];
- self.tableView.mj_footer.hidden = YES;
- }
-
- [self.tableView.mj_header endRefreshing];
- }else{
- [self.tableView.mj_header endRefreshing];
- }
- } failure:^(NSError *error) {
- [self.tableView.mj_header endRefreshing];
- }];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.view.backgroundColor = LZFAFAFCColor;
- self.youpaipdynamicArray = [NSMutableArray array];
- self.youpaipdynamicIdArray = [NSMutableArray array];
- [self youpaifsetupTableView];
- [self.tableView.mj_header beginRefreshing];
- self.youpaipcurrentPage = 1;
- self.youpaipcurrentSize = 10;
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youpaiftoTopAction) name:@"dynamicToTop" object:nil];//置顶
-
- }
- -(void)youpaiftoTopAction
- {
- if (self.youpaipdynamicArray.count != 0) {
- NSIndexPath* indexPat = [NSIndexPath indexPathForRow:0 inSection:0];
- [self.tableView scrollToRowAtIndexPath:indexPat atScrollPosition:UITableViewScrollPositionBottom animated:YES];
- }
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
- CGFloat height = 9.0f;
- if (self.youpaipdynamicArray.count != 0) {
- YOUPAILCDynamicModel* model = self.youpaipdynamicArray[section];
- if (model.youpaipstatus == 0) {
- height += 27.0f;
- }
- }
- return height;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
- return CGFLOAT_MIN;
- }
- -(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
-
- UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 27.0f + 9.0f)];
-
- UIView *headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 9.0f, KScreenWidth, 27)];
- headerView.backgroundColor = [UIColor whiteColor];
- [v addSubview:headerView];
- //bg
- UIView *bgView = [UIView new];
- [headerView addSubview:bgView];
- [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.mas_equalTo(0);
- }];
- bgView.backgroundColor = [UIColor whiteColor];
-
- //icon
- UIImageView *iconImage = [UIImageView new];
- [bgView addSubview:iconImage];
- [iconImage mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(16);
- make.centerY.mas_equalTo(0);
- make.size.mas_equalTo(CGSizeMake(15, 15));
- }];
- iconImage.image = [UIImage imageNamed:@"vqu_images_D_dynamic_hint"];
- iconImage.contentMode = UIViewContentModeScaleAspectFill;
- iconImage.clipsToBounds = YES;
- //title
- UILabel *titleLabel = [UILabel new];
- [bgView addSubview:titleLabel];
- [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(iconImage.mas_right).offset(6);
- make.centerY.mas_equalTo(0);
- }];
- titleLabel.text = @"动态将在审核后发布";
- titleLabel.textColor = HexColorFromRGB(0xFFA68B);
- titleLabel.font = [UIFont systemFontOfSize:12];
- YOUPAILCDynamicModel* model = self.youpaipdynamicArray[section];
- if (model.youpaipstatus == 0) {
- //1676
- return v;
- }else{
- return [UIView new];
- }
-
- }
- - (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return 150;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- CGFloat height;
- YOUPAILCDynamicModel* model =self.youpaipdynamicArray[indexPath.section];
- NSNumber* number =[self.youpaipheightDict objectForKey:model.youpaipdynamicId];
- if (number && [number floatValue]>0) {
- height = [number floatValue];
- }else{
- height = [YOUPAILCDynamicCell youpaifcellHeightWithModel:self.youpaipdynamicArray[indexPath.section]];
- [self.youpaipheightDict setObject:[NSNumber numberWithFloat:(float)height] forKey:model.youpaipdynamicId];
- }
- return height;
- }
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return self.youpaipdynamicArray.count;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- // NSLog(@"数组数量 == %ld",self.youpaipdynamicArray.count);
- return 1;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- YOUPAILCDynamicCell* cell = [[YOUPAILCDynamicCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"YOUPAILCDynamicCell"];
- YOUPAILCDynamicModel* model = self.youpaipdynamicArray[indexPath.section];
- cell.youpaipdelegate = self;
- cell.youpaipcurrentIndex = indexPath.section;
- cell.youpaipdynamicModel = model;
- cell.backgroundColor = [UIColor whiteColor];
- return cell;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- //动态无响应事件
- }
- - (void)youpaifclickReward:(YOUPAILCDynamicModel*)model{
- if ([[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id isEqualToString:model.youpaipuser_id]) {
- [ZCHUDHelper showTitle:@"不能赠送自己"];
- }else{
- YOUPAILCGiftSendView* sendView = [[YOUPAILCGiftSendView alloc]initWithModel:nil type:1];
- //modify by leo fix bug 20191009
- sendView.youpaipalertWindow.hidden = NO;
- // sendView.alertWindow.rootViewController = self;
- sendView.youpaipsendMultiGift = ^(NSString *giftId, NSInteger count) {
- [LCHttpHelper requestWithURLString:DynamicSendGift parameters:@{@"num":@(count),@"dynamic_id":model.youpaipdynamicId} 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) {
-
- }];
- };
- [sendView youpaifshow];
- }
- }
- -(void)youpaifclickImVideo:(YOUPAILCDynamicModel *)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,@"skill_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)youpaifclickImChat:(YOUPAILCDynamicModel *)model{
- [self goChatPageWithUserId:model.youpaipuser_id];
- }
- - (void)goChatPageWithUserId:(NSString *)userId{
- @weakify(self);
- if (![LCTools isGirlsRealNameAuthentication]) {
- return;
- };
-
- NIMSession *session = [NIMSession session:userId type:NIMSessionTypeP2P];
- if (session) {
- [ZCHUDHelper show];
- [[[NIMSDK sharedSDK] userManager] fetchUserInfos:@[session.sessionId] completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
- @strongify(self);
- [ZCHUDHelper dismiss];
- YOUPAILCIMSessionVC *vc = [[YOUPAILCIMSessionVC alloc] initWithSession:session];
- vc.type = @"2";
- [self.navigationController pushViewController:vc animated:YES];
- }];
- }
-
- // [UMengRecordTool umengEventCountWithId:PrivateChatDynamic];
- // [LCHttpHelper requestWithURLString:IsChat parameters:@{@"user_id":userId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- // NSDictionary* dict = (NSDictionary*)responseObject;
- // NSInteger code = [[dict objectForKey:@"code"] integerValue];
- // if (code==0) {//成功
- // NSInteger is_chat = [[[dict objectForKey:@"data"] objectForKey:@"is_chat"] integerValue];
- // NSString *msg = [[dict objectForKey:@"data"] objectForKey:@"msg"];
- // @strongify(self);
- // if (is_chat == 0) { /// 0不可以 1可以私信
- // LZAlertAction *cancelAction = [LZAlertAction actionWithTitle:@"再想想" handler:^(LZAlertAction *action) {
- //
- // }];
- // cancelAction.cornerRadius = 5.0f;
- // cancelAction.color = LZ273145Color;
- // cancelAction.bgColor = LZF5F4F7Color;
- // LZAlertAction *confimAction = [LZAlertAction actionWithTitle:@"去充值" handler:^(LZAlertAction *action) {
- // @strongify(self);
- // YOUPAIHRRechargePayWindow *payWindow = [YOUPAIHRRechargePayWindow new];
- // payWindow.isTouchDismiss = NO;
- // [self.navigationController TFPresentVC:payWindow completion:^{
- //
- // }];
- // }];
- // confimAction.cornerRadius = 5.0f;
- // confimAction.color = [UIColor whiteColor];
- // confimAction.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 105.0f) / 2.0f, 48.0f) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:GradientLeftToRight]];
- // LZAlertWindow *alert = [LZAlertWindow alertWithTitle:@"提示" content:msg action:@[cancelAction,confimAction]];
- // alert.contentTextAlignment = NSTextAlignmentCenter;
- // [self TFPresentVC:alert completion:^{}];
- // }else{
- // [UMengRecordTool umengEventCountWithId:InitiatePrivateChat];
- // NIMSession *session = [NIMSession session:userId type:NIMSessionTypeP2P];
- // if (session) {
- // [ZCHUDHelper show];
- // [[[NIMSDK sharedSDK] userManager] fetchUserInfos:@[session.sessionId] completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
- // @strongify(self);
- // [ZCHUDHelper dismiss];
- // YOUPAILCIMSessionVC *vc = [[YOUPAILCIMSessionVC alloc] initWithSession:session];
- // vc.type = @"2";
- // [self.navigationController pushViewController:vc animated:YES];
- // }];
- // }
- // }
- // }
- // } failure:^(NSError *error) {
- // }];
- }
- - (void)youpaifclickAvatar:(YOUPAILCDynamicModel*)model{
- // LCUserShowVC* userShow = [[LCUserShowVC alloc]init];
- // YOUPAILZUserShowVC *userShow = [[YOUPAILZUserShowVC alloc] init];
- // userShow.youpaipuserId = model.youpaipuser_id;
- // [self.navigationController pushViewController:userShow animated:YES];
-
- YMPersonalPageViewModel *personalPageVM = [[YMPersonalPageViewModel alloc]initWithParams:@{
- ParamsId:@([model.youpaipuser_id intValue])
- }];
- [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_PERSONAL_PAGE) withUserInfo:@{
- RouterViewModel:personalPageVM
- } completion:nil];
- }
- -(void)youpaifclickAttention:(YOUPAILCDynamicModel *)model
- {
- if (model.youpaipis_follow == 0) {//+关注
- [LCCommonHttp followUserId:model.youpaipuser_id];
- model.youpaipis_follow = 1;
- [self.tableView reloadData];
- }else{
- [LCCommonHttp followUserId:model.youpaipuser_id];
- model.youpaipis_follow = 0;
- [self.tableView reloadData];
- }
-
- }
- - (void)youpaifclickMoreBtn:(YOUPAILCDynamicModel*)model index:(NSInteger)index{
- NSMutableArray* actionArray = [NSMutableArray array];
-
- if ([model.youpaipuser_id isEqualToString:[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id]) {
- ZCAlertAction* action = [ZCAlertAction actionWithTitle:@"删除" andblock:^{//删除动态
- [LCHttpHelper requestWithURLString:DynamicDelete parameters:@{@"dynamic_id":model.youpaipdynamicId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
-
- [self.youpaipdynamicArray removeObject:model];
- [self.youpaipdynamicIdArray removeObject:model.youpaipdynamicId];
- [self.youpaipheightDict removeObjectForKey:model.youpaipdynamicId];
- [self.tableView reloadData];
-
-
- }
- } failure:^(NSError *error) {
- }];
- }];
- [actionArray addObject:action];
- }else{
- if ([[LCSaveData getServiceIdArr] containsObject:[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id]) {
- ZCAlertAction* action1 = [ZCAlertAction actionWithTitle:@"删除整条" andblock:^{//删除动态
- [LCHttpHelper requestWithURLString:DynamicDelete parameters:@{@"dynamic_id":model.youpaipdynamicId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- [self.youpaipdynamicArray removeObject:model];
- [self.youpaipdynamicIdArray removeObject:model.youpaipdynamicId];
- [self.youpaipheightDict removeObjectForKey:model.youpaipdynamicId];
- NSIndexPath *reloadIndexPath = [NSIndexPath indexPathForRow:index inSection:0];
- [self.tableView deleteRowsAtIndexPaths:@[reloadIndexPath] withRowAnimation:(UITableViewRowAnimationNone)];
- }
- } failure:^(NSError *error) {
-
- }];
- }];
- [actionArray addObject:action1];
-
- ZCAlertAction* action2 = [ZCAlertAction actionWithTitle:@"删除文字" andblock:^{//删除动态
- [LCHttpHelper requestWithURLString:DynamicDeleteLower parameters:@{@"type":@"1",@"info_id":model.youpaipdynamicId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- model.youpaipcontent = @"";
- NSIndexPath *reloadIndexPath=[NSIndexPath indexPathForRow:index inSection:0];
- [self.tableView reloadRowsAtIndexPaths:@[reloadIndexPath] withRowAnimation:UITableViewRowAnimationNone];
- }
- } failure:^(NSError *error) {
-
- }];
- }];
- [actionArray addObject:action2];
- }
-
- ZCAlertAction* reportAction = [ZCAlertAction actionWithTitle:@"举报该条动态" andblock:^{//举报
- YOUPAILCReportVC* report = [[YOUPAILCReportVC alloc]init];
- report.youpaipreport_uid = model.youpaipuser_id;
- report.youpaiptype = 3;
- [self.navigationController pushViewController:report animated:YES];
- }];
- [actionArray addObject:reportAction];
-
- }
-
-
- ZCAlertSheetView* alertSheet = [[ZCAlertSheetView alloc]initWithTitle:nil andShowCancelButton:YES andAction:actionArray];
- //modify by leo --fix bug ios13 20191009
- //alertSheet.alertWindow.rootViewController = self;
- alertSheet.alertWindow.hidden = NO;
- [alertSheet show];
-
- }
- #pragma mark-点击播放短视频
- -(void)youpaiffootViewdidSendGift:(YOUPAILCDynamicModel *)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) {
- // 1 个人详情页 2.IM页面 3视频页 4.直播间
- [LCHttpHelper requestWithURLString:SendGift_New parameters:@{@"type":@(3),@"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:^{
-
-
- }];
-
- }
- -(void)youpaifCelldidPlayVideo:(YOUPAILCDynamicModel *)model{
- if (model.youpaipfile_url.length>0) {//废弃
-
-
- // YBIBVideoData *model1 = [YBIBVideoData new];
- // model1.videoURL = [NSURL URLWithString:model.file_url];
- //// model1.projectiveView = self.imgViewArray[i];
- //
- // YBImageBrowser *browser = [YBImageBrowser new];
- // browser.dataSourceArray = @[model1];
- // browser.currentPage = 0;
- // [browser show];
-
- // YOUPAILCDynamicSendVideoByLinkVC *vc = [YOUPAILCDynamicSendVideoByLinkVC new];
- // vc.videoLikesModel = model;
- // [self.navigationController pushViewController:vc animated:YES];
- }
-
- }
- -(void)youpaifdeleteImage:(YOUPAILCDynamicModel *)model index:(NSInteger)index
- {
-
- CGFloat height = [YOUPAILCDynamicCell youpaifcellHeightWithModel:self.youpaipdynamicArray[index]];
- [self.youpaipheightDict setObject:[NSNumber numberWithFloat:(float)height] forKey:model.youpaipdynamicId];
-
- NSIndexPath *reloadIndexPath=[NSIndexPath indexPathForRow:index inSection:0];
- [self.tableView reloadRowsAtIndexPaths:@[reloadIndexPath] withRowAnimation:UITableViewRowAnimationNone];
-
- }
- - (void)youpaifneedUpdateCellHeight:(NSInteger)index cell:(YOUPAILCDynamicCell *)cell{
- NSIndexPath *reloadIndexPath = [NSIndexPath indexPathForRow:index inSection:0];
-
- [self.youpaipheightDict setObject:[NSNumber numberWithFloat:cell.youpaipcellHeight] forKey:cell.youpaipdynamicModel.youpaipdynamicId];
- [self.tableView beginUpdates];
- [self.tableView reloadRowsAtIndexPaths:@[reloadIndexPath] withRowAnimation:(UITableViewRowAnimationNone)];
- [self.tableView endUpdates];
- }
- #pragma mark - JXCategoryListContentViewDelegate
- - (UIView *)listView{
- return self.view;
- }
- @end
|