1234567891011121314151617181920212223242526272829303132333435363738394041 |
- //
- // FKBookReform.m
- // FirstLink
- //
- // Created by jack on 16/4/28.
- // Copyright © 2016年 FirstLink. All rights reserved.
- //
- #import "FKBookReform.h"
- @implementation FKBookReform
- + (FKBookNormalViewModel *)parserBookNormalModelWithDict:(NSDictionary *)dict{
- if ([dict[@"data"] isKindOfClass:[NSDictionary class]]) {
- FKBookNormalViewModel *viewModel = [[FKBookNormalViewModel alloc]init];
- [viewModel mts_setValuesForKeysWithDictionary:dict[@"data"]];
- return viewModel;
- }
- return nil;
- }
- + (FKBookRecViewModel *)parserBookRecModelWithDict:(NSDictionary *)dict{
- if ([dict[@"data"] isKindOfClass:[NSDictionary class]]) {
-
- NSArray *dataArray = dict[@"data"][@"list"];
- if ([dataArray isKindOfClass:[NSArray class]] && dataArray.count > 0){
- NSMutableArray *arrayM = [NSMutableArray arrayWithCapacity:dataArray.count];
- for (NSDictionary *itemDict in dataArray) {
- FKBookRecItem *item = [[FKBookRecItem alloc]init];
- [item mts_setValuesForKeysWithDictionary:itemDict];
- [arrayM addObject:item];
- }
- FKBookRecViewModel *viewModel = [[FKBookRecViewModel alloc]init];
- viewModel.itemArray = arrayM;
- return viewModel;
- }
- }
- return nil;
- }
- @end
|