口袋版本的一折买

DetailRequestModel.m 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. //
  2. // DetailRequestModel.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/5/22.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "DetailRequestModel.h"
  9. @implementation DetailRequestModel
  10. - (instancetype)initWithId:(NSString *)good_id
  11. is_coupon:(NSString *)is_coupon
  12. coupon_price:(NSString *)coupon_price
  13. price:(NSString *)price
  14. discount_price:(NSString *)discount_price
  15. commission_rate:(NSString *)commission_rate
  16. coupon_start_time:(NSString *)coupon_start_time
  17. coupon_end_time:(NSString *)coupon_end_time
  18. {
  19. self = [super init];
  20. if (self) {
  21. self.goods_id = good_id;
  22. self.is_coupon = is_coupon;
  23. self.coupon_price = coupon_price;
  24. self.price = price;
  25. self.discount_price = discount_price;
  26. self.commission_rate = commission_rate;
  27. self.coupon_start_time = coupon_start_time;
  28. self.coupon_end_time = coupon_end_time;
  29. }
  30. return self;
  31. }
  32. - (instancetype)initWithChildModel:(YZMAChildGoodModel *)model {
  33. self = [super init];
  34. if (self) {
  35. self.goods_id = model.goods_id;
  36. self.is_coupon = model.is_coupon;
  37. self.coupon_price = model.coupon_price;
  38. self.price = model.price;
  39. self.discount_price = model.discount_price;
  40. self.commission_rate = model.commission_rate;
  41. self.coupon_start_time = model.coupon_start_time;
  42. self.coupon_end_time = model.coupon_end_time;
  43. }
  44. return self;
  45. }
  46. - (instancetype)initWithBuyLimitModel:(YZMABuyLimitGoodModel *)model {
  47. self = [super init];
  48. if (self) {
  49. self.goods_id = model.goods_id;
  50. self.is_coupon = model.is_coupon;
  51. self.coupon_price = model.coupon_price;
  52. self.price = model.price;
  53. self.discount_price = model.discount_price;
  54. self.commission_rate = model.commission_rate;
  55. self.coupon_start_time = model.coupon_start_time;
  56. self.coupon_end_time = model.coupon_end_time;
  57. }
  58. return self;
  59. }
  60. - (instancetype)initWithCommunityDetailModel:(YZMACommunityDetailModel *)model{
  61. self = [super init];
  62. if (self) {
  63. self.goods_id = model.goods_id;
  64. self.is_coupon = model.is_coupon;
  65. self.coupon_price = model.coupon_price;
  66. self.price = model.price;
  67. self.discount_price = model.discount_price;
  68. self.commission_rate = model.commission_rate;
  69. self.coupon_start_time = model.coupon_start_time;
  70. self.coupon_end_time = model.coupon_end_time;
  71. }
  72. return self;
  73. }
  74. //Model 到字典
  75. - (NSDictionary *)modelToDictionary
  76. {
  77. NSMutableDictionary *props = [NSMutableDictionary dictionary];
  78. unsigned int outCount, i;
  79. objc_property_t *properties = class_copyPropertyList([self class], &outCount);
  80. for (i = 0; i<outCount; i++)
  81. {
  82. objc_property_t property = properties[i];
  83. const char* char_f =property_getName(property);
  84. NSString *propertyName = [NSString stringWithUTF8String:char_f];
  85. id propertyValue = [self valueForKey:(NSString *)propertyName];
  86. if (propertyValue) [props setObject:propertyValue forKey:propertyName];
  87. }
  88. free(properties);
  89. return props;
  90. }
  91. - (void)setValue:(id)value forUndefinedKey:(NSString *)key {
  92. }
  93. @end