Commit 516b3cc5cf39e8819d8fdc4d895ef02549a9ee9e
1 parent
ff44f426
0.3.3我的首页卡顿问题修复
Showing
5 changed files
with
23 additions
and
75 deletions
CNLiveCMineModule.podspec
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | Pod::Spec.new do |s| | 9 | Pod::Spec.new do |s| |
| 10 | s.name = 'CNLiveCMineModule' | 10 | s.name = 'CNLiveCMineModule' |
| 11 | - s.version = '0.3.2' | 11 | + s.version = '0.3.3' |
| 12 | s.summary = '网家家C端个人中心' | 12 | s.summary = '网家家C端个人中心' |
| 13 | 13 | ||
| 14 | # This description is used to generate tags and improve search results. | 14 | # This description is used to generate tags and improve search results. |
CNLiveCMineModule/Classes/CNCMine/Present/CNMinePresent.h
| @@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN | @@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 47 | /// 返回我的工具内容 | 47 | /// 返回我的工具内容 |
| 48 | + (CNMineModel *)datasourceToolModel:(CNToolDatasourceType)type carNum:(NSString *)carNum; | 48 | + (CNMineModel *)datasourceToolModel:(CNToolDatasourceType)type carNum:(NSString *)carNum; |
| 49 | 49 | ||
| 50 | -+ (void)requestMineDataSourceWithBlock:(void (^)(NSArray *activities,CNScoreModel *model))completerBlock; | 50 | ++ (void)requestMineDataSourceWithBlock:(void (^)(CNScoreModel *model))completerBlock; |
| 51 | 51 | ||
| 52 | /// 改版评价提交 | 52 | /// 改版评价提交 |
| 53 | /// @param message 评价内容 | 53 | /// @param message 评价内容 |
CNLiveCMineModule/Classes/CNCMine/Present/CNMinePresent.m
| @@ -347,82 +347,26 @@ | @@ -347,82 +347,26 @@ | ||
| 347 | CNMineModel *toolsModel = [CNMineModel mj_objectWithKeyValues:toolDic]; | 347 | CNMineModel *toolsModel = [CNMineModel mj_objectWithKeyValues:toolDic]; |
| 348 | return toolsModel; | 348 | return toolsModel; |
| 349 | } | 349 | } |
| 350 | -+ (void)requestMineDataSourceWithBlock:(void (^)(NSArray * _Nonnull, CNScoreModel * _Nonnull))completerBlock | 350 | ++ (void)requestMineDataSourceWithBlock:(void (^)( CNScoreModel * _Nonnull))completerBlock |
| 351 | { | 351 | { |
| 352 | if (![CNLiveNetworking isNetworking]) { | 352 | if (![CNLiveNetworking isNetworking]) { |
| 353 | [QMUITips showWithText:@"无法连接网络" inView:AppKeyWindow hideAfterDelay:1.5]; | 353 | [QMUITips showWithText:@"无法连接网络" inView:AppKeyWindow hideAfterDelay:1.5]; |
| 354 | return; | 354 | return; |
| 355 | } | 355 | } |
| 356 | NSDictionary *params = @{@"uid":[CNUserInfoManager manager].userInfoModel.uid?[CNUserInfoManager manager].userInfoModel.uid:@""}; | 356 | NSDictionary *params = @{@"uid":[CNUserInfoManager manager].userInfoModel.uid?[CNUserInfoManager manager].userInfoModel.uid:@""}; |
| 357 | - NSDictionary *params1 = @{ | ||
| 358 | - @"blockId": @"9", | ||
| 359 | - @"userId":CNUserShareModel.uid?CNUserShareModel.uid:@"", | ||
| 360 | - @"type":@"1", | ||
| 361 | - @"page":@"1", | ||
| 362 | - @"pageSize":@"10" | ||
| 363 | - }; | ||
| 364 | - __block CNLiveNetworking *orderCountNetworking = [CNLiveNetworking createBatchOrChainNetworkWithMethod:CNLiveRequestMethodPOST URLString:cn_API_Manageshop(@"/Api/Index3/myOrderCount") Param:params]; | ||
| 365 | - orderCountNetworking.tag = 1001; | ||
| 366 | - orderCountNetworking.isShowDataResult = YES; | ||
| 367 | - orderCountNetworking.allowRequestDefaultArgument = YES; | ||
| 368 | - orderCountNetworking.isDSRequest = YES; | ||
| 369 | - orderCountNetworking.resultResponseAsynchronously = NO; | ||
| 370 | - __block CNLiveNetworking *blockNetworking = [CNLiveNetworking createBatchOrChainNetworkWithMethod:CNLiveRequestMethodGET URLString:cn_API_Classify(@"/contentApi/getBlockContents") Param:params1]; | ||
| 371 | - blockNetworking.tag = 1002; | ||
| 372 | - blockNetworking.isShowDataResult = YES; | ||
| 373 | - blockNetworking.isDSRequest = NO; | ||
| 374 | - blockNetworking.allowRequestDefaultArgument = YES; | ||
| 375 | - blockNetworking.resultResponseAsynchronously = NO; | ||
| 376 | - [CNLiveNetworkManager requestBatchWithArray:@[orderCountNetworking,blockNetworking] CompletionBlock:^(NSArray *resultArray) { | ||
| 377 | - @try { | ||
| 378 | - CNScoreModel *model = nil; | ||
| 379 | - NSMutableArray *activityListArr = [[NSMutableArray alloc] init]; | ||
| 380 | - for (CNLiveNetworking *networking in resultArray) { | ||
| 381 | - if (networking .tag == 1001) { | ||
| 382 | - if (!networking.error) { | ||
| 383 | - model = [CNScoreModel mj_objectWithKeyValues:networking.responseObject]; | ||
| 384 | - }else{ | ||
| 385 | - [QMUITips showWithText:@"接口请求错误" inView:AppKeyWindow hideAfterDelay:1.5]; | ||
| 386 | - } | ||
| 387 | - } | ||
| 388 | - if (networking.tag == 1002) { | ||
| 389 | - if (!networking.error) { | ||
| 390 | - NSDictionary *data = networking.responseObject; | ||
| 391 | - | ||
| 392 | - if (data && [data isKindOfClass:[NSDictionary class]]) { | ||
| 393 | - | ||
| 394 | - | ||
| 395 | - NSArray *dataArr = data[@"list"]; | ||
| 396 | - | ||
| 397 | - if (dataArr.count>0) { | ||
| 398 | - | ||
| 399 | - for (NSDictionary *dic in dataArr) | ||
| 400 | - { | ||
| 401 | - if ([dic isKindOfClass:[NSDictionary class]]) | ||
| 402 | - { | ||
| 403 | - NSDictionary *dictionary = @{ | ||
| 404 | - @"imgName":dic[@"transverseImg"], | ||
| 405 | - @"url":dic[@"thirdUrl"], | ||
| 406 | - @"title":dic[@"title"] | ||
| 407 | - }; | ||
| 408 | - CNActivityListModel *model = [CNActivityListModel mj_objectWithKeyValues:dictionary]; | ||
| 409 | - [activityListArr addObject:model]; | ||
| 410 | - } | ||
| 411 | - } | ||
| 412 | - } | ||
| 413 | - } | ||
| 414 | - } | ||
| 415 | - } | ||
| 416 | - if (completerBlock) { | ||
| 417 | - completerBlock(activityListArr.copy,model); | ||
| 418 | - } | ||
| 419 | - } | ||
| 420 | - | ||
| 421 | - } @catch (NSException *exception) { | ||
| 422 | - NSLog(@"异常了"); | 357 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; |
| 358 | + [CNLiveNetworking setupDSRequest:YES]; | ||
| 359 | + [CNLiveNetworking setupShowDataResult:YES]; | ||
| 360 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:cn_API_Manageshop(@"/Api/Index3/myOrderCount") Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 361 | + if (error) { | ||
| 362 | + [QMUITips showWithText:@"接口请求错误" inView:AppKeyWindow hideAfterDelay:1.5]; | ||
| 363 | + return; | ||
| 364 | + } | ||
| 365 | + CNScoreModel *model = [CNScoreModel mj_objectWithKeyValues:responseObject]; | ||
| 366 | + if (completerBlock) { | ||
| 367 | + completerBlock(model); | ||
| 423 | } | 368 | } |
| 424 | }]; | 369 | }]; |
| 425 | - | ||
| 426 | } | 370 | } |
| 427 | + (void)requestFeedback:(NSString *)message secceedBlock:(void(^)(void))responseBlock | 371 | + (void)requestFeedback:(NSString *)message secceedBlock:(void(^)(void))responseBlock |
| 428 | { | 372 | { |
CNLiveCMineModule/Classes/CNCMine/ViewController/CNLiveMineVC.m
| @@ -17,6 +17,7 @@ | @@ -17,6 +17,7 @@ | ||
| 17 | #import "CNRevisionInstructionView.h" | 17 | #import "CNRevisionInstructionView.h" |
| 18 | #import <CNLiveBaseTools/UIImage+EditIcon.h> | 18 | #import <CNLiveBaseTools/UIImage+EditIcon.h> |
| 19 | #import <DSBaseModule/DSBaseModule.h> | 19 | #import <DSBaseModule/DSBaseModule.h> |
| 20 | +#import "CNWalletPresent.h" | ||
| 20 | 21 | ||
| 21 | 22 | ||
| 22 | //有新客服消息 | 23 | //有新客服消息 |
| @@ -42,9 +43,8 @@ static NSString *const CNSobotNotification_NewMessage = @"CNSobotNotification_Ne | @@ -42,9 +43,8 @@ static NSString *const CNSobotNotification_NewMessage = @"CNSobotNotification_Ne | ||
| 42 | 43 | ||
| 43 | @implementation CNLiveMineVC | 44 | @implementation CNLiveMineVC |
| 44 | - (void)loadData{ | 45 | - (void)loadData{ |
| 45 | - [CNMinePresent requestMineDataSourceWithBlock:^(NSArray * _Nonnull activities, CNScoreModel * _Nonnull model) { | 46 | + [CNMinePresent requestMineDataSourceWithBlock:^(CNScoreModel * _Nonnull model) { |
| 46 | [self.bgScrollView.mj_header endRefreshing]; | 47 | [self.bgScrollView.mj_header endRefreshing]; |
| 47 | - self.activityView.dataSource = activities; | ||
| 48 | self.carCount = model.cart_count; | 48 | self.carCount = model.cart_count; |
| 49 | self.orderView.model = [CNMinePresent dataSourceOrdersModel:model.pay_order_count willShip:model.send_order_count willReceipt:model.confirm_order_count]; | 49 | self.orderView.model = [CNMinePresent dataSourceOrdersModel:model.pay_order_count willShip:model.send_order_count willReceipt:model.confirm_order_count]; |
| 50 | self.packageView.integral = model.integral; | 50 | self.packageView.integral = model.integral; |
| @@ -52,6 +52,9 @@ static NSString *const CNSobotNotification_NewMessage = @"CNSobotNotification_Ne | @@ -52,6 +52,9 @@ static NSString *const CNSobotNotification_NewMessage = @"CNSobotNotification_Ne | ||
| 52 | self.packageView.model = [CNMinePresent dataSourceWalletModel:model.integral couponNum:model.coupon_count balance:model.money]; | 52 | self.packageView.model = [CNMinePresent dataSourceWalletModel:model.integral couponNum:model.coupon_count balance:model.money]; |
| 53 | self.toolView.model = [CNMinePresent datasourceToolModel:CNToolDatasourceTypeFirst carNum:model.cart_count]; | 53 | self.toolView.model = [CNMinePresent datasourceToolModel:CNToolDatasourceTypeFirst carNum:model.cart_count]; |
| 54 | }]; | 54 | }]; |
| 55 | + [CNWalletPresent requestActivityListBlock:^(NSArray * _Nonnull activities) { | ||
| 56 | + self.activityView.dataSource = activities; | ||
| 57 | + }]; | ||
| 55 | } | 58 | } |
| 56 | 59 | ||
| 57 | - (void)viewDidLoad { | 60 | - (void)viewDidLoad { |
CNLiveCMineModule/Classes/CNWallet/Present/CNWalletPresent.m
| @@ -76,16 +76,17 @@ | @@ -76,16 +76,17 @@ | ||
| 76 | @"pageSize":@"10" | 76 | @"pageSize":@"10" |
| 77 | }; | 77 | }; |
| 78 | [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | 78 | [CNLiveNetworking setAllowRequestDefaultArgument:YES]; |
| 79 | - [CNLiveNetworking setupShowDataResult:YES]; | 79 | + [CNLiveNetworking setupShowDataResult:NO]; |
| 80 | [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:cn_API_Classify(@"/contentApi/getBlockContents") Param:params CacheType:NO CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | 80 | [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:cn_API_Classify(@"/contentApi/getBlockContents") Param:params CacheType:NO CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { |
| 81 | if (error) { | 81 | if (error) { |
| 82 | [QMUITips showError:error.localizedDescription inView:AppKeyWindow hideAfterDelay:1.5]; | 82 | [QMUITips showError:error.localizedDescription inView:AppKeyWindow hideAfterDelay:1.5]; |
| 83 | + responseBlock(@[]); | ||
| 83 | return; | 84 | return; |
| 84 | } | 85 | } |
| 85 | - if (responseObject && [responseObject isKindOfClass:[NSDictionary class]]) { | 86 | + if (responseObject[@"data"] && [responseObject[@"data"] isKindOfClass:[NSDictionary class]]) { |
| 86 | 87 | ||
| 87 | 88 | ||
| 88 | - NSArray *dataArr = responseObject[@"list"]; | 89 | + NSArray *dataArr = responseObject[@"data"][@"list"]; |
| 89 | 90 | ||
| 90 | if (dataArr.count>0) { | 91 | if (dataArr.count>0) { |
| 91 | NSMutableArray *activityListArr = [[NSMutableArray alloc] init]; | 92 | NSMutableArray *activityListArr = [[NSMutableArray alloc] init]; |