YOUPAIBBProfileVC.m 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761
  1. //
  2. // YOUPAIBBProfileVC.m
  3. // VQU
  4. //
  5. // Created by Elaine on 2021/10/19.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAIBBProfileVC.h"
  9. #import "YOUPAIBBProfileHeaderView.h"
  10. #import "YOUPAILZProfileMenuItemCell.h"
  11. #import "YOUPAILZUnionsPopularizeVC.h"
  12. #import "YOUPAILCIMSessionVC.h"
  13. #import "YOUPAILCVerifyBigCastVC.h"
  14. #import "YOUPAILCBigCastSetVC.h"
  15. #import "LPBeautySetVC.h"
  16. #import "YOUPAILZVipVC.h"
  17. #import "YOUPAILPYoungSettingVC.h"
  18. #import "YOUPAIBBSettingVC.h"
  19. #import "YOUPAILZGameListVC.h"
  20. #import "YOUPAILZGameAccompanyListVC.h"
  21. #import <StoreKit/StoreKit.h>
  22. #import "YOUPAIXRWalletVC.h"
  23. #import "YOUPAILZPersonalizedDressVC.h"
  24. #import "YOUPAIBBBaseBackpackVC.h"
  25. #import "YOUPAILZBadgeVC.h"
  26. #import "YOUPAILCNewChatNoticationVC.h"
  27. #import "YOUPAILCBlackListVC.h"
  28. #import "YOUPAIBBReceiveGiftVC.h"
  29. #import "YOUPAIHRsendRankVC.h"
  30. #import "YOUPAIHRGuildCenterSearchVC.h"
  31. #import "YOUPAIHRGuildCenterDetailVC.h"
  32. #import "YOUPAILCSettingVC.h"
  33. #import "YOUPAILZLiveVerifyResultVC.h"
  34. #import "YOUPAIRealPersonFaceVC.h"
  35. #import <RPSDK/RPSDK.h>
  36. #import "YOUPAILCUploadCameraAuditVC.h"
  37. #define kHeaderViewHeight (206.0f + NavBarHeight)
  38. @interface YOUPAIBBProfileVC () <UITableViewDelegate,UITableViewDataSource>
  39. @property (nonatomic, weak) UITableView* youpaiptableView;
  40. @property (nonatomic, strong) NSMutableArray *youpaipdataSource;
  41. @property (nonatomic, strong) YOUPAIBBProfileHeaderView *youpaipheaderView;
  42. @property (nonatomic, weak) UIImageView *youpaipavatarImgV;
  43. @property (nonatomic, strong) NSString *youpaipweiguiUrl;
  44. @property (nonatomic, strong) NSString *youpaipinviteUrl;
  45. @property(nonatomic,assign)NSInteger youpaipguild;//0:未加入公会;1:已加入公会;2:已加入公会会长
  46. @end
  47. @implementation YOUPAIBBProfileVC
  48. - (void)dealloc{
  49. [[NSNotificationCenter defaultCenter] removeObserver:self];
  50. }
  51. - (void)viewWillAppear:(BOOL)animated{
  52. [super viewWillAppear:animated];
  53. [self.navigationController setNavigationBarHidden:YES animated:animated];
  54. }
  55. - (void)viewDidAppear:(BOOL)animated{
  56. [super viewDidAppear:animated];
  57. if ([LCSaveData getIsspecial]== NO && [LCSaveModel getUserModel].youpaipuserinfo.youpaipgender ==1){
  58. [self youpaifcheckSetting];
  59. }
  60. [self youpaifrefreshData];
  61. }
  62. - (void)viewWillDisappear:(BOOL)animated{
  63. [super viewWillDisappear:animated];
  64. [self.navigationController setNavigationBarHidden:NO animated:animated];
  65. }
  66. - (void)viewDidLoad {
  67. [super viewDidLoad];
  68. [self youpaifinitUI];
  69. }
  70. - (void)youpaifreloadDataSource{
  71. self.youpaipdataSource = [NSMutableArray array];
  72. YOUPAILCBaseInfo *userinfo = [LCSaveModel getUserModel].youpaipuserinfo;
  73. NSString *vip_des = userinfo.youpaipvip_des;
  74. NSString *badgeCount ;
  75. if (userinfo.youpaipbadge_all.count>0) {
  76. badgeCount = [NSString stringWithFormat:@"我的勋章(%ld)",userinfo.youpaipbadge_all.count];
  77. }else{
  78. badgeCount = [NSString stringWithFormat:@"我的勋章"];
  79. }
  80. // // 勿扰模式
  81. // [self.dataSource addObject:@{
  82. // @"type":@"mine_darao",
  83. // @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_mine_darao"],
  84. // @"title":@"勿扰模式",
  85. // @"accessoryType":@(LZTableViewCellAccessorySwitch),
  86. // @"rightText":@"",
  87. // @"subTitle":[LCSaveModel getUserModel].userinfo.is_anchor == 1 ? @"(开启后用户将无法给你拨打视频)" : @"(开启后女神不可群发打招呼给你)",
  88. // }];
  89. // 我的勋章
  90. // [self.youpaipdataSource addObject:@{
  91. // @"type":@"my_badge",
  92. // @"image":[UIImage imageNamed:@"vqu_images_ic_profile_bedge"],
  93. // @"title":badgeCount,
  94. // @"accessoryType":@(LZTableViewCellAccessoryRightImage),
  95. // @"rightText":@"",
  96. // }];
  97. // 会员权益
  98. [self.youpaipdataSource addObject:@{
  99. @"type":@"vip",
  100. @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_vip"],
  101. @"title":@"贵族中心",
  102. @"accessoryType":@(LZTableViewCellAccessoryRightTitle),
  103. @"rightText":vip_des,
  104. }];
  105. // [self.youpaipdataSource addObject:@{
  106. // @"type":@"gift",
  107. // @"image":[UIImage imageNamed:@"vqu_images_sendRank"],
  108. // @"title":@"我的礼物",
  109. // @"accessoryType":@(LZTableViewCellAccessoryRightTitle),
  110. // @"rightText":@"",
  111. // }];
  112. //我的认证
  113. [self.youpaipdataSource addObject:@{
  114. @"type":@"my_face",
  115. @"image":[UIImage imageNamed:@"vqu_images_my_face"],
  116. @"title":@"我的认证",
  117. @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator),
  118. @"rightText":@"",
  119. }];
  120. //公会中心
  121. // [self.youpaipdataSource addObject:@{
  122. // @"type":@"guild",
  123. // @"image":[UIImage imageNamed:@"vqu_images_mine_guild"],
  124. // @"title":@"公会中心",
  125. // @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator),
  126. // @"rightText":@"",
  127. // }];
  128. // 个性装扮
  129. // [self.youpaipdataSource addObject:@{
  130. // @"type":@"personalizedDress",
  131. // @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_personalized_dress"],
  132. // @"title":@"个性装扮",
  133. // @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator),
  134. // @"rightText":@"",
  135. // }];
  136. //我的背包
  137. [self.youpaipdataSource addObject:@{
  138. @"type":@"mine_beibao",
  139. @"image":[UIImage imageNamed:@"vqu_images_my_backpack"],
  140. @"title":@"我的背包",
  141. @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator),
  142. @"rightText":@"",
  143. }];
  144. // 女神认证
  145. // if (userinfo.gender == 1) { //女
  146. // NSString *title = @"";
  147. // if (userinfo.is_anchor == 0) {
  148. // title = @"成为女神";
  149. // }else{
  150. // title = @"女神设置";
  151. // }
  152. // // 女神认证
  153. // [self.dataSource addObject:@{
  154. // @"type":@"big_cast",
  155. // @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_NvShen"],
  156. // @"title":title,
  157. // @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator),
  158. // @"rightText":@"",
  159. // }];
  160. // }
  161. // 美颜设置
  162. [self.youpaipdataSource addObject:@{
  163. @"type":@"beauty_set",
  164. @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_beauty_set"],
  165. @"title":@"美颜设置",
  166. @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator),
  167. @"rightText":@"",
  168. }];
  169. // // 邀请有奖
  170. // if ([LCSaveData getOnlineVersion]) {
  171. // [self.dataSource addObject:@{
  172. // @"type":@"invite",
  173. // @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_invite"],
  174. // @"title":@"邀请有奖",
  175. // @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator),
  176. // @"rightText":@"",
  177. // }];
  178. // }
  179. // // 推广制度
  180. // [self.dataSource addObject:@{
  181. // @"type":@"unions",
  182. // @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_unions"],
  183. // @"title":@"推广制度",
  184. // @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator),
  185. // @"rightText":@"",
  186. // }];
  187. // 违规公布
  188. [self.youpaipdataSource addObject:@{
  189. @"type":@"weiguigongbu",
  190. @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_weiguigongbu"],
  191. @"title":@"违规公布",
  192. @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator),
  193. @"rightText":@"",
  194. }];
  195. // 在线客服
  196. [self.youpaipdataSource addObject:@{
  197. @"type":@"im_service",
  198. @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_im_service"],
  199. @"title":@"在线客服",
  200. @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator),
  201. @"rightText":@"",
  202. }];
  203. // //黑名单
  204. // [self.youpaipdataSource addObject:@{
  205. // @"type":@"BlackList",
  206. // @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_set"],
  207. // @"title":@"黑名单",
  208. // @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator),
  209. // @"rightText":@"",
  210. // }];
  211. //
  212. //
  213. // //消息通知
  214. // [self.youpaipdataSource addObject:@{
  215. // @"type":@"ChatNotication",
  216. // @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_set"],
  217. // @"title":@"消息通知",
  218. // @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator),
  219. // @"rightText":@"",
  220. // }];
  221. // 使用帮助
  222. // if (userinfo.youpaipgender==1) { //女
  223. // [self.youpaipdataSource addObject:@{
  224. // @"type":@"help",
  225. // @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_beauty_set"],
  226. // @"title":@"使用帮助",
  227. // @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator),
  228. // }];
  229. // }
  230. // 青少年模式
  231. // if (userinfo.youpaipgender != 1) { //男
  232. // [self.youpaipdataSource addObject:@{
  233. // @"type":@"vqu_images_ic_my_young",
  234. // @"image":[UIImage imageNamed:@"vqu_images_D_profile_item_Young"],
  235. // @"title":@"青少年模式",
  236. // @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator),
  237. // @"rightText":@"",
  238. // }];
  239. // }
  240. // 设置
  241. [self.youpaipdataSource addObject:@{
  242. @"type":@"set",
  243. @"image":[UIImage imageNamed:@"vqu_images_P_mine_Set"],
  244. @"title":@"设置",
  245. @"accessoryType":@(LZTableViewCellAccessoryDisclosureIndicator),
  246. @"rightText":@"",
  247. }];
  248. [self.youpaiptableView reloadData];
  249. }
  250. - (void)youpaifinitUI{
  251. UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectMake(0,0, KScreenWidth, KScreenHeight-TabbarHeight) style:UITableViewStyleGrouped];
  252. tableView.showsVerticalScrollIndicator = NO;
  253. tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  254. tableView.backgroundColor = [UIColor clearColor];
  255. tableView.dataSource = self;
  256. tableView.delegate = self;
  257. [self.view addSubview:tableView];
  258. self.youpaiptableView = tableView;
  259. UIImageView *youpaipavatarImgV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kHeaderViewHeight)];
  260. youpaipavatarImgV.contentMode = UIViewContentModeScaleAspectFill;
  261. youpaipavatarImgV.clipsToBounds = YES;
  262. youpaipavatarImgV.image = [UIImage imageNamed:@"vqu_images_mine_bg_top"];
  263. [self.youpaiptableView addSubview:youpaipavatarImgV];
  264. self.youpaipavatarImgV = youpaipavatarImgV;
  265. YOUPAIBBProfileHeaderView *youpaipheaderView = [[YOUPAIBBProfileHeaderView alloc] initWithFrame:youpaipavatarImgV.bounds];
  266. self.youpaiptableView.tableHeaderView = youpaipheaderView;
  267. youpaipheaderView.youpaipinfoModel = [LCSaveModel getUserModel].youpaipuserinfo;
  268. self.youpaipheaderView = youpaipheaderView;
  269. }
  270. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  271. return self.youpaipdataSource.count*71+20;
  272. }
  273. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  274. return 1;
  275. }
  276. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  277. NSString *cellID = @"YOUPAILZProfileMenuItemCell";
  278. YOUPAILZProfileMenuItemCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
  279. cell = [[YOUPAILZProfileMenuItemCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
  280. @weakify(self)
  281. [cell setVqupaipDidSelectBlock:^(NSString * _Nonnull title) {
  282. @strongify(self)
  283. [self youpaifgoPageWithType:title];
  284. }];
  285. cell.countArr = self.youpaipdataSource;
  286. return cell;
  287. }
  288. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
  289. return CGFLOAT_MIN;
  290. }
  291. - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
  292. return CGFLOAT_MIN;
  293. }
  294. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  295. NSMutableDictionary *cellData = self.youpaipdataSource[indexPath.row];
  296. [self youpaifgoPageWithType:cellData[@"type"]];
  297. }
  298. - (void)youpaifgoPageWithType:(NSString *)type{
  299. if ([type isEqualToString:@"unions"]) {
  300. YOUPAILZUnionsPopularizeVC *unions = [[YOUPAILZUnionsPopularizeVC alloc]init];
  301. [self.navigationController pushViewController:unions animated:YES];
  302. }else if ([type isEqualToString:@"wallet"]) {
  303. YOUPAIXRWalletVC *wallet = [[YOUPAIXRWalletVC alloc]init];
  304. [self.navigationController pushViewController:wallet animated:YES];
  305. }else if ([type isEqualToString:@"invite"]){
  306. // YOUPAILCInviteVC *invite = [[YOUPAILCInviteVC alloc]init];
  307. // [self.navigationController pushViewController:invite animated:YES];
  308. ZCBaseWebVC * vc = [[ZCBaseWebVC alloc]init];
  309. vc.contentUrl = self.youpaipinviteUrl;
  310. [self.navigationController pushViewController:vc animated:YES];
  311. }else if ([type isEqualToString:@"mine_beibao"]){
  312. YOUPAIBBBaseBackpackVC *invite = [[YOUPAIBBBaseBackpackVC alloc]init];
  313. [self.navigationController pushViewController:invite animated:YES];
  314. }else if ([type isEqualToString:@"help"]){
  315. NSString *urlStr;
  316. if ([LCSaveModel getUserModel].youpaipuserinfo.youpaipgender==1) {
  317. urlStr = [NSString stringWithFormat:@"%@%@",[LCSaveData getBaseURL]?[LCSaveData getBaseURL]:BaseURL,HelpBigCastH5];
  318. }else{
  319. urlStr = [NSString stringWithFormat:@"%@%@",[LCSaveData getBaseURL]?[LCSaveData getBaseURL]:BaseURL,HelpNormalH5];
  320. }
  321. if([LCSaveData getIsspecial]){
  322. urlStr = [NSString stringWithFormat:@"%@%@",[LCSaveData getBaseURL]?[LCSaveData getBaseURL]:BaseURL,HelpSpecialH5];
  323. }
  324. ZCBaseWebVC * vc = [[ZCBaseWebVC alloc]init];
  325. vc.contentUrl = urlStr;
  326. [self.navigationController pushViewController:vc animated:YES];
  327. }else if ([type isEqualToString:@"im_service"]){
  328. NIMSession *session = [NIMSession session:[LCSaveData getServerId] type:NIMSessionTypeP2P];
  329. if (session) {
  330. @weakify(self);
  331. [ZCHUDHelper show];
  332. [[[NIMSDK sharedSDK] userManager] fetchUserInfos:@[session.sessionId] completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
  333. @strongify(self);
  334. [ZCHUDHelper dismiss];
  335. YOUPAILCIMSessionVC *vc = [[YOUPAILCIMSessionVC alloc] initWithSession:session];
  336. [self.navigationController pushViewController:vc animated:YES];
  337. }];
  338. }
  339. }else if ([type isEqualToString:@"my_face"]){
  340. YOUPAILCBaseInfo *userinfo = [LCSaveModel getUserModel].youpaipuserinfo;
  341. if (userinfo.youpaipgender == 1){//女
  342. if (userinfo.youpaipis_anchor ==1) {
  343. YOUPAILZLiveVerifyResultVC *vc = [[YOUPAILZLiveVerifyResultVC alloc] init];
  344. vc.youpaipstate = LZLiveVerifyStateWithSuccess;
  345. [self.navigationController pushViewController:vc animated:YES];
  346. }else{
  347. [self youpaifrealNameAuthentication];
  348. }
  349. }else{//男
  350. if (userinfo.youpaipis_auth == 1) {
  351. YOUPAILZLiveVerifyResultVC *vc = [[YOUPAILZLiveVerifyResultVC alloc] init];
  352. vc.youpaipstate = LZLiveVerifyStateWithSuccess;
  353. [self.navigationController pushViewController:vc animated:YES];
  354. }else{
  355. YOUPAIRealPersonFaceVC *vc = [YOUPAIRealPersonFaceVC new];
  356. [self.navigationController pushViewController:vc animated:YES];
  357. }
  358. }
  359. }
  360. else if ([type isEqualToString:@"big_cast"]){
  361. if ([LCSaveModel getUserModel].youpaipuserinfo.youpaipis_anchor == 0) {
  362. YOUPAILCVerifyBigCastVC* verifyBigCast = [[YOUPAILCVerifyBigCastVC alloc]init];
  363. [self.navigationController pushViewController:verifyBigCast animated:YES];
  364. }else{
  365. YOUPAILCBigCastSetVC* bigCast = [[YOUPAILCBigCastSetVC alloc]init];
  366. [self.navigationController pushViewController:bigCast animated:YES];
  367. }
  368. }else if([type isEqualToString:@"beauty_set"]){
  369. LPBeautySetVC* beautySet = [[LPBeautySetVC alloc]init];
  370. //modify by leo fix ios13 bug
  371. beautySet.modalPresentationStyle =0;
  372. [self.navigationController presentViewController:beautySet animated:YES completion:^{
  373. }];
  374. }else if([type isEqualToString:@"set"]){
  375. YOUPAILCSettingVC* setting = [[YOUPAILCSettingVC alloc]init];
  376. [self.navigationController pushViewController:setting animated:YES];
  377. }else if([type isEqualToString:@"vip"]){
  378. YOUPAILZVipVC* setting = [[YOUPAILZVipVC alloc]init];
  379. [self.navigationController pushViewController:setting animated:YES];
  380. }else if([type isEqualToString:@"personalizedDress"]){
  381. YOUPAILZPersonalizedDressVC* vc = [[YOUPAILZPersonalizedDressVC alloc]init];
  382. [self.navigationController pushViewController:vc animated:YES];
  383. }else if([type isEqualToString:@"my_badge"]){
  384. YOUPAILZBadgeVC *vc = [[YOUPAILZBadgeVC alloc] init];
  385. [self.navigationController pushViewController:vc animated:YES];
  386. }else if([type isEqualToString:@"vqu_images_ic_my_young"]){
  387. YOUPAILPYoungSettingVC* setting = [[YOUPAILPYoungSettingVC alloc]init];
  388. [self.navigationController pushViewController:setting animated:YES];
  389. }else if ([type isEqualToString:@"weiguigongbu"]){
  390. ZCBaseWebVC * vc = [[ZCBaseWebVC alloc]init];
  391. vc.contentUrl = self.youpaipweiguiUrl;
  392. [self.navigationController pushViewController:vc animated:YES];
  393. }else if ([type isEqualToString:@"gameCertification"]) {
  394. YOUPAILZGameListVC *vc = [[YOUPAILZGameListVC alloc] init];
  395. [self.navigationController pushViewController:vc animated:YES];
  396. }else if ([type isEqualToString:@"gameAccompany"]){
  397. YOUPAILZGameAccompanyListVC *vc = [[YOUPAILZGameAccompanyListVC alloc] init];
  398. [self.navigationController pushViewController:vc animated:YES];
  399. }else if ([type isEqualToString:@"ChatNotication"]){
  400. YOUPAILCNewChatNoticationVC * noti = [[YOUPAILCNewChatNoticationVC alloc]init];
  401. [self.navigationController pushViewController:noti animated:YES];
  402. }else if ([type isEqualToString:@"BlackList"]){
  403. YOUPAILCBlackListVC* black = [[YOUPAILCBlackListVC alloc]init];
  404. [self.navigationController pushViewController:black animated:YES];
  405. }else if ([type isEqualToString:@"gift"]){
  406. YOUPAIHRsendRankVC* black = [[YOUPAIHRsendRankVC alloc]init];
  407. [self.navigationController pushViewController:black animated:YES];
  408. }else if ([type isEqualToString:@"guild"]){//公会中心
  409. if (self.youpaipguild ==0) {//0:未加入公会;1:已加入公会;2:已加入公会会长
  410. YOUPAIHRGuildCenterSearchVC *vc = [YOUPAIHRGuildCenterSearchVC new];
  411. [self.navigationController pushViewController:vc animated:YES];
  412. }else{
  413. YOUPAIHRGuildCenterDetailVC *vc = [YOUPAIHRGuildCenterDetailVC new];
  414. vc.youpaipguild = self.youpaipguild;
  415. [self.navigationController pushViewController:vc animated:YES];
  416. }
  417. }
  418. }
  419. /// 阿里实名认证
  420. - (void)youpaifrealNameAuthentication{
  421. [UCAuthorityManager cameraAuthority:^{
  422. YMCustomCameraViewModel *customCameraVM = [[YMCustomCameraViewModel alloc]initWithParams:@{}];
  423. [YMRouter openURL:stringFormat(@"%@%@",YM_ROUTER_URL_PREFIX,YM_ROUTER_CUSTOM_CAMERA) withUserInfo:@{
  424. RouterViewModel:customCameraVM
  425. } completion:nil];
  426. } denied:^{
  427. YMTipsPopupView *customView = [[YMTipsPopupView alloc]init];
  428. [customView configutationWithTips:@"请在iphone的“设置-隐私-相机”选项中,允许APP访问您的相机。" TipsAlignment:NSTextAlignmentCenter IsHideTitle:NO IsHideSingleButton:NO];
  429. YMPopupView *popupView = [YMPopupView initWithCustomView:customView parentView:[YMGlobalUtils getCurrentVC].view popStyle:YMPopupStyleFade dismissStyle:YMDismissStyleFade];
  430. popupView.priority = 999;
  431. popupView.cornerRadius = adapt(10);
  432. popupView.rectCorners = UIRectCornerAllCorners;
  433. popupView.positionStyle = YMPositionStyleCenter;
  434. popupView.isHideBg = NO;
  435. popupView.bgAlpha = 0.3;
  436. @weakify(popupView)
  437. customView.buttonBlock = ^(BOOL isConfirm) {
  438. @strongify(popupView)
  439. if (isConfirm) {
  440. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil];
  441. }
  442. [popupView dismissWithStyle:YMDismissStyleFade duration:2.0];
  443. };
  444. [popupView pop];
  445. }];
  446. // WeakSelf;
  447. // [LCHttpHelper requestWithURLString:GetLiveVerifyToken parameters:@{} needToken:YES type:HttpRequestTypePost success:^(id responseObject) {
  448. // NSDictionary* dict = (NSDictionary*)responseObject;
  449. // NSInteger code = [[dict objectForKey:@"code"] integerValue];
  450. // if (code == 0) {
  451. // NSString *token = dict[@"data"][@"VerifyToken"];
  452. // NSString *BizId = dict[@"data"][@"BizId"];
  453. // [weakSelf youpaifpushToAliSdk:token BizId:BizId];
  454. //
  455. // }else{
  456. //
  457. // [ZCHUDHelper showTitle:[dict objectForKey:@"message"]];
  458. // }
  459. //
  460. //
  461. //
  462. // } failure:^(NSError *error) {
  463. // [ZCHUDHelper showTitle:error.localizedDescription];
  464. //
  465. // }];
  466. //
  467. }
  468. -(void)youpaifpushToAliSdk:(NSString*)token BizId:(NSString*)bizIdStr{
  469. RPConfiguration *configuration = [RPConfiguration configuration];
  470. NSString *filePath1 = [[NSBundle mainBundle] pathForResource:@"RPCustomUI" ofType:@"bundle"];
  471. configuration.customUIPath = filePath1;
  472. [RPSDK startWithVerifyToken:token viewController:self configuration:configuration completion:^(RPResult * _Nonnull result) {
  473. NSLog(@"实人认证结果:%@==%@", result,result.message);
  474. switch (result.state) {
  475. case RPStatePass:
  476. // 认证通过。
  477. [self youpaifpostBizId:bizIdStr];
  478. break;
  479. case RPStateFail:
  480. // 认证不通过。
  481. [ZCHUDHelper showTitle:@"认证失败,请重新认证"];
  482. break;
  483. case RPStateNotVerify:
  484. // 未认证。
  485. // 通常是用户主动退出或者姓名身份证号实名校验不匹配等原因导致。
  486. // 具体原因可通过result.errorCode来区分(详见文末错误码说明表格)。
  487. break;
  488. }
  489. }];
  490. }
  491. -(void)youpaifpostBizId:(NSString*)ID{
  492. NSMutableDictionary *dict = [NSMutableDictionary new];
  493. [dict setObject:ID forKey:@"BizId"];
  494. WeakSelf;
  495. [LCHttpHelper requestWithURLString:LiveVerifyTokenSuccess parameters:dict needToken:YES type:HttpRequestTypePost success:^(id responseObject) {
  496. NSDictionary* dict = (NSDictionary*)responseObject;
  497. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  498. if (code == 0) {
  499. YOUPAILZLiveVerifyResultVC *vc = [[YOUPAILZLiveVerifyResultVC alloc] init];
  500. vc.youpaipstate = LZLiveVerifyStateWithInReview;
  501. vc.youpaipcontent_str = [dict objectForKey:@"message"];
  502. [weakSelf.navigationController pushViewController:vc animated:YES];
  503. }else{
  504. [ZCHUDHelper showTitle:[dict objectForKey:@"message"]];
  505. }
  506. } failure:^(NSError *error) {
  507. [ZCHUDHelper showTitle:error.localizedDescription];
  508. }];
  509. }
  510. - (void)scrollViewDidScroll:(UIScrollView *)scrollView{
  511. CGFloat y = scrollView.contentOffset.y;
  512. if(y > 0){
  513. self.youpaipavatarImgV.mj_y = 0;
  514. self.youpaipavatarImgV.transform = CGAffineTransformMakeScale(1.0f, 1.0f);
  515. }else{
  516. y = -y;
  517. CGFloat scale = y / kHeaderViewHeight;
  518. self.youpaipavatarImgV.mj_y = -y;
  519. self.youpaipavatarImgV.transform = CGAffineTransformMakeScale(1.0f + scale, 1.0f + scale);
  520. }
  521. }
  522. - (void)youpaifcheckSetting{
  523. if ([LCTools canShowNoticationTip]) {
  524. UIUserNotificationSettings *setting = [[UIApplication sharedApplication] currentUserNotificationSettings];
  525. if (UIUserNotificationTypeNone == setting.types) {
  526. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:@"您的系统关闭了花蝶的通知提醒,会导致您错过重要的视频通话,需要您前往打开通知" preferredStyle:UIAlertControllerStyleAlert];
  527. UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action){
  528. }];
  529. UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action){
  530. NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
  531. if ([[UIApplication sharedApplication] canOpenURL:url]) {
  532. [[UIApplication sharedApplication] openURL:url];
  533. }
  534. }];
  535. [alertController addAction:cancelAction];
  536. [alertController addAction:okAction];
  537. [self presentViewController:alertController animated:YES completion:nil];
  538. }
  539. }
  540. }
  541. - (void)youpaifcheckAppraise{//盈利大于1000提示
  542. if (@available(iOS 10.3, *)) {
  543. if ([LCTools canShowAppraise]) {//判断时间 一个月只弹一次
  544. if([SKStoreReviewController respondsToSelector:@selector(requestReview)]){
  545. [SKStoreReviewController requestReview];
  546. }
  547. }
  548. }
  549. }
  550. - (void)youpaifrefreshData{
  551. [LCHttpHelper requestWithURLString:UserCenter parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  552. NSDictionary* dict = (NSDictionary*)responseObject;
  553. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  554. if (code==0) {//成功
  555. NSDictionary *anchor = [[dict objectForKey:@"data"]objectForKey:@"anchor"];
  556. NSDictionary *info = [[dict objectForKey:@"data"]objectForKey:@"userinfo"];
  557. if ([[anchor allKeys] containsObject:@"open_video_status"]) {
  558. if ([[anchor objectForKey:@"open_video_status"] integerValue] == 0) {//0 未开启 1 已开启
  559. [LCSaveData saveVideoOpenStatu:NO];
  560. }else{
  561. [LCSaveData saveVideoOpenStatu:YES];
  562. }
  563. }
  564. NSInteger guild = [[[dict objectForKey:@"data"]objectForKey:@"guild"] integerValue];
  565. self.youpaipguild = guild;
  566. if ([[anchor allKeys] containsObject:@"order_switch"]) {
  567. if ([[anchor objectForKey:@"order_switch"] integerValue] == 1) {//1隐藏 2不隐藏
  568. [LCSaveData saveOrderOpenStatu:YES];
  569. }else{
  570. [LCSaveData saveOrderOpenStatu:NO];
  571. }
  572. }
  573. if ([[info allKeys] containsObject:@"is_msg_refuse"]) {
  574. if ([[info objectForKey:@"is_msg_refuse"] integerValue] == 1) {//1开启 0关闭
  575. [LCSaveData saveProfileWuraoStatus:YES];
  576. }else{
  577. [LCSaveData saveProfileWuraoStatus:NO];
  578. }
  579. }
  580. if ([[[dict objectForKey:@"data"] allKeys] containsObject:@"webUrl"]) {
  581. self.youpaipweiguiUrl = [NSString stringWithFormat:@"%@",[[[dict objectForKey:@"data"]objectForKey:@"webUrl"] objectForKey:@"publish"]];
  582. self.youpaipinviteUrl = [NSString stringWithFormat:@"%@",[[[dict objectForKey:@"data"]objectForKey:@"webUrl"] objectForKey:@"share"]];
  583. }
  584. YOUPAILCBaseInfo* userinfo = [YOUPAILCBaseInfo mj_objectWithKeyValues:[[dict objectForKey:@"data"]objectForKey:@"userinfo"]];
  585. if (userinfo.youpaipalbum_list_new.count>0) {
  586. NSMutableArray *arrm = [NSMutableArray new];
  587. [userinfo.youpaipalbum_list_new enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  588. album_list_newModel *model = [album_list_newModel mj_objectWithKeyValues:obj];
  589. [arrm addObject:model];
  590. }];
  591. userinfo.youpaipalbum_list_new = arrm;
  592. }
  593. YOUPAILCUserModel* userModel = [LCSaveModel getUserModel];
  594. userModel.youpaipuserinfo = userinfo;
  595. [LCSaveModel saveUserModel:userModel];
  596. [self.youpaipheaderView youpaifreloadUserInfoWithModel:userModel];
  597. YOUPAILCUserCountModel* userCount = [YOUPAILCUserCountModel mj_objectWithKeyValues:[[dict objectForKey:@"data"]objectForKey:@"usercount"]];
  598. [self.youpaipheaderView youpaifreloadCountWithModel:userCount];
  599. [self.youpaipheaderView youpaifreloadUserLevelModel:[YOUPAILZLiveCardModel mj_objectWithKeyValues:[[dict objectForKey:@"data"]objectForKey:@"gr"]]];
  600. [self youpaifreloadDataSource];
  601. }
  602. } failure:^(NSError *error) {
  603. }];
  604. [LCHttpHelper requestWithURLString:WalletInit parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  605. NSDictionary* dict = (NSDictionary*)responseObject;
  606. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  607. if (code==0) {//成功
  608. CGFloat coin = [[[[dict objectForKey:@"data"]objectForKey:@"account"]objectForKey:@"coin"]integerValue];
  609. NSString *income_coin = [[[dict objectForKey:@"data"]objectForKey:@"account"]objectForKey:@"income_coin_money"];
  610. [self.youpaipheaderView youpaifreloadAccountWithBalance:coin profit:income_coin];
  611. }
  612. } failure:^(NSError *error) {
  613. }];
  614. }
  615. - (void)youpaifopenDontDisturb{
  616. NSString *status = [LCSaveData getProfileWuraoStatus] ? @"0" : @"1";
  617. [LCHttpHelper requestWithURLString:SetWuRaoStatus parameters:@{@"is_msg_refuse":status} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  618. NSDictionary* dict = (NSDictionary*)responseObject;
  619. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  620. if (code==0) {
  621. if ([status isEqualToString:@"1"]) {
  622. [ZCHUDHelper showTitle:@"打开勿打扰"];
  623. [LCSaveData saveProfileWuraoStatus:YES];
  624. [self.youpaiptableView reloadData];
  625. }else{
  626. [ZCHUDHelper showTitle:@"关闭勿打扰"];
  627. [LCSaveData saveProfileWuraoStatus:NO];
  628. [self.youpaiptableView reloadData];
  629. }
  630. }
  631. } failure:^(NSError *error) {
  632. }];
  633. }
  634. - (void)youpaifvideoSwitchValueChange:(UIButton*)switchView{
  635. NSInteger status = 0;
  636. if (switchView.selected == NO) {//将状态置为1空闲
  637. status = 0;
  638. }else{
  639. status = 1;
  640. }
  641. [LCHttpHelper requestWithURLString:BigCastSetVideoStatus parameters:@{@"status":@(status)} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  642. NSDictionary* dict = (NSDictionary*)responseObject;
  643. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  644. if (code==0) {
  645. if (status==0) {
  646. [ZCHUDHelper showTitle:@"关闭视频"];
  647. [LCSaveData saveVideoOpenStatu:NO];
  648. }else{
  649. [ZCHUDHelper showTitle:@"打开视频"];
  650. [LCSaveData saveVideoOpenStatu:YES];
  651. }
  652. }
  653. [self.youpaiptableView reloadData];
  654. } failure:^(NSError *error) {
  655. }];
  656. }
  657. @end