No Description

FKExploreReform.m 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // FKExploreReform.m
  3. // FirstLink
  4. //
  5. // Created by ascii on 16/2/16.
  6. // Copyright © 2016年 FirstLink. All rights reserved.
  7. //
  8. #import "FKExploreReform.h"
  9. #import "FKExploreTopicTag.h"
  10. #import "FKExploreTopicListItem.h"
  11. @implementation FKExploreReform
  12. + (NSArray *)parserExploreTopicTags:(NSDictionary *)json {
  13. NSDictionary *dict = json[@"data"][@"list"];
  14. FKExploreTopicTag *topicTag;
  15. NSMutableArray *array = [NSMutableArray array];
  16. if ([dict isKindOfClass:[NSArray class]]) {
  17. for (NSDictionary *itemDict in dict) {
  18. topicTag = [FKExploreTopicTag new];
  19. [topicTag mts_setValuesForKeysWithDictionary:itemDict];
  20. [array addObject:topicTag];
  21. }
  22. return array;
  23. }
  24. return nil;
  25. }
  26. + (NSMutableArray *)parserExploreTopicList:(NSDictionary *)json {
  27. NSDictionary *dict = json[@"data"][@"list"];
  28. FKExploreTopicListItem *topicItem;
  29. FKExploreTopicListSubItem *subItem;
  30. NSMutableArray *topicItemArray = [NSMutableArray array];
  31. NSMutableArray *subItemArray;
  32. if ([dict isKindOfClass:[NSArray class]]) {
  33. for (NSDictionary *itemDict in dict) {
  34. topicItem = [FKExploreTopicListItem new];
  35. [topicItem mts_setValuesForKeysWithDictionary:itemDict[@"topic"]];
  36. subItemArray = [NSMutableArray array];
  37. for (NSDictionary *subItemDict in itemDict[@"list"]) {
  38. subItem = [FKExploreTopicListSubItem new];
  39. [subItem mts_setValuesForKeysWithDictionary:subItemDict];
  40. [subItemArray addObject:subItem];
  41. }
  42. topicItem.subItemArray = subItemArray;
  43. [topicItemArray addObject:topicItem];
  44. }
  45. return topicItemArray;
  46. }
  47. return nil;
  48. }
  49. @end