1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- //
- // FKExploreReform.m
- // FirstLink
- //
- // Created by ascii on 16/2/16.
- // Copyright © 2016年 FirstLink. All rights reserved.
- //
- #import "FKExploreReform.h"
- #import "FKExploreTopicTag.h"
- #import "FKExploreTopicListItem.h"
- @implementation FKExploreReform
- + (NSArray *)parserExploreTopicTags:(NSDictionary *)json {
- NSDictionary *dict = json[@"data"][@"list"];
-
- FKExploreTopicTag *topicTag;
- NSMutableArray *array = [NSMutableArray array];
- if ([dict isKindOfClass:[NSArray class]]) {
- for (NSDictionary *itemDict in dict) {
- topicTag = [FKExploreTopicTag new];
- [topicTag mts_setValuesForKeysWithDictionary:itemDict];
-
- [array addObject:topicTag];
- }
- return array;
- }
- return nil;
- }
- + (NSMutableArray *)parserExploreTopicList:(NSDictionary *)json {
- NSDictionary *dict = json[@"data"][@"list"];
-
- FKExploreTopicListItem *topicItem;
- FKExploreTopicListSubItem *subItem;
-
- NSMutableArray *topicItemArray = [NSMutableArray array];
- NSMutableArray *subItemArray;
- if ([dict isKindOfClass:[NSArray class]]) {
- for (NSDictionary *itemDict in dict) {
- topicItem = [FKExploreTopicListItem new];
- [topicItem mts_setValuesForKeysWithDictionary:itemDict[@"topic"]];
-
- subItemArray = [NSMutableArray array];
- for (NSDictionary *subItemDict in itemDict[@"list"]) {
- subItem = [FKExploreTopicListSubItem new];
- [subItem mts_setValuesForKeysWithDictionary:subItemDict];
-
- [subItemArray addObject:subItem];
- }
- topicItem.subItemArray = subItemArray;
-
- [topicItemArray addObject:topicItem];
- }
- return topicItemArray;
- }
- return nil;
- }
- @end
|