12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- //
- // FKProductInfoItem.m
- // FirstLink
- //
- // Created by jack on 16/1/20.
- // Copyright © 2016年 FirstLink. All rights reserved.
- //
- #import "FKProductInfoItem.h"
- @implementation FKProductInfoItem
- + (NSDictionary *)mts_mapping{
- return @{
- @"id": mts_key(productId),
- @"name": mts_key(name),
- @"title": mts_key(title),
- @"description": mts_key(desc),
- @"description_original": mts_key(descOrginal),
- @"description_cn": mts_key(descChinese),
- @"first_pic": mts_key(firstPicUrl),
- @"brand": mts_key(brand),
- @"brand_id": mts_key(brandId),
- @"price": mts_key(price),
- @"original_price": mts_key(originalPrice),
- @"refer_price": mts_key(referPrice),
- @"url": mts_key(linkUrl),
- @"sales_count": mts_key(soldCount),
- @"status": mts_key(status),
- @"salable": mts_key(salable),
- @"operate_status": mts_key(operateStatus),
- @"weight": mts_key(weight),
- @"official_score": mts_key(officialScore),
- @"official_review_count": mts_key(officialReviewCount),
- @"official_rank": mts_key(officialRank),
- @"bc_channel": mts_key(isBCChannel),
- @"pay_tax": mts_key(isPayTax),
- @"tax_rate": mts_key(taxRate),
- @"international_postage": mts_key(internationalPostage),
- };
- }
- + (BOOL)mts_shouldSetUndefinedKeys{
- return NO;
- }
- - (NSString *)getValidReferPrice{
- if ([self.referPrice isKindOfClass:[NSString class]] && self.referPrice.length > 0 && self.referPrice.floatValue > 0) {
- return self.referPrice;
- }
- return nil;
- }
- - (BOOL)productOnLine{
- if ([self.status isKindOfClass:[NSString class]]) {
- if (self.status.integerValue == 1) return YES;
- }
- return NO;
- }
- - (BOOL)isProductValid {
- if (self.operateStatus && [self.operateStatus isKindOfClass:[NSString class]]) {
- if (self.operateStatus.integerValue != 1) {
- return NO;
- }
- }
- return YES;
- }
- - (BOOL)isHasAmazonScore {
- if (self.officialScore && self.officialReviewCount) {
- return YES;
- }
- return NO;
- }
- - (NSString *)offLineStr{
- if (![self isProductValid]) {
- return @"已失效";
- }
- if ([self.status isKindOfClass:[NSString class]] && self.status.integerValue != 1) {
- if (self.status.integerValue == 3) return @"已失效"; // 运营下线
- return @"已抢光";
- }
- return nil;
- }
- @end
|