XYPersonalCenterViewModel.m 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. //
  2. // XYPersonalCenterViewModel.m
  3. // Starbuds
  4. //
  5. // Created by 翟玉磊 on 2019/12/21.
  6. // Copyright © 2019 翟玉磊. All rights reserved.
  7. //
  8. #import "XYPersonalCenterViewModel.h"
  9. #import "XYPersonalCenterListModel.h"
  10. #import "XYWalletViewController.h"
  11. #import "XYSetupViewController.h"
  12. #import "XYVisitorsManagerViewController.h"
  13. #import "XYBackpackManageViewController.h"
  14. #import "XYFeedbackListViewController.h"
  15. #import "XYSendFeedbackViewController.h"
  16. #import "XYRechargeItemsViewController.h"
  17. #import "XYInviteFriendsController.h"
  18. #import "XYMyVoiceRoomListViewController.h"
  19. #import "XYOrderCenterMainViewController.h"
  20. #import "XYWishCenterViewController.h"
  21. #import "XYWishAPIManager.h"
  22. #import "XYWishGiftModel.h"
  23. @implementation XYPersonalCenterViewModel
  24. - (instancetype)init {
  25. if (self = [super init]) {
  26. self.shouldPullDownToRefresh = YES;
  27. self.shouldBeginRefreshing = NO;
  28. // self.shouldCustomRefresh = NO;
  29. self.minutes = 0;
  30. self.fansCount = 0;
  31. self.followCount = 0;
  32. self.charmValue = @"0";
  33. self.wealthValue = @"0";
  34. self.starValue = @"0";
  35. [self initValue];
  36. }
  37. return self;
  38. }
  39. - (void)initValue {
  40. self.nowUser = [XYUserInfoManager nowUser];
  41. [self.dataSource removeAllObjects];
  42. if (ApplicationDelegate.isVersionStatus) {
  43. // 审核状态
  44. [self.dataSource addObject:[EmptyCellModel new]];
  45. NSString *coinBalance = @"";
  46. if (StringIsNotEmpty([XYUserInfoManager nowUser].coinBalance)) {
  47. coinBalance = [NSString stringWithFormat:@"%@%@", [XYUserInfoManager nowUser].coinBalance, App_CoinName(Wallet_Type_Star_Diamond)];
  48. }
  49. XYPersonalCenterListModel *rechargeModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_recharge" title:kLocalizedString(@"我要充值") content:coinBalance isShowMoreImage:YES pushControllerName:NSStringFromClass([XYRechargeItemsViewController class]) borderType:UIRectCornerTopLeft|UIRectCornerTopRight];
  50. [self.dataSource addObject:rechargeModel];
  51. XYPersonalCenterListModel *visitorsModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_visitors" title:kLocalizedString(@"我的访客") content:@"" isShowMoreImage:YES pushControllerName:NSStringFromClass([XYVisitorsManagerViewController class]) borderType:UIRectCornerTopLeft|UIRectCornerTopRight];
  52. [self.dataSource addObject:visitorsModel];
  53. XYPersonalCenterListModel *voiceModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_voice" title:kLocalizedString(@"语音房") content:@"" isShowMoreImage:YES pushControllerName:NSStringFromClass([XYMyVoiceRoomListViewController class]) borderType:0];
  54. [self.dataSource addObject:voiceModel];
  55. XYPersonalCenterListModel *voiceCollectModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_voiceroom_collect" title:kLocalizedString(@"我的收藏") content:@"" isShowMoreImage:YES pushControllerName:NSStringFromClass([XYMyVoiceRoomListViewController class]) borderType:0];
  56. [self.dataSource addObject:voiceCollectModel];
  57. XYPersonalCenterListModel *helpModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_help" title:kLocalizedString(@"帮助与反馈") content:@"" isShowMoreImage:YES pushControllerName:NSStringFromClass(XYSendFeedbackViewController.class) borderType:UIRectCornerTopLeft|UIRectCornerTopRight];
  58. [self.dataSource addObject:helpModel];
  59. XYPersonalCenterListModel *setupModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_setup" title:kLocalizedString(@"设置") content:@"" isShowMoreImage:YES pushControllerName:@"XYSetupViewController" borderType:0];
  60. [self.dataSource addObject:setupModel];
  61. [self.dataSource addObject:[EmptyCellModel new]];
  62. }else {
  63. // 正常状态
  64. [self.dataSource addObject:[EmptyCellModel new]];
  65. // if (self.nowUser.vipLevel <= 0 && StringIsNotEmpty([XYAppConfigModel getUrlVip])) {
  66. // XYPersonalCenterListModel *vipModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_novip" title:kLocalizedString(@"成为超级VIP") content:kLocalizedString(@"每天领取免费聊天时长") isShowMoreImage:YES pushControllerName:@"" borderType:UIRectCornerAllCorners];
  67. // [self.dataSource addObject:vipModel];
  68. //
  69. // [self.dataSource addObject:[EmptyCellModel new]];
  70. // }
  71. if([XYUserInfoManager nowUser].userScore < 50){
  72. XYPersonalCenterListModel *editAlertModel = [XYPersonalCenterListModel createListModelWithIconName:@"" title:kLocalizedString(@"资料评分") content:@"" isShowMoreImage:YES pushControllerName:@"" borderType:0];
  73. [self.dataSource addObject:editAlertModel];
  74. [self.dataSource addObject:[EmptyCellModel new]];
  75. }
  76. NSMutableArray *itemArray = [NSMutableArray array];
  77. XYPersonalCenterListModel *rechargeModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_personal_center_recharge" title:kLocalizedString(@"充值") content:@"" isShowMoreImage:YES pushControllerName:@"" borderType:0];
  78. [itemArray addObject:rechargeModel];
  79. if (StringIsNotEmpty([XYAppConfigModel getUrlNoble])) {
  80. XYPersonalCenterListModel *nobleModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_personal_center_nobility" title:kLocalizedString(@"贵族") content:@"" isShowMoreImage:YES pushControllerName:@"" borderType:0];
  81. [itemArray addObject:nobleModel];
  82. }
  83. if (StringIsNotEmpty([XYAppConfigModel getUrlCoinShop])) {
  84. XYPersonalCenterListModel *shopModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_personal_center_mall" title:kLocalizedString(@"商城") content:@"" isShowMoreImage:YES pushControllerName:@"" borderType:0];
  85. [itemArray addObject:shopModel];
  86. }
  87. if (StringIsNotEmpty([XYAppConfigModel getUrlNiceNo])) {
  88. XYPersonalCenterListModel *niceNoModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_personal_center_nicenum" title:kLocalizedString(@"靓号") content:@"" isShowMoreImage:YES pushControllerName:@"" borderType:0];
  89. [itemArray addObject:niceNoModel];
  90. }
  91. XYPersonalCenterListModel *packageModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_personal_center_package" title:kLocalizedString(@"背包") content:@"" isShowMoreImage:YES pushControllerName:@"" borderType:0];
  92. [itemArray addObject:packageModel];
  93. // if (StringIsNotEmpty([XYAppConfigModel getUrlVip])) {
  94. // XYPersonalCenterListModel *membersModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_members" title:kLocalizedString(@"会员中心") content:@"" isShowMoreImage:YES pushControllerName:@"" borderType:0];
  95. // [itemArray addObject:membersModel];
  96. // }
  97. if (itemArray.count > 0) {
  98. XYPersonalCenterListModel *urlItemModel = [XYPersonalCenterListModel createListModelWithIconName:@"" title:kLocalizedString(@"url_item") content:@"" isShowMoreImage:YES pushControllerName:@"" borderType:UIRectCornerAllCorners];
  99. urlItemModel.urlItemArray = itemArray;
  100. [self.dataSource addObject:urlItemModel];
  101. [self.dataSource addObject:[EmptyCellModel new]];
  102. }
  103. XYPersonalCenterListModel *walletModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_wallet" title:kLocalizedString(@"我的钱包") content:@"" isShowMoreImage:YES pushControllerName:NSStringFromClass([XYWalletViewController class]) borderType:UIRectCornerAllCorners];
  104. [self.dataSource addObject:walletModel];
  105. [self.dataSource addObject:[EmptyCellModel new]];
  106. // 常驻功能
  107. NSMutableArray *normalItems = [NSMutableArray array];
  108. UIRectCorner borderType = UIRectCornerTopLeft|UIRectCornerTopRight;
  109. borderType = 0;
  110. /*
  111. XYPersonalCenterListModel *wishModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_wish" title:kLocalizedString(@"许愿中心") content:@"未设置" isShowMoreImage:YES pushControllerName:NSStringFromClass([XYWishCenterViewController class]) borderType:borderType];
  112. if (StringIsNotEmpty(self.wishModel.wishId)) {
  113. wishModel.content = [NSString stringWithFormat:@"%ld/%ld", self.wishModel.currentNum, self.wishModel.giftNum];
  114. wishModel.imageContent = [self.wishModel.giftIcon copy];
  115. }
  116. [normalItems addObject:wishModel];
  117. XYPersonalCenterListModel *orderCenterModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_order_center" title:PeiWanEnable?kLocalizedString(@"订单中心"):kLocalizedString(@"派单记录") content:@"" isShowMoreImage:YES pushControllerName:NSStringFromClass([XYOrderCenterMainViewController class]) borderType:borderType];
  118. [normalItems addObject:orderCenterModel];
  119. if (StringIsNotEmpty([XYAppConfigModel getUrlChatTimeWallet])) {
  120. XYPersonalCenterListModel *membersModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_time" title:kLocalizedString(@"时间钱包") content:self.minutes==0?@"":[NSString stringWithFormat:@"%ld%@", (long)self.minutes,kLocalizedString(@"分钟")] isShowMoreImage:YES pushControllerName:@"" borderType:borderType];
  121. [normalItems addObject:membersModel];
  122. }
  123. XYPersonalCenterListModel *backpackModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_backpack" title:kLocalizedString(@"我的背包") content:@"" isShowMoreImage:YES pushControllerName:NSStringFromClass([XYBackpackManageViewController class]) borderType:borderType];
  124. [normalItems addObject:backpackModel];
  125. XYPersonalCenterListModel *visitorsModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_visitors" title:kLocalizedString(@"我的访客") content:@"" isShowMoreImage:YES pushControllerName:NSStringFromClass([XYVisitorsManagerViewController class]) borderType:borderType];
  126. [normalItems addObject:visitorsModel];
  127. XYPersonalCenterListModel *liveModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_voiceLive" title:kLocalizedString(@"我要开播") content:@"" isShowMoreImage:YES pushControllerName:@"" borderType:borderType];
  128. [normalItems addObject:liveModel];
  129. XYPersonalCenterListModel *voiceModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_voice" title:kLocalizedString(@"语音房") content:@"" isShowMoreImage:YES pushControllerName:NSStringFromClass([XYMyVoiceRoomListViewController class]) borderType:borderType];
  130. [normalItems addObject:voiceModel];
  131. XYPersonalCenterListModel *voiceCollectModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_voiceroom_collect" title:kLocalizedString(@"我的收藏") content:@"" isShowMoreImage:YES pushControllerName:NSStringFromClass([XYMyVoiceRoomListViewController class]) borderType:borderType];
  132. [normalItems addObject:voiceCollectModel];
  133. XYPersonalCenterListModel *familyModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_family" title:kLocalizedString(@"我的家族") content:@"" isShowMoreImage:YES pushControllerName:NSStringFromClass([XYMyVoiceRoomListViewController class]) borderType:borderType];
  134. [normalItems addObject:familyModel];
  135. if (StringIsNotEmpty([XYAppConfigModel getUrlLevel])) {
  136. XYPersonalCenterListModel *levelModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_level" title:kLocalizedString(@"我的等级") content:@"" isShowMoreImage:YES pushControllerName:@"" borderType:borderType];
  137. [normalItems addObject:levelModel];
  138. }
  139. XYPersonalCenterListModel *realNameModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_realName" title:kLocalizedString(@"实名认证") content:@"" isShowMoreImage:YES pushControllerName:@"" borderType:borderType];
  140. [normalItems addObject:realNameModel];
  141. XYPersonalCenterListModel *skillsModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_skills" title:kLocalizedString(@"大神认证") content:@"" isShowMoreImage:YES pushControllerName:@"" borderType:borderType];
  142. [normalItems addObject:skillsModel];
  143. //if (ApplicationDelegate.appConfigModel.channelConfig.inviteAddress.length) {
  144. XYPersonalCenterListModel *shareModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_share" title:kLocalizedString(@"邀请好友") content:@"" isShowMoreImage:YES pushControllerName:@"XYInviteFriendsController" borderType:borderType];
  145. [normalItems addObject:shareModel];
  146. //}
  147. XYPersonalCenterListModel *helpModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_help" title:kLocalizedString(@"帮助与反馈") content:@"" isShowMoreImage:YES pushControllerName:NSStringFromClass(XYSendFeedbackViewController.class) borderType:borderType];
  148. [normalItems addObject:helpModel];
  149. borderType = UIRectCornerBottomLeft|UIRectCornerBottomRight;
  150. XYPersonalCenterListModel *setupModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_my_setup" title:kLocalizedString(@"设置") content:@"" isShowMoreImage:YES pushControllerName:@"XYSetupViewController" borderType:borderType];
  151. [normalItems addObject:setupModel];
  152. */
  153. XYPersonalCenterListModel *voiceModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_personal_center_voiceroom" title:kLocalizedString(@"语音房") content:@"" isShowMoreImage:YES pushControllerName:NSStringFromClass([XYMyVoiceRoomListViewController class]) borderType:borderType];
  154. [normalItems addObject:voiceModel];
  155. XYPersonalCenterListModel *familyModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_personal_center_myfamily" title:kLocalizedString(@"我的家族") content:@"" isShowMoreImage:YES pushControllerName:NSStringFromClass([XYMyVoiceRoomListViewController class]) borderType:borderType];
  156. [normalItems addObject:familyModel];
  157. XYPersonalCenterListModel *realNameModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_personal_center_realauth" title:kLocalizedString(@"实名认证") content:@"" isShowMoreImage:YES pushControllerName:@"" borderType:borderType];
  158. [normalItems addObject:realNameModel];
  159. XYPersonalCenterListModel *liveModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_personal_center_startbroadcast" title:kLocalizedString(@"我要开播") content:@"" isShowMoreImage:YES pushControllerName:@"" borderType:borderType];
  160. [normalItems addObject:liveModel];
  161. XYPersonalCenterListModel *wishModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_personal_center_wishcenter" title:kLocalizedString(@"许愿中心") content:@"未设置" isShowMoreImage:YES pushControllerName:NSStringFromClass([XYWishCenterViewController class]) borderType:borderType];
  162. if (StringIsNotEmpty(self.wishModel.wishId)) {
  163. wishModel.content = [NSString stringWithFormat:@"%ld/%ld", self.wishModel.currentNum, self.wishModel.giftNum];
  164. wishModel.imageContent = [self.wishModel.giftIcon copy];
  165. }
  166. [normalItems addObject:wishModel];
  167. XYPersonalCenterListModel *skillsModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_personal_center_godauth" title:kLocalizedString(@"大神认证") content:@"" isShowMoreImage:YES pushControllerName:@"" borderType:borderType];
  168. [normalItems addObject:skillsModel];
  169. XYPersonalCenterListModel *orderCenterModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_personal_center_ordercenter" title:PeiWanEnable?kLocalizedString(@"订单中心"):kLocalizedString(@"派单记录") content:@"" isShowMoreImage:YES pushControllerName:NSStringFromClass([XYOrderCenterMainViewController class]) borderType:borderType];
  170. [normalItems addObject:orderCenterModel];
  171. if (StringIsNotEmpty([XYAppConfigModel getUrlLevel])) {
  172. XYPersonalCenterListModel *levelModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_personal_center_mygrade" title:kLocalizedString(@"我的等级") content:@"" isShowMoreImage:YES pushControllerName:@"" borderType:borderType];
  173. [normalItems addObject:levelModel];
  174. }
  175. XYPersonalCenterListModel *voiceCollectModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_personal_center_mycollect" title:kLocalizedString(@"我的收藏") content:@"" isShowMoreImage:YES pushControllerName:NSStringFromClass([XYMyVoiceRoomListViewController class]) borderType:borderType];
  176. [normalItems addObject:voiceCollectModel];
  177. XYPersonalCenterListModel *visitorsModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_personal_center_myvisit" title:kLocalizedString(@"我的访客") content:@"" isShowMoreImage:YES pushControllerName:NSStringFromClass([XYVisitorsManagerViewController class]) borderType:borderType];
  178. [normalItems addObject:visitorsModel];
  179. XYPersonalCenterListModel *shareModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_personal_center_invitefriend" title:kLocalizedString(@"邀请好友") content:@"" isShowMoreImage:YES pushControllerName:@"XYInviteFriendsController" borderType:borderType];
  180. [normalItems addObject:shareModel];
  181. XYPersonalCenterListModel *helpModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_personal_center_help" title:kLocalizedString(@"帮助与反馈") content:@"" isShowMoreImage:YES pushControllerName:NSStringFromClass(XYSendFeedbackViewController.class) borderType:borderType];
  182. [normalItems addObject:helpModel];
  183. XYPersonalCenterListModel *signModel = [XYPersonalCenterListModel createListModelWithIconName:@"icon_personal_center_sign" title:kLocalizedString(@"每日签到") content:@"" isShowMoreImage:YES pushControllerName:@"" borderType:borderType];
  184. [normalItems addObject:signModel];
  185. if (itemArray.count > 0) {
  186. XYPersonalCenterListModel *normalItemModel = [XYPersonalCenterListModel createListModelWithIconName:@"" title:kLocalizedString(@"常驻功能") content:@"" isShowMoreImage:YES pushControllerName:@"" borderType:UIRectCornerAllCorners];
  187. normalItemModel.urlItemArray = normalItems;
  188. [self.dataSource addObject:normalItemModel];
  189. }
  190. [self.dataSource addObject:[EmptyCellModel new]];
  191. }
  192. }
  193. + (CGFloat)getNormalItemsHeightWithItems:(NSArray *)items {
  194. NSInteger count = items.count;
  195. CGFloat itemWidth = 67.0f;
  196. CGFloat itemHeight = 64.0f;
  197. CGFloat itemTop = 8.0f;
  198. CGFloat itemBottom = 8.0f;
  199. // 总宽度除以一个item的宽度获取一行最多放多少个item
  200. // NSInteger lineMaxCount = (SCREEN_WIDTH-16.0f*2)/itemWidth;
  201. NSInteger lineMaxCount = 4;
  202. // 获取行数 行数=(总个数-1)/列数+1
  203. NSInteger line = (count-1)/lineMaxCount+1;
  204. CGFloat cellHeight = itemTop+line*itemHeight+itemBottom;
  205. return cellHeight;
  206. }
  207. - (void)loadDataWithUserInfo:(BOOL)isUserInfo success:(SuccessHandler)success failure:(FailureHandler)failure {
  208. NSError *error;
  209. dispatch_group_t group = dispatch_group_create();
  210. dispatch_queue_t queue = dispatch_get_main_queue();
  211. if ([XYUserInfoManager nowUser]) {
  212. dispatch_group_enter(group);
  213. dispatch_async(queue, ^{
  214. [[XYUserAPIManager new] getProfileSuccessHandler:^(ZYLResponseModel *responseModel) {
  215. self.fansCount = [responseModel.data[@"fansCount"] integerValue];
  216. self.followCount = [responseModel.data[@"followCount"] integerValue];
  217. self.charmValue = [CaculateNumberTool stringFromNumber:[BaseMethod toString:responseModel.data[@"charmValue"]].doubleValue toFixedCount:1 roundingMode:CNRoundingModeOnlyDown];
  218. self.wealthValue = [CaculateNumberTool stringFromNumber:[BaseMethod toString:responseModel.data[@"wealthValue"]].doubleValue toFixedCount:1 roundingMode:CNRoundingModeOnlyDown];
  219. self.starValue = [CaculateNumberTool stringFromNumber:[BaseMethod toString:responseModel.data[@"starValue"]].doubleValue toFixedCount:1 roundingMode:CNRoundingModeOnlyDown];
  220. int niceLevel = [responseModel.data[@"userNiceNo"][@"niceLevel"] intValue];
  221. [XYUserInfoManager nowUser].niceLevel = niceLevel;
  222. self.visitCount = [responseModel.data[@"visitCount"] integerValue];
  223. self.intervieweeCount = [responseModel.data[@"intervieweeCount"] integerValue];
  224. dispatch_group_leave(group);
  225. } failureHandler:^(NSError *error) {
  226. error = error;
  227. dispatch_group_leave(group);
  228. }];
  229. });
  230. if (!isUserInfo) {
  231. dispatch_group_enter(group);
  232. dispatch_async(queue, ^{
  233. [[XYUserAPIManager new] getUserWalletSuccessHandler:^(ZYLResponseModel *responseModel) {
  234. dispatch_group_leave(group);
  235. } failureHandler:^(NSError *error) {
  236. dispatch_group_leave(group);
  237. }];
  238. });
  239. dispatch_group_enter(group);
  240. dispatch_async(queue, ^{
  241. [[XYUserAPIManager new] getUserChatTimeWalletSuccessHandler:^(ZYLResponseModel *responseModel) {
  242. self.minutes = [responseModel.data[@"minutes"] integerValue];
  243. dispatch_group_leave(group);
  244. } failureHandler:^(NSError *error) {
  245. dispatch_group_leave(group);
  246. }];
  247. });
  248. dispatch_group_enter(group);
  249. dispatch_async(queue, ^{
  250. [[XYWishAPIManager new] getWishOpenedDetailWithUserId:[XYUserInfoManager nowUser].userId successHandler:^(ZYLResponseModel *responseModel) {
  251. XYWishGiftModel *wishModel = [XYWishGiftModel new];
  252. [wishModel yy_modelSetWithDictionary:responseModel.data];
  253. self.wishModel = wishModel;
  254. dispatch_group_leave(group);
  255. } failureHandler:^(ZYLNetworkError *error) {
  256. dispatch_group_leave(group);
  257. }];
  258. });
  259. dispatch_group_enter(group);
  260. dispatch_async(queue, ^{
  261. [[XYConfigAPIManager new] getBannersWithBannerPosition:501 categoryId:@"" successHandler:^(ZYLResponseModel *responseModel) {
  262. dispatch_group_leave(group);
  263. [[XYUserInfoManager sharedInstance].rechargeActivityRewardArrs removeAllObjects];
  264. [[XYUserInfoManager sharedInstance].rechargeActivityRewardArrs addObjectsFromArray:responseModel.data[@"list"]];
  265. } failureHandler:^(ZYLNetworkError *error) {
  266. dispatch_group_leave(group);
  267. }];
  268. });
  269. }
  270. }else {
  271. self.minutes = 0;
  272. self.fansCount = 0;
  273. self.followCount = 0;
  274. self.charmValue = @"0";
  275. self.starValue = @"0";
  276. self.wealthValue = @"0";
  277. }
  278. dispatch_group_notify(group, queue, ^{
  279. dispatch_async(dispatch_get_main_queue(), ^{
  280. [self initValue];
  281. if (error) {
  282. !failure?:failure(error);
  283. }else {
  284. !success?:success(self.dataSource);
  285. }
  286. });
  287. });
  288. }
  289. @end