// // FKAllOrderReform.m // FirstLink // // Created by ascii on 15/8/24. // Copyright (c) 2015年 FirstLink. All rights reserved. // #import "FKPersonOrderReform.h" #import "FKOrderPaymentItem.h" #import "FKOrderSupplierItem.h" #import "FKProCountryItem.h" #import "FKOrderBriefItem.h" #import "FKOrderGoodItem.h" #import "FKPersonOrderBadgeItem.h" @implementation FKPersonOrderReform + (NSMutableArray *)parseOrderItems:(NSDictionary *)json { if (json[@"data"] != [NSNull null]) { FKOrderPaymentItem *paymentItem; FKOrderSupplierItem *supplierItem; FKProCountryItem *countryItem; FKOrderBriefItem *orderItem; FKOrderGoodItem *goodItem; NSMutableArray *supplierArray; NSMutableArray *goodArray; NSMutableArray *paymentArray = [NSMutableArray array]; for (NSDictionary *paymentDict in json[@"data"][@"list"]) { paymentItem = [[FKOrderPaymentItem alloc] init]; [paymentItem mts_setValuesForKeysWithDictionary:paymentDict[@"payment_order"]]; supplierArray = [NSMutableArray array]; for (NSDictionary *supplierDict in paymentDict[@"list"]) { supplierItem = [[FKOrderSupplierItem alloc] init]; [supplierItem mts_setValuesForKeysWithDictionary:supplierDict[@"supplier"]]; countryItem = [[FKProCountryItem alloc] init]; [countryItem mts_setValuesForKeysWithDictionary:supplierDict[@"country"]]; supplierItem.countryItem = countryItem; orderItem = [[FKOrderBriefItem alloc] init]; [orderItem mts_setValuesForKeysWithDictionary:supplierDict[@"post_order"]]; supplierItem.orderItem = orderItem; goodArray = [NSMutableArray array]; for (NSDictionary *goodDict in supplierDict[@"goods_list"]) { goodItem = [[FKOrderGoodItem alloc] init]; [goodItem mts_setValuesForKeysWithDictionary:goodDict]; [goodArray addObject:goodItem]; } supplierItem.goodArray = goodArray; [supplierArray addObject:supplierItem]; } paymentItem.supplierArray = supplierArray; [paymentArray addObject:paymentItem]; } return paymentArray; } return nil; } + (FKPersonOrderBadgeItem *)parseOrderBadge:(NSDictionary *)json { if (json[@"data"] != [NSNull null]) { FKPersonOrderBadgeItem *badge = [FKPersonOrderBadgeItem new]; [badge mts_setValuesForKeysWithDictionary:json[@"data"][@"count"]]; return badge; } return nil; } @end