KWMProductResult.m 923 Bytes
Newer Older
houweibin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
//
//  KWMProductResult.m
//  iCemarose
//
//  Created by HouWeiBin on 2016/12/2.
//  Copyright © 2016年 kollway. All rights reserved.
//

#import "KWMProductResult.h"

@implementation KWMProductResult

- (instancetype)initWithDictionary:(NSDictionary *)dict
                        modelClass:(Class)modelClass
                             error:(NSError **)err {
    self = [super initWithDictionary:dict error:err];
    if (self) {
        NSDictionary *dataDictionary = dict[@"product"];
        if(dataDictionary){
20
            self.productDict = dataDictionary;
houweibin committed
21 22
            self.product = [self buildData:modelClass jsonDictionary:dataDictionary];
        }
lee committed
23 24 25 26 27 28
        
        NSMutableArray *datas = [NSMutableArray new];
        for (id d in dict[@"products"]) {
            [datas addObject:[self buildData:modelClass jsonDictionary:d]];
        }
        self.products = datas;
houweibin committed
29 30 31 32 33 34
    }
    
    return self;
}

@end