Commit b344e457 by houweibin

Merge branch 'master' of https://git.oschina.net/kollway-kollway/newcemarose

# Conflicts:
#	iCemarose/Class/UI/NewProduct/KWMNewProductVC.m
#	iCemarose/Class/UI/Product/KWMSearchFeedbackVC.m
parents bfff262a b69a3d9a
...@@ -712,8 +712,8 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651"; ...@@ -712,8 +712,8 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
- (NSURLSessionDataTask *)getHomeDataWithSuccess:(void (^)(NSURLSessionDataTask *, KWMHomeDataResult *))success failure:(void (^)(NSURLSessionDataTask *, NSError *))failure { - (NSURLSessionDataTask *)getHomeDataWithSuccess:(void (^)(NSURLSessionDataTask *, KWMHomeDataResult *))success failure:(void (^)(NSURLSessionDataTask *, NSError *))failure {
NSInteger st = [[NSDate date] timeIntervalSince1970]; NSInteger st = [[NSDate date] timeIntervalSince1970];
st = st - st % 86400 - 28800; // st = st - st % 86400 - 28800;
NSString *apiPath = [NSString stringWithFormat:@"https://ogbgohpla.qnssl.com/App.Home.json?%ld",st]; NSString *apiPath = [NSString stringWithFormat:@"https://ogbgohpla.qnssl.com/App.Home.json?st=%ld",st];
return [self startSessionTask:KWMHTTPMethodGET apiPath:apiPath parameters:nil result:[KWMHomeDataResult class] model:nil success:success failure:failure]; return [self startSessionTask:KWMHTTPMethodGET apiPath:apiPath parameters:nil result:[KWMHomeDataResult class] model:nil success:success failure:failure];
} }
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
@property (nonatomic, strong) KWMCustomsClearance *customsClearance; @property (nonatomic, strong) KWMCustomsClearance *customsClearance;
@property (nonatomic, strong) BUYClient *client;
@property (nonatomic, strong) BUYCustomer *customer; @property (nonatomic, strong) BUYCustomer *customer;
@property (nonatomic, strong) NSArray *tags; @property (nonatomic, strong) NSArray *tags;
...@@ -39,6 +41,8 @@ ...@@ -39,6 +41,8 @@
- (NSDecimalNumber *)exchangeRate; - (NSDecimalNumber *)exchangeRate;
- (void) requestTags; - (void) requestTags;
- (void) login;
- (void (^)(NSURLSessionDataTask *, KWMRequestResult *))getLoginSuccessCallback:(void (^)(NSURLSessionDataTask *, KWMRequestResult *))callback; - (void (^)(NSURLSessionDataTask *, KWMRequestResult *))getLoginSuccessCallback:(void (^)(NSURLSessionDataTask *, KWMRequestResult *))callback;
- (void)saveImageUrl:(NSString *)imageUrl key:(NSString *)key; - (void)saveImageUrl:(NSString *)imageUrl key:(NSString *)key;
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#import "PSPDFAlertView.h" #import "PSPDFAlertView.h"
#import "KWMStringUtil.h" #import "KWMStringUtil.h"
//#import <Mobile-Buy-SDK/Buy/BUYClient.h> //#import <Mobile-Buy-SDK/Buy/BUYClient.h>
#import "KWMUserModel.h"
#import <SAMKeychain/SAMKeychain.h>
#define SESSID @"PHPSESSID" #define SESSID @"PHPSESSID"
static NSString *kwmKeySessionId = @"sessionId"; static NSString *kwmKeySessionId = @"sessionId";
...@@ -27,7 +29,6 @@ static NSString *kwmKeySavedAccountPassword = @"savedAccountPassword"; ...@@ -27,7 +29,6 @@ static NSString *kwmKeySavedAccountPassword = @"savedAccountPassword";
@interface KWMUserDao () @interface KWMUserDao ()
@property (nonatomic, strong) BUYClient *client;
@end @end
...@@ -125,6 +126,53 @@ static NSString *kwmKeySavedAccountPassword = @"savedAccountPassword"; ...@@ -125,6 +126,53 @@ static NSString *kwmKeySavedAccountPassword = @"savedAccountPassword";
} }
} }
- (void)login {
KWMUserModel *user= [KWMUserModel shareUser];
NSString *account = user.email;
NSString *password = user.password;
if (!password) {
password = [SAMKeychain passwordForService:@"cemarose.account" account:account];
}
if (!(account && password)) {
return;
}
NSArray *items = @[
[BUYAccountCredentialItem itemWithEmail:account],
[BUYAccountCredentialItem itemWithPassword:password],
];
BUYAccountCredentials *credentials = [BUYAccountCredentials credentialsWithItems:items];
// [weakSelf requestLoginAPI:credentials];
[self.client loginCustomerWithCredentials:credentials callback:^(BUYCustomer * _Nullable customer, BUYCustomerToken * _Nullable token, NSError * _Nullable error) {
if (customer && token && !error) {
[KWMUserModel saveAccountByCredentials:credentials];
_customer = customer;
// _token = token;
// _userModel.customerJSON = customer.JSONDictionary;
// _userModel.tokenJSON = token.JSONDictionary;
//异步保存数据
dispatch_async(dispatch_get_global_queue(0, 0), ^{
// [self saveData];
// [_userModel login];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:_customer.JSONDictionary forKey:@"customer"];
[defaults setObject:token.JSONDictionary forKey:@"token"];
[defaults synchronize];
[[KWMAPIManager sharedManager] loginWebSuccess:nil failure:nil];
});
}else{
NSLog(@"requestLoginAPI error: %@",error);
[user logout];
[self logout];
}
}];
}
- (KWMUser *)loginUser { - (KWMUser *)loginUser {
NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults]; NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
NSString *userJSON = [defaults objectForKey:kwmKeyUser]; NSString *userJSON = [defaults objectForKey:kwmKeyUser];
......
...@@ -16,6 +16,8 @@ typedef void(^ShoppingCartCallBack) (NSError *error,KWMCartResult *cart); ...@@ -16,6 +16,8 @@ typedef void(^ShoppingCartCallBack) (NSError *error,KWMCartResult *cart);
@property (nonatomic, strong) NSMutableArray<KWMShopCartModel *> * items; @property (nonatomic, strong) NSMutableArray<KWMShopCartModel *> * items;
@property (nonatomic, assign) BOOL sync;
@property (nonatomic, strong) NSNumber *count; @property (nonatomic, strong) NSNumber *count;
+ (instancetype)sharedInstance; + (instancetype)sharedInstance;
......
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
[this missionCompleted]; [this missionCompleted];
// if (version == this.version) { // if (version == this.version) {
[[KWMShoppingCart sharedInstance] allItemsWithCallback:^(NSError *error, KWMCartResult *cart) { [[KWMShoppingCart sharedInstance] allItemsWithCallback:^(NSError *error, KWMCartResult *cart) {
// callback(error,cart); if(this.sync)callback(error,cart);
}]; }];
// } // }
} failure:^(NSURLSessionDataTask *task, NSError *error) { } failure:^(NSURLSessionDataTask *task, NSError *error) {
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
// callback(error,nil); // callback(error,nil);
}]; }];
[self addTasksObject:task]; [self addTasksObject:task];
callback(nil,[self changeLocalCartWithVariantId:variantId quantity:quantity flag:1]); if(!this.sync)callback(nil,[self changeLocalCartWithVariantId:variantId quantity:quantity flag:1]);
} }
- (void)changeProductWithVariantId:(NSNumber *)variantId quantity:(NSInteger)quantity callback:(ShoppingCartCallBack)callback { - (void)changeProductWithVariantId:(NSNumber *)variantId quantity:(NSInteger)quantity callback:(ShoppingCartCallBack)callback {
...@@ -118,14 +118,14 @@ ...@@ -118,14 +118,14 @@
[this missionCompleted]; [this missionCompleted];
// if (version == this.version) { // if (version == this.version) {
[[KWMShoppingCart sharedInstance] setResult:result]; [[KWMShoppingCart sharedInstance] setResult:result];
// callback(nil,result); if(this.sync)callback(nil,result);
// } // }
} failure:^(NSURLSessionDataTask *task, NSError *error) { } failure:^(NSURLSessionDataTask *task, NSError *error) {
[this missionCompleted]; [this missionCompleted];
// callback(error,nil); // callback(error,nil);
}]; }];
[self addTasksObject:task]; [self addTasksObject:task];
callback(nil,[self changeLocalCartWithVariantId:variantId quantity:quantity flag:quantity ? 2 : 0]); if(!this.sync)callback(nil,[self changeLocalCartWithVariantId:variantId quantity:quantity flag:quantity ? 2 : 0]);
} }
-(void)updateProductWithVariantIds:(NSArray<NSNumber *> *)variantIds quantitties:(NSArray<NSNumber *> *)quantites callback:(ShoppingCartCallBack)callback { -(void)updateProductWithVariantIds:(NSArray<NSNumber *> *)variantIds quantitties:(NSArray<NSNumber *> *)quantites callback:(ShoppingCartCallBack)callback {
...@@ -136,17 +136,19 @@ ...@@ -136,17 +136,19 @@
[this missionCompleted]; [this missionCompleted];
// if (version == this.version) { // if (version == this.version) {
[[KWMShoppingCart sharedInstance] setResult:result]; [[KWMShoppingCart sharedInstance] setResult:result];
// callback(nil,result); if(this.sync)callback(nil,result);
// } // }
} failure:^(NSURLSessionDataTask *task, NSError *error) { } failure:^(NSURLSessionDataTask *task, NSError *error) {
[this missionCompleted]; [this missionCompleted];
// callback(error,nil); // callback(error,nil);
}]; }];
[self addTasksObject:task]; [self addTasksObject:task];
for (int i=0; i<quantites.count && self.items.count; i++) { if(!this.sync) {
[self changeLocalCartWithVariantId:variantIds[i] quantity:quantites[i].integerValue flag:quantites[i].integerValue ? 2 : 0]; for (int i=0; i<quantites.count && self.items.count; i++) {
[self changeLocalCartWithVariantId:variantIds[i] quantity:quantites[i].integerValue flag:quantites[i].integerValue ? 2 : 0];
}
callback(nil,self.result);
} }
callback(nil,self.result);
} }
- (void)deleteProductWithVariantId:(NSNumber *)variantId callback:(ShoppingCartCallBack)callback { - (void)deleteProductWithVariantId:(NSNumber *)variantId callback:(ShoppingCartCallBack)callback {
......
...@@ -18,6 +18,6 @@ ...@@ -18,6 +18,6 @@
+ (instancetype)shareUser; + (instancetype)shareUser;
+ (void) saveAccountByCredentials:(BUYAccountCredentials *) credentials; + (void) saveAccountByCredentials:(BUYAccountCredentials *) credentials;
- (void)login; - (void) login;
- (void)logout; - (void) logout;
@end @end
...@@ -33,6 +33,7 @@ static KWMUserModel *_shareUser; ...@@ -33,6 +33,7 @@ static KWMUserModel *_shareUser;
if ([dict objectForKey:@"email"] != nil) { if ([dict objectForKey:@"email"] != nil) {
_shareUser.email = [dict objectForKey:@"email"]; _shareUser.email = [dict objectForKey:@"email"];
} }
_shareUser.customerJSON = dict;
} }
}); });
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#import "KWMSplashView.h" #import "KWMSplashView.h"
#import "KWMUserModel.h" #import "KWMUserModel.h"
#import "KWMLoginVC.h" #import "KWMLoginVC.h"
#import "KWMShoppingCart.h"
@interface KWMMainVC () @interface KWMMainVC ()
...@@ -51,8 +52,13 @@ ...@@ -51,8 +52,13 @@
[defaults setBool:NO forKey:KEY_USER_REGISTER]; [defaults setBool:NO forKey:KEY_USER_REGISTER];
[defaults synchronize]; [defaults synchronize];
} }
[[KWMAPIManager sharedManager] loginWebSuccess:nil failure:nil]; // [[KWMAPIManager sharedManager] loginWebSuccess:nil failure:nil];
[[KWMUserDao shareDao] login];
[[KWMUserDao shareDao] requestTags]; [[KWMUserDao shareDao] requestTags];
[[KWMShoppingCart sharedInstance] allItemsWithCallback:^(NSError *error, KWMCartResult *cart) {
}];
} }
- (void)initSplash{ - (void)initSplash{
......
...@@ -84,6 +84,7 @@ ...@@ -84,6 +84,7 @@
-(void)setHeaderImage:(NSString *)headerImage{ -(void)setHeaderImage:(NSString *)headerImage{
_headerImage = headerImage; _headerImage = headerImage;
NSURL *imageURL = [NSURL URLWithString:headerImage]; NSURL *imageURL = [NSURL URLWithString:headerImage];
// self.ivHeader.contentMode = UIViewContentModeScaleToFill;
[self.ivHeader sd_setImageWithURL:imageURL placeholderImage:[UIImage imageNamed:@"ic_loading"]]; [self.ivHeader sd_setImageWithURL:imageURL placeholderImage:[UIImage imageNamed:@"ic_loading"]];
} }
......
...@@ -87,7 +87,7 @@ typedef enum{ ...@@ -87,7 +87,7 @@ typedef enum{
self.titleView.count = count; self.titleView.count = count;
[self.titleView resumeView]; [self.titleView resumeView];
} }
[self.cvHome reloadData];
} }
-(void)viewDidDisappear:(BOOL)animated{ -(void)viewDidDisappear:(BOOL)animated{
......
...@@ -215,7 +215,11 @@ static NSString *idStr = @"KWMBrandCaramelCell"; ...@@ -215,7 +215,11 @@ static NSString *idStr = @"KWMBrandCaramelCell";
if(tagetPage == 1){ if(tagetPage == 1){
[weakSelf.dataList removeAllObjects]; [weakSelf.dataList removeAllObjects];
} }
[weakSelf appendDataList:result.productList setPage:tagetPage];
NSArray *products = [result.productList rx_filterWithBlock:^BOOL(BUYProduct *each) {
return each.availableValue;
}];
[weakSelf appendDataList:products setPage:tagetPage];
_vSearchFB.lbGoodsNum.text = [NSString stringWithFormat:@"%lu商品",(unsigned long)total]; _vSearchFB.lbGoodsNum.text = [NSString stringWithFormat:@"%lu商品",(unsigned long)total];
[self.tbvSearch reloadData]; [self.tbvSearch reloadData];
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
@interface KWMBeforePayVC () @interface KWMBeforePayVC ()
@property (nonatomic) BUYCustomer *customer; @property (nonatomic) BUYCustomer *customer;
@property (weak, nonatomic) IBOutlet UIButton *submit;
@end @end
...@@ -56,6 +57,7 @@ ...@@ -56,6 +57,7 @@
NSNotificationCenter *notifi = [NSNotificationCenter defaultCenter]; NSNotificationCenter *notifi = [NSNotificationCenter defaultCenter];
[notifi addObserver:self selector:@selector(paySuccess) name:KWMPaySuccess object:nil]; [notifi addObserver:self selector:@selector(paySuccess) name:KWMPaySuccess object:nil];
[notifi addObserver:self selector:@selector(requestOrderPayResult) name:UIApplicationDidBecomeActiveNotification object:nil]; [notifi addObserver:self selector:@selector(requestOrderPayResult) name:UIApplicationDidBecomeActiveNotification object:nil];
} }
-(void)dealloc{ -(void)dealloc{
......
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
#import "KWMStringUtil.h" #import "KWMStringUtil.h"
#import "KWMShoppingCart.h" #import "KWMShoppingCart.h"
@interface KWMShopCartVC () @interface KWMShopCartVC ()<UIAlertViewDelegate>
@property (nonatomic) NSMutableArray *shopCartList; @property (nonatomic) NSMutableArray *shopCartList;
@property (nonatomic, strong) NSMutableArray *soldout;
@end @end
@implementation KWMShopCartVC{ @implementation KWMShopCartVC{
...@@ -50,17 +51,93 @@ ...@@ -50,17 +51,93 @@
self.btnRandom.layer.borderColor = [UIColor colorWithRed:78.0/255 green:78.0/255 blue:78.0/255 alpha:1.0].CGColor; self.btnRandom.layer.borderColor = [UIColor colorWithRed:78.0/255 green:78.0/255 blue:78.0/255 alpha:1.0].CGColor;
[self setTotalPrice]; [self setTotalPrice];
__weak typeof(self) this = self;
[self checkInStockAndRefresh];
}
- (void) checkInStockAndRefresh {
__weak typeof(self) this = self;
[self showLoading];
[[KWMShoppingCart sharedInstance] allItemsWithCallback:^(NSError *error, KWMCartResult *cart) {
[this refresh];
NSArray *ids = [cart.items rx_mapWithBlock:^id(KWMShopCartModel *each) {
return each.product_id;
}];
[this.client getProductsByIds:ids completion:^(NSArray<BUYProduct *> * _Nullable products, NSError * _Nullable error) {
[this hideLoading];
// [this refresh];
[this checkInStockWithItems:cart.items products:products];
}];
}];
}
- (void) checkInStockWithItems:(NSArray<KWMShopCartModel *> *) items products:(NSArray<BUYProduct *> *) products {
self.soldout = [NSMutableArray new];
for (id item in items) {
if(![self checkInStockWithItem:item products:products]) {
[self.soldout addObject:item];
}
}
if (self.soldout.count > 0) {
[[[UIAlertView alloc] initWithTitle:nil message:@"订单中有售罄商品哦!!!" delegate:self cancelButtonTitle:@"直接删除" otherButtonTitles:@"加入愿望清单", nil] show];
}
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
[[KWMShoppingCart sharedInstance] setSync:YES];
NSArray *ids = [self.soldout rx_mapWithBlock:^id(KWMShopCartModel *each) {
return each.identifier;
}];
NSArray *qus = [ids rx_mapWithBlock:^(id it){ return @(0); }];
__weak typeof(self) this = self;
[[KWMShoppingCart sharedInstance] updateProductWithVariantIds:ids quantitties:qus callback:^(NSError *error, KWMCartResult *cart) {
[[KWMShoppingCart sharedInstance] setSync:NO];
[this refresh];
if (buttonIndex == 1) {
[this addSoldOutProductToWishlist];
}
}];
}
- (void) addSoldOutProductToWishlist {
dispatch_time_t delay = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)); dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
dispatch_after(delay, dispatch_get_main_queue(), ^{ // KWMUserModel *customer = [KWMUserModel shareUser];
[[KWMShoppingCart sharedInstance] allItemsWithCallback:^(NSError *error, KWMCartResult *cart) { [self.soldout enumerateObjectsUsingBlock:^(KWMShopCartModel *obj, NSUInteger idx, BOOL * _Nonnull stop) {
[this refresh]; NSDictionary * dict = [[NSUserDefaults standardUserDefaults] objectForKey:@"customer"];
NSDictionary *parament = @{
@"customer_id":dict[@"id"],
@"customer_email":dict[@"email"],
@"customer_name":dict[@"last_name"] ?: @"",
@"product_title":obj.shopCartDict[@"product_title"],
@"product_id":obj.product_id,
@"variant_id":obj.identifier,
@"variant_sku":obj.shopCartDict[@"sku"],
@"variant_title":obj.size,
@"product_handle":obj.shopCartDict[@"handle"],
@"shop":Shopify_SHOP_DOMAIN
};
// [self.api saveWish:parament success:nil failure:nil];
[self.api saveWish:parament success:^(NSURLSessionDataTask *task, KWMAdditionalListResult *result) { } failure:^(NSURLSessionDataTask *task, NSError *error) { }];
}]; }];
self.soldout = nil;
}); });
} }
- (BOOL) checkInStockWithItem:(KWMShopCartModel *) item products:(NSArray<BUYProduct *> *) products {
for (BUYProduct *p in products) {
if (item.product_id.integerValue == p.identifier.integerValue) {
for (BUYProductVariant *v in p.variants) {
if ([item.size isEqualToString:v.title] && v.availableValue) {
return YES;
}
}
}
}
return NO;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
...@@ -251,6 +328,11 @@ ...@@ -251,6 +328,11 @@
self.shopCartList = [[KWMShoppingCart sharedInstance] items]; self.shopCartList = [[KWMShoppingCart sharedInstance] items];
[self.tbvCart reloadData]; [self.tbvCart reloadData];
[self setTotalPrice]; [self setTotalPrice];
// [self.client getProductsByIds:[self.shopCartList rx_mapWithBlock:^id(KWMShopCartModel *each) {
// return each.product_id;
// }] completion:^(NSArray<BUYProduct *> * _Nullable products, NSError * _Nullable error) {
//
// }];
} }
//计算总价格 //计算总价格
......
...@@ -1040,6 +1040,7 @@ ...@@ -1040,6 +1040,7 @@
<outlet property="lbPhone" destination="XAZ-es-XbK" id="3xN-ic-WmI"/> <outlet property="lbPhone" destination="XAZ-es-XbK" id="3xN-ic-WmI"/>
<outlet property="lbShippingRate" destination="pVN-aG-lfu" id="YuB-rr-DOP"/> <outlet property="lbShippingRate" destination="pVN-aG-lfu" id="YuB-rr-DOP"/>
<outlet property="lbTotalPrice" destination="fdr-W0-QCc" id="Cfi-P2-B3O"/> <outlet property="lbTotalPrice" destination="fdr-W0-QCc" id="Cfi-P2-B3O"/>
<outlet property="submit" destination="vT5-Az-K57" id="fwS-UU-AZ4"/>
<outlet property="vAddressHeight" destination="zO1-RN-x44" id="VIC-wQ-AuJ"/> <outlet property="vAddressHeight" destination="zO1-RN-x44" id="VIC-wQ-AuJ"/>
<outlet property="vHasAddress" destination="gba-z6-T82" id="syf-hx-7rS"/> <outlet property="vHasAddress" destination="gba-z6-T82" id="syf-hx-7rS"/>
<outlet property="vPayType" destination="Yux-Ro-p2d" id="qih-Ka-xDX"/> <outlet property="vPayType" destination="Yux-Ro-p2d" id="qih-Ka-xDX"/>
......
...@@ -26,45 +26,108 @@ ...@@ -26,45 +26,108 @@
+(NSString *)transformTag:(KWMFilter *)filter tag:(NSString *)tag{ +(NSString *)transformTag:(KWMFilter *)filter tag:(NSString *)tag{
NSString *mTag = [tag copy]; NSDictionary *mapping = @{
@"Autumn/Winter 2017":@"autumn-winter-2017",
//"Spring/Summer 2017" => Spring-Summer-2017 @"Spring/Summer 2017":@"spring-summer-2017",
if([filter.group isEqualToString:@"SEASON"]){ @"Autumn/Winter 2016":@"autumn-winter-2016",
mTag = [mTag stringByReplacingOccurrencesOfString:@"/" withString:@"-"]; @"Spring/Summer 2016":@"spring-summer-2016",
return [tag stringByReplacingOccurrencesOfString:@" " withString:@"-"]; @"Autumn/Winter 2015":@"autumn-winter-2015",
} @"Girls":@"girls",
@"Boys":@"boys",
//1 month=> size-01m @"0 month":@"size-0m",
else if([filter.group isEqualToString:@"SIZE"]){ @"3 month":@"size-3m",
//不合规则的区别待遇 @"6 month":@"size-06m",
if([tag isEqualToString:@"0 month"]){ @"9 month":@"size-9m",
return @"size-0m"; @"12 month":@"size-12m",
}else if([tag isEqualToString:@"3 month"]){ @"18 month":@"size-18m",
return @"size-3m"; @"2 year":@"size-02a",
}else if([tag isEqualToString:@"3 month"]){ @"3 year":@"size-03a",
return @"size-9m"; @"4 year":@"size-04a",
} @"5 year":@"size-05a",
@"6 year":@"size-06a",
NSString *numberString = [self getNumberString:tag]; @"7 year":@"size-07a",
numberString = numberString.length == 1 ? [NSString stringWithFormat:@"0%@",numberString]:numberString; @"8 year":@"size-08a",
if([tag rangeOfString:@"year"].location == NSNotFound){ @"10 year":@"size-10a",
return [NSString stringWithFormat:@"size-%@m",numberString]; @"12 year":@"size-12a",
}else{ @"14 year":@"size-14a",
return [NSString stringWithFormat:@"size-%@a",numberString]; @"16 year":@"size-16a",
} @"18":@"shoe-size-18",
} @"19":@"shoe-size-19",
@"20":@"shoe-size-20",
//12 => shoe-size-1 @"21":@"shoe-size-21",
else if([filter.group isEqualToString:@"Shoe Size"]){ @"22":@"shoe-size-22",
return [NSString stringWithFormat:@"shoe-size-%@",tag]; @"23":@"shoe-size-23",
} @"24":@"shoe-size-24",
@"25":@"shoe-size-25",
//Trousers & Shorts => trousers-shorts @"26":@"shoe-size-26",
else if([filter.group isEqualToString:@"PRODUCT TYPE"]){ @"27":@"shoe-size-27",
return [KWMStringUtil deleteOtherCharExceptLetterWithLine:tag]; @"28":@"shoe-size-28",
} @"29":@"shoe-size-29",
@"30":@"shoe-size-30",
return mTag; @"31":@"shoe-size-31",
@"32":@"shoe-size-32",
@"33":@"shoe-size-33",
@"34":@"shoe-size-34",
@"35":@"shoe-size-35",
@"37":@"shoe-size-37",
@"38":@"shoe-size-38",
@"39":@"shoe-size-39",
@"Accessories":@"accessories",
@"Babysuits":@"babysuits",
@"Coats & Jackets":@"coats-jackets",
@"Dresses":@"dresses",
@"Leggings":@"leggings",
@"Raincoat":@"raincoat",
@"Sets":@"sets",
@"Shoes":@"shoes",
@"Skirts":@"skirts",
@"Swimwear":@"swimwear",
@"Tights":@"tights",
@"Tops":@"tops",
@"Toys":@"toys",
@"Trousers & Shorts":@"trousers-shorts",
@"Underwear":@"underwear",
};
return mapping[tag];
// NSString *mTag = [tag copy];
//
// //"Spring/Summer 2017" => Spring-Summer-2017
// if([filter.group isEqualToString:@"SEASON"]){
// mTag = [mTag stringByReplacingOccurrencesOfString:@"/" withString:@"-"];
// return [tag stringByReplacingOccurrencesOfString:@" " withString:@"-"];
// }
//
// //1 month=> size-01m
// else if([filter.group isEqualToString:@"SIZE"]){
// //不合规则的区别待遇
// if([tag isEqualToString:@"0 month"]){
// return @"size-0m";
// }else if([tag isEqualToString:@"3 month"]){
// return @"size-3m";
// }else if([tag isEqualToString:@"3 month"]){
// return @"size-9m";
// }
//
// NSString *numberString = [self getNumberString:tag];
// numberString = numberString.length == 1 ? [NSString stringWithFormat:@"0%@",numberString]:numberString;
// if([tag rangeOfString:@"year"].location == NSNotFound){
// return [NSString stringWithFormat:@"size-%@m",numberString];
// }else{
// return [NSString stringWithFormat:@"size-%@a",numberString];
// }
// }
//
// //12 => shoe-size-1
// else if([filter.group isEqualToString:@"Shoe Size"]){
// return [NSString stringWithFormat:@"shoe-size-%@",tag];
// }
//
// //Trousers & Shorts => trousers-shorts
// else if([filter.group isEqualToString:@"PRODUCT TYPE"]){
// return [KWMStringUtil deleteOtherCharExceptLetterWithLine:tag];
// }
//
// return mTag;
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#import "UIColor+SAMAdditions.h" #import "UIColor+SAMAdditions.h"
#import "KWMStringUtil.h" #import "KWMStringUtil.h"
static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Spring/Summer 2017\",\"Autumn/Winter 2016\",\"Spring/Summer 2016\",\"Autumn/Winter 2015\"]},{\"group\":\"GENDER\",\"tags\":[\"Girls\",\"Boys\"]},{\"group\":\"SIZE\",\"tags\":[\"0 month\",\"3 month\",\"6 month\",\"9 month\",\"12 month\",\"18 month\",\"2 year\",\"3 year\",\"4 year\",\"5 year\",\"6 year\",\"7 year\",\"8 year\",\"10 year\",\"12 year\",\"14 year\",\"16 year\"]},{\"group\":\"Shoe Size\",\"tags\":[\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\",\"25\",\"26\",\"27\",\"28\",\"29\",\"30\",\"31\",\"32\",\"33\",\"34\",\"35\",\"37\",\"38\",\"39\"]},{\"group\":\"PRODUCT TYPE\",\"tags\":[\"Accessories\",\"Babysuits\",\"Coats & Jackets\",\"Dresses\",\"Leggings\",\"Raincoat\",\"Sets\",\"Shoes\",\"Skirts\",\"Swimwear\",\"Tights\",\"Tops\",\"Toys\",\"Trousers & Shorts\",\"Underwear\"]}]"; static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Autumn/Winter 2017\",\"Spring/Summer 2017\",\"Autumn/Winter 2016\",\"Spring/Summer 2016\",\"Autumn/Winter 2015\"]},{\"group\":\"GENDER\",\"tags\":[\"Girls\",\"Boys\"]},{\"group\":\"SIZE\",\"tags\":[\"0 month\",\"3 month\",\"6 month\",\"9 month\",\"12 month\",\"18 month\",\"2 year\",\"3 year\",\"4 year\",\"5 year\",\"6 year\",\"7 year\",\"8 year\",\"10 year\",\"12 year\",\"14 year\",\"16 year\"]},{\"group\":\"Shoe Size\",\"tags\":[\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\",\"25\",\"26\",\"27\",\"28\",\"29\",\"30\",\"31\",\"32\",\"33\",\"34\",\"35\",\"37\",\"38\",\"39\"]},{\"group\":\"PRODUCT TYPE\",\"tags\":[\"Accessories\",\"Babysuits\",\"Coats & Jackets\",\"Dresses\",\"Leggings\",\"Raincoat\",\"Sets\",\"Shoes\",\"Skirts\",\"Swimwear\",\"Tights\",\"Tops\",\"Toys\",\"Trousers & Shorts\",\"Underwear\"]}]";
@interface KWMFilterView() @interface KWMFilterView()
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.5.1</string> <string>1.5.2</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2017072116</string> <string>2017072414</string>
<key>ITSAppUsesNonExemptEncryption</key> <key>ITSAppUsesNonExemptEncryption</key>
<false/> <false/>
<key>LSApplicationQueriesSchemes</key> <key>LSApplicationQueriesSchemes</key>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment