Aucune description

FKProductInfoItem.m 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //
  2. // FKProductInfoItem.m
  3. // FirstLink
  4. //
  5. // Created by jack on 16/1/20.
  6. // Copyright © 2016年 FirstLink. All rights reserved.
  7. //
  8. #import "FKProductInfoItem.h"
  9. @implementation FKProductInfoItem
  10. + (NSDictionary *)mts_mapping{
  11. return @{
  12. @"id": mts_key(productId),
  13. @"name": mts_key(name),
  14. @"title": mts_key(title),
  15. @"description": mts_key(desc),
  16. @"description_original": mts_key(descOrginal),
  17. @"description_cn": mts_key(descChinese),
  18. @"first_pic": mts_key(firstPicUrl),
  19. @"brand": mts_key(brand),
  20. @"brand_id": mts_key(brandId),
  21. @"price": mts_key(price),
  22. @"original_price": mts_key(originalPrice),
  23. @"refer_price": mts_key(referPrice),
  24. @"url": mts_key(linkUrl),
  25. @"sales_count": mts_key(soldCount),
  26. @"status": mts_key(status),
  27. @"salable": mts_key(salable),
  28. @"operate_status": mts_key(operateStatus),
  29. @"weight": mts_key(weight),
  30. @"official_score": mts_key(officialScore),
  31. @"official_review_count": mts_key(officialReviewCount),
  32. @"official_rank": mts_key(officialRank),
  33. @"bc_channel": mts_key(isBCChannel),
  34. @"pay_tax": mts_key(isPayTax),
  35. @"tax_rate": mts_key(taxRate),
  36. @"international_postage": mts_key(internationalPostage),
  37. };
  38. }
  39. + (BOOL)mts_shouldSetUndefinedKeys{
  40. return NO;
  41. }
  42. - (NSString *)getValidReferPrice{
  43. if ([self.referPrice isKindOfClass:[NSString class]] && self.referPrice.length > 0 && self.referPrice.floatValue > 0) {
  44. return self.referPrice;
  45. }
  46. return nil;
  47. }
  48. - (BOOL)productOnLine{
  49. if ([self.status isKindOfClass:[NSString class]]) {
  50. if (self.status.integerValue == 1) return YES;
  51. }
  52. return NO;
  53. }
  54. - (BOOL)isProductValid {
  55. if (self.operateStatus && [self.operateStatus isKindOfClass:[NSString class]]) {
  56. if (self.operateStatus.integerValue != 1) {
  57. return NO;
  58. }
  59. }
  60. return YES;
  61. }
  62. - (BOOL)isHasAmazonScore {
  63. if (self.officialScore && self.officialReviewCount) {
  64. return YES;
  65. }
  66. return NO;
  67. }
  68. - (NSString *)offLineStr{
  69. if (![self isProductValid]) {
  70. return @"已失效";
  71. }
  72. if ([self.status isKindOfClass:[NSString class]] && self.status.integerValue != 1) {
  73. if (self.status.integerValue == 3) return @"已失效"; // 运营下线
  74. return @"已抢光";
  75. }
  76. return nil;
  77. }
  78. @end