Açıklama Yok

FKPersonOrderReform.m 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //
  2. // FKAllOrderReform.m
  3. // FirstLink
  4. //
  5. // Created by ascii on 15/8/24.
  6. // Copyright (c) 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "FKPersonOrderReform.h"
  9. #import "FKOrderPaymentItem.h"
  10. #import "FKOrderSupplierItem.h"
  11. #import "FKProCountryItem.h"
  12. #import "FKOrderBriefItem.h"
  13. #import "FKOrderGoodItem.h"
  14. #import "FKPersonOrderBadgeItem.h"
  15. @implementation FKPersonOrderReform
  16. + (NSMutableArray *)parseOrderItems:(NSDictionary *)json {
  17. if (json[@"data"] != [NSNull null]) {
  18. FKOrderPaymentItem *paymentItem;
  19. FKOrderSupplierItem *supplierItem;
  20. FKProCountryItem *countryItem;
  21. FKOrderBriefItem *orderItem;
  22. FKOrderGoodItem *goodItem;
  23. NSMutableArray *supplierArray;
  24. NSMutableArray *goodArray;
  25. NSMutableArray *paymentArray = [NSMutableArray array];
  26. for (NSDictionary *paymentDict in json[@"data"][@"list"]) {
  27. paymentItem = [[FKOrderPaymentItem alloc] init];
  28. [paymentItem mts_setValuesForKeysWithDictionary:paymentDict[@"payment_order"]];
  29. supplierArray = [NSMutableArray array];
  30. for (NSDictionary *supplierDict in paymentDict[@"list"]) {
  31. supplierItem = [[FKOrderSupplierItem alloc] init];
  32. [supplierItem mts_setValuesForKeysWithDictionary:supplierDict[@"supplier"]];
  33. countryItem = [[FKProCountryItem alloc] init];
  34. [countryItem mts_setValuesForKeysWithDictionary:supplierDict[@"country"]];
  35. supplierItem.countryItem = countryItem;
  36. orderItem = [[FKOrderBriefItem alloc] init];
  37. [orderItem mts_setValuesForKeysWithDictionary:supplierDict[@"post_order"]];
  38. supplierItem.orderItem = orderItem;
  39. goodArray = [NSMutableArray array];
  40. for (NSDictionary *goodDict in supplierDict[@"goods_list"]) {
  41. goodItem = [[FKOrderGoodItem alloc] init];
  42. [goodItem mts_setValuesForKeysWithDictionary:goodDict];
  43. [goodArray addObject:goodItem];
  44. }
  45. supplierItem.goodArray = goodArray;
  46. [supplierArray addObject:supplierItem];
  47. }
  48. paymentItem.supplierArray = supplierArray;
  49. [paymentArray addObject:paymentItem];
  50. }
  51. return paymentArray;
  52. }
  53. return nil;
  54. }
  55. + (FKPersonOrderBadgeItem *)parseOrderBadge:(NSDictionary *)json {
  56. if (json[@"data"] != [NSNull null]) {
  57. FKPersonOrderBadgeItem *badge = [FKPersonOrderBadgeItem new];
  58. [badge mts_setValuesForKeysWithDictionary:json[@"data"][@"count"]];
  59. return badge;
  60. }
  61. return nil;
  62. }
  63. @end