暂无描述

FKVipDiscountItem.m 801B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // FKVipDiscountItem.m
  3. // FirstLink
  4. //
  5. // Created by ascii on 2017/5/18.
  6. // Copyright © 2017年 FirstLink. All rights reserved.
  7. //
  8. #import "FKVipDiscountItem.h"
  9. #import "FKUserManager.h"
  10. @implementation FKVipDiscountItem
  11. - (instancetype)init {
  12. self = [super init];
  13. if (self) {
  14. _isUseVipDiscount = YES;
  15. }
  16. return self;
  17. }
  18. + (NSDictionary *)mts_mapping {
  19. return @{@"discount" : mts_key(discount),
  20. @"quantity" : mts_key(quantity),
  21. };
  22. }
  23. + (BOOL)mts_shouldSetUndefinedKeys {
  24. return NO;
  25. }
  26. - (BOOL)isVipUserWithDiscount {
  27. User *user = [FKUserManager sharedManager].user;
  28. NSInteger quantity = [self.quantity integerValue];
  29. if (quantity > 0 && [user isVipWithDiscount]) {
  30. return YES;
  31. }
  32. return NO;
  33. }
  34. @end