// // FKExploreTopicListItem.m // FirstLink // // Created by ascii on 16/2/16. // Copyright © 2016年 FirstLink. All rights reserved. // #import "FKExploreTopicListItem.h" @implementation FKExploreTopicListSubItem + (NSDictionary*)mts_mapping { return @{@"id": mts_key(itemID), @"user_id": mts_key(userID), @"tag_pic": mts_key(categoryURL), @"name": mts_key(name), @"index_pic": mts_key(indexPic), @"title": mts_key(title), @"first_pic": mts_key(firstPic), @"price": mts_key(price), @"refer_price": mts_key(referPrice), @"is_new": mts_key(isNew), }; } + (BOOL)mts_shouldSetUndefinedKeys { return NO; } @end @implementation FKExploreTopicListItem - (NSString *)subItemImageURLStringAtIndex:(NSInteger)index { if (index < self.subItemArray.count) { if ([self.objectType isEqualToString:@"10"]) { return ((FKExploreTopicListSubItem *)(self.subItemArray[index])).indexPic; } else { return ((FKExploreTopicListSubItem *)(self.subItemArray[index])).firstPic; } } return nil; } - (NSString *)subItemTitleAtIndex:(NSInteger)index { if (index < self.subItemArray.count) { if ([self.objectType isEqualToString:@"10"]) { return ((FKExploreTopicListSubItem *)(self.subItemArray[index])).name; } else { return ((FKExploreTopicListSubItem *)(self.subItemArray[index])).title; } } return nil; } - (NSAttributedString *)priceAttributedStringAtIndex:(NSInteger)index { if (index < self.subItemArray.count) { FKExploreTopicListSubItem *item = self.subItemArray[index]; NSString *price = item.price ? [NSString stringWithFormat:@"¥%d ", [[FLStringHelper convertFenToYuan:item.price] intValue]] : nil; NSString *originalPrice = item.referPrice ? [NSString stringWithFormat:@"¥%d", [[FLStringHelper convertFenToYuan:item.referPrice] intValue]] : nil; NSAttributedString *attributeString = [FLStringHelper attStringWithText:price color:UIColorFromRGB(0xff624a) font:[UIFont systemFontOfSize:14] subText:originalPrice subColor:UIColorFromRGB(0x999999) subFont:[UIFont systemFontOfSize:10]]; return attributeString; } return nil; } + (NSDictionary*)mts_mapping { return @{@"object_type": mts_key(objectType), @"id": mts_key(topicID), @"pic_url": mts_key(photoURL), @"target_url": mts_key(targetURL), }; } + (BOOL)mts_shouldSetUndefinedKeys { return NO; } @end