No Description

CashCouponItem.m 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // CashCoupon.m
  3. // FirstLink
  4. //
  5. // Created by ascii on 15/6/19.
  6. // Copyright (c) 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "CashCouponItem.h"
  9. #import "FKSubmitUnitItem.h"
  10. @implementation CashCouponItem
  11. + (NSDictionary *)mts_mapping
  12. {
  13. return @{
  14. @"id": mts_key(itemID),
  15. @"from_user_id": mts_key(fromUserID),
  16. @"code": mts_key(code),
  17. @"type": mts_key(type),
  18. @"description": mts_key(desc),
  19. @"time_description": mts_key(timeDesc),
  20. @"amount": mts_key(amount),
  21. @"min_use_amount": mts_key(minUseAmount),
  22. @"min_use_amount_type": mts_key(minUseAmountType),
  23. @"expiry_date": mts_key(expiryDate),
  24. @"start_date": mts_key(startDate),
  25. @"status": mts_key(status),
  26. @"create_time": mts_key(createTime),
  27. @"supplier_id": mts_key(supplierId),
  28. };
  29. }
  30. + (BOOL)mts_shouldSetUndefinedKeys
  31. {
  32. return NO;
  33. }
  34. - (BOOL)isValidForUnitItem:(FKSubmitUnitItem *)unitItem{
  35. if ([FLStringHelper isValidString:self.supplierId]) {
  36. if (![unitItem.supplierID isEqualToString:self.supplierId]) return NO;
  37. }
  38. if ([FLStringHelper isValidString:self.minUseAmount]) {
  39. CGFloat minUse = [FLStringHelper convertFenStringToYuanValue:self.minUseAmount];
  40. if ([self.minUseAmountType isEqualToString:@"1"]) {
  41. if ([unitItem getProductTotalCount] < minUse) return NO;
  42. } else if ([self.minUseAmountType isEqualToString:@"2"]) {
  43. if ([unitItem getTotalInternationalPostage] < minUse) return NO;
  44. }
  45. }
  46. return YES;
  47. }
  48. @end