Commit 631bbb4f by lee

u service filter souldout product

parent 69ae7ccc
......@@ -8,7 +8,7 @@ target 'iCemarose' do
# CordovaLib Dependency Pod
#pod 'Cordova'
pod 'JRSwizzle'
pod 'Aspects'
pod 'RegexKitLite'
pod 'SAMKeychain'
pod 'RXCollections','~> 1.0'
......
......@@ -349,6 +349,8 @@
DA4E36921F1613C70007E4D0 /* KWMHomeDataResult.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4E36911F1613C70007E4D0 /* KWMHomeDataResult.m */; };
DA4E36951F1726B80007E4D0 /* UIViewController+HTTP.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4E36941F1726B80007E4D0 /* UIViewController+HTTP.m */; };
DA4E36981F17729C0007E4D0 /* KWMCategoryModel.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4E36971F17729C0007E4D0 /* KWMCategoryModel.m */; };
DA4E369E1F188B400007E4D0 /* BUYClient+FilterSoldout.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4E369D1F188B400007E4D0 /* BUYClient+FilterSoldout.m */; };
DA4E36A11F18A6CB0007E4D0 /* KWMPageResult.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4E36A01F18A6CB0007E4D0 /* KWMPageResult.m */; };
DAB6431A1F04CFE5002CD7FE /* AppDelegate+Deeplink.m in Sources */ = {isa = PBXBuildFile; fileRef = DAB643191F04CFE5002CD7FE /* AppDelegate+Deeplink.m */; };
/* End PBXBuildFile section */
......@@ -971,6 +973,10 @@
DA4E36941F1726B80007E4D0 /* UIViewController+HTTP.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+HTTP.m"; sourceTree = "<group>"; };
DA4E36961F17729C0007E4D0 /* KWMCategoryModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMCategoryModel.h; sourceTree = "<group>"; };
DA4E36971F17729C0007E4D0 /* KWMCategoryModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMCategoryModel.m; sourceTree = "<group>"; };
DA4E369C1F188B400007E4D0 /* BUYClient+FilterSoldout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "BUYClient+FilterSoldout.h"; sourceTree = "<group>"; };
DA4E369D1F188B400007E4D0 /* BUYClient+FilterSoldout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "BUYClient+FilterSoldout.m"; sourceTree = "<group>"; };
DA4E369F1F18A6CB0007E4D0 /* KWMPageResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMPageResult.h; sourceTree = "<group>"; };
DA4E36A01F18A6CB0007E4D0 /* KWMPageResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMPageResult.m; sourceTree = "<group>"; };
DAB643181F04CFE5002CD7FE /* AppDelegate+Deeplink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "AppDelegate+Deeplink.h"; sourceTree = "<group>"; };
DAB643191F04CFE5002CD7FE /* AppDelegate+Deeplink.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AppDelegate+Deeplink.m"; sourceTree = "<group>"; };
/* End PBXFileReference section */
......@@ -1067,6 +1073,8 @@
9B8298E51EF237FC00743438 /* NSDecimalNumber+Currency.m */,
DA4E36931F1726B80007E4D0 /* UIViewController+HTTP.h */,
DA4E36941F1726B80007E4D0 /* UIViewController+HTTP.m */,
DA4E369C1F188B400007E4D0 /* BUYClient+FilterSoldout.h */,
DA4E369D1F188B400007E4D0 /* BUYClient+FilterSoldout.m */,
);
path = Classify;
sourceTree = "<group>";
......@@ -1899,6 +1907,8 @@
C03846951DB9C3E7008C3BAB /* Cemarose */ = {
isa = PBXGroup;
children = (
DA4E369F1F18A6CB0007E4D0 /* KWMPageResult.h */,
DA4E36A01F18A6CB0007E4D0 /* KWMPageResult.m */,
807AF4941DC984950000A326 /* KWMArticlesResult.h */,
807AF4951DC984950000A326 /* KWMArticlesResult.m */,
807AF4961DC984950000A326 /* KWMBlogResult.h */,
......@@ -2588,6 +2598,7 @@
C034E85B1D6B10A0006EE129 /* LFRoundProgressView.m in Sources */,
80F82E611D704E34008B470B /* KWMBrandCell.m in Sources */,
C0A6B3C41F01FC5300D85673 /* KWMSecondDetailView.m in Sources */,
DA4E36A11F18A6CB0007E4D0 /* KWMPageResult.m in Sources */,
9B8298E61EF237FC00743438 /* NSDecimalNumber+Currency.m in Sources */,
C034E6F51D6AF197006EE129 /* KWMPickView.m in Sources */,
C08870EB1F03481C00C9C1C8 /* KWMCustomsClearance.m in Sources */,
......@@ -2740,6 +2751,7 @@
C07267821F15D62400C5A869 /* NSLayoutConstraint+Multiplier.m in Sources */,
C02C7D9E1E643323008DC29C /* KWMShareVC.m in Sources */,
C034E68F1D6AEB12006EE129 /* main.m in Sources */,
DA4E369E1F188B400007E4D0 /* BUYClient+FilterSoldout.m in Sources */,
C0AF039E1DD5C8EE0060623F /* KWMNeedAddressView.m in Sources */,
C034E8521D6B10A0006EE129 /* UIImage+ReMake.m in Sources */,
C001BA5C1EB2ED5500B366A8 /* KWMImageBlurUtil.m in Sources */,
......
//
// KWMBlogResult.h
// iCemarose
//
// Created by 陈荣科 on 2016/10/27.
// Copyright © 2016年 kollway. All rights reserved.
//
#import "KWMCemaroseResult.h"
#import "KWMArticlesResult.h"
@interface KWMPageResult : KWMCemaroseResult
@property (nonatomic) NSMutableArray*pages;
@end
//
// KWMBlogResult.m
// iCemarose
//
// Created by 陈荣科 on 2016/10/27.
// Copyright © 2016年 kollway. All rights reserved.
//
#import "KWMPageResult.h"
@implementation KWMPageResult
- (instancetype)initWithDictionary:(NSDictionary *)dict
modelClass:(Class)modelClass
error:(NSError **)err {
self = [super initWithDictionary:dict error:err];
NSMutableArray *pages = [NSMutableArray new];
for (int i = 0; i < _pages.count; ++i) {
KWMArticlesResult *result = [KWMArticlesResult initWithDictionary:_pages[i]];
[pages addObject:result];
}
_pages = pages;
return self;
}
@end
......@@ -15,6 +15,7 @@
#import "KWMBrandsResult.h"
#import "KWMSearchResult.h"
#import "KWMBlogResult.h"
#import "KWMPageResult.h"
#import "KWMNewGoodsModel.h"
#import "KWMNewProducts.h"
#import "KWMProductTypeResult.h"
......@@ -159,7 +160,9 @@
- (NSURLSessionDataTask *) getAllBlog:(NSDictionary *)parameters
success:(void(^)(NSURLSessionDataTask *task,KWMBlogResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure;
- (NSURLSessionDataTask *) getAllPage:(NSDictionary *)parameters
success:(void(^)(NSURLSessionDataTask *task,KWMPageResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure;
/**
* 首页板块数据
*
......
......@@ -555,7 +555,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
*/
- (NSURLSessionDataTask *) getAllBlog:(NSDictionary *)parameters
success:(void(^)(NSURLSessionDataTask *task,KWMBlogResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure;{
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{
NSString *apiPath = [[NSString alloc] initWithFormat:@"https://%@/admin/articles.json",Shopify_SHOP_DOMAIN];
return [self startSessionTask:KWMHTTPMethodGET
apiPath:apiPath
......@@ -566,6 +566,19 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
failure:failure];
}
- (NSURLSessionDataTask *) getAllPage:(NSDictionary *)parameters
success:(void(^)(NSURLSessionDataTask *task,KWMPageResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{
NSString *apiPath = [[NSString alloc] initWithFormat:@"https://%@/admin/pages.json",Shopify_SHOP_DOMAIN];
return [self startSessionTask:KWMHTTPMethodGET
apiPath:apiPath
parameters:parameters
result:[KWMPageResult class]
model:nil
success:success
failure:failure];
}
/**
* 商品——新品API
*/
......
......@@ -23,6 +23,7 @@
tags = tags.count > 0 ? [tags[0] componentsSeparatedByString:@"+"] : nil;
// NSArray *tags = [parameters[JLRouteWildcardComponentsKey] componentsSeparatedByString:@"+"];
NSLog(@"trace tags %@",[tags componentsJoinedByString:@","]);
// NSArray *brands = @[@"amelie-wang",@"babywalker",@"beau-loves",@"billieblush",@"billybandit",@"bonpoint",@"burberry",@"caramel",@"chloe",@"collegien",@"dolce-gabbana",@"emile-et-ida",@"fendi",@"gucci",@"hucklebones",@"il-gufo",@"indikidual",@"karl-lagerfeld-kids",@"kenzo",@"lanvin",@"little-marc-jacobs",@"loud-apparel",@"louis-louise",@"louise-misha",@"marie-chantal",@"marni",@"mini-melissa",@"mini-rodini",@"mischka-aoki",@"moncler",@"moschino",@"msgm",@"nailmatic",@"nana-huchy",@"noukies",@"oeuf",@"patachou",@"paul-smith",@"pepe",@"sons-daughters-eyewear",@"stella-mccartney-kids",@"story-loris",@"tartine-et-chocolat",@"the-animals-observatory",@"tiny-cottons",@"veja",@"young-versace",@"zadig-voltaire"];
KWMSelectedGoodsVC * selectedGoodsVC = (KWMSelectedGoodsVC *)[KWMBaseVC findControllerBy:[KWMSelectedGoodsVC kwmTag] fromStoryboard:@"New"];
selectedGoodsVC.handle = parameters[@"handle"];
selectedGoodsVC.ctags = tags;
......@@ -42,6 +43,14 @@
[routes addRoute:@"/blogs/:blog/:handle" handler:^BOOL(NSDictionary<NSString *,id> * _Nonnull parameters) {
KWMBlogDetailVC *blogDetailVC = (KWMBlogDetailVC *)[KWMBlogDetailVC findControllerBy:@"KWMBlogDetailVC" fromStoryboard:@"Home"];
blogDetailVC.handle = parameters[@"handle"];
blogDetailVC.type = KWMContentTypeBlog;
[[AppDelegate mainViewController].selectedViewController pushViewController:blogDetailVC animated:YES];
return YES;
}];
[routes addRoute:@"/pages/:handle" handler:^BOOL(NSDictionary<NSString *,id> * _Nonnull parameters) {
KWMBlogDetailVC *blogDetailVC = (KWMBlogDetailVC *)[KWMBlogDetailVC findControllerBy:@"KWMBlogDetailVC" fromStoryboard:@"Home"];
blogDetailVC.handle = parameters[@"handle"];
blogDetailVC.type = KWMContentTypePage;
[[AppDelegate mainViewController].selectedViewController pushViewController:blogDetailVC animated:YES];
return YES;
}];
......
//
// BUYClient+FilterSoldout.h
// iCemarose
//
// Created by Sanchew on 2017/7/14.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <Mobile-Buy-SDK/Buy/BUYClient+Storefront.h>
@interface BUYClient (FilterSoldout)
@end
//
// BUYClient+FilterSoldout.m
// iCemarose
//
// Created by Sanchew on 2017/7/14.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "BUYClient+FilterSoldout.h"
#import <Aspects/Aspects.h>
#import <RXCollections/RXCollection.h>
#import <Mobile-Buy-SDK/Buy/BUYProduct.h>
@implementation BUYClient (FilterSoldout)
+ (void)load {
[self aspect_hookSelector:@selector(getProductsPage:inCollection:withTags:sortOrder:completion:) withOptions:AspectPositionInstead usingBlock:^(id<AspectInfo> info,NSUInteger page ,NSNumber *collectionId, NSArray <NSString *> * tags, BUYCollectionSort sortOrder, BUYDataProductListBlock block){
NSInvocation *invocation = info.originalInvocation;
id completion = ^(NSArray<BUYProduct *> * _Nullable products, NSUInteger page, BOOL reachedEnd, NSError * _Nullable error){
NSArray *ps = [products rx_filterWithBlock:^BOOL(BUYProduct *each) {
return each.availableValue;
}];
block(ps,page,reachedEnd,error);
};
[invocation setArgument:&completion atIndex:6];
[invocation invoke];
} error:nil];
}
@end
......@@ -20,7 +20,6 @@
#import "MJRefresh.h"
#import "KWMFilterVC.h"
#import "KWMShoppingCart.h"
#import <RXCollections/RXCollection.h>
#import "KWMSearchFeedbackVC.h"
@interface KWMBrandCaramelVC ()<UITableViewDelegate,UITableViewDataSource,KWMBrandCaramelCellDelegate>
......@@ -358,9 +357,6 @@ static NSString *idStr = @"KWMBrandCaramelCell";
NSInteger tagetPage = self.currentPage.integerValue + 1;
[self.client getProductsPage:tagetPage inCollection:collectionId withTags:tags sortOrder:collectionSort completion:^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){
products = [products rx_filterWithBlock:^BOOL(BUYProduct *each) {
return each.availableValue;
}];
if (error) {
[self showError:error];
NSLog(@"Error fetching products: %@", error);
......
......@@ -21,7 +21,7 @@
@property (nonatomic)KWMSearchBrandView *searchBrandView;
@end
@implementation KWMSearchBrandVC{
@implementation KWMSearchBrandVC {
NSMutableArray *searchArr;
NSString *searchTitle;
}
......
......@@ -9,6 +9,11 @@
#import "KWMBaseVC.h"
#import "KWMArticlesResult.h"
typedef NS_ENUM(NSInteger, KWMContentType) {
KWMContentTypeBlog,//默认从0开始
KWMContentTypePage,
};
@interface KWMBlogDetailVC : KWMBaseVC
@property (weak, nonatomic) IBOutlet UIWebView *wbArticle;
@property (weak, nonatomic) IBOutlet UIView *vTop;
......@@ -19,5 +24,6 @@
@property (weak, nonatomic) IBOutlet UIImageView *flagImg;
@property (nonatomic) KWMArticlesResult *article;
@property (nonatomic) NSString *handle;
@property (nonatomic) KWMContentType type;
@end
......@@ -32,15 +32,28 @@
- (void) requestData {
[self showLoading];
[self.api getAllBlog:@{@"handle":self.handle} success:^(NSURLSessionDataTask *task, KWMBlogResult *result) {
void(^success)(NSURLSessionDataTask *,id) = ^(NSURLSessionDataTask *task, id result) {
[self hideLoading];
self.article = result.blogs.firstObject;
if (self.type == KWMContentTypePage) {
self.article = [[result pages] firstObject];
}else{
self.article = [[result blogs] firstObject];
}
[self initData];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
};
void(^failure)(NSURLSessionDataTask *,NSError *) = ^(NSURLSessionDataTask *task, NSError *error) {
[self showError:error];
NSLog(@"error:%@",error);
self.view.hidden = NO;
}];
};
id param = @{
@"handle":self.handle
};
if (self.type == KWMContentTypePage) {
[self.api getAllPage:param success:success failure:failure];
}else{
[self.api getAllBlog:param success:success failure:failure];
}
}
- (void) initData {
......
......@@ -60,7 +60,7 @@
<constraint firstItem="ILX-tg-IwY" firstAttribute="centerY" secondItem="d0n-L5-xP1" secondAttribute="centerY" id="r8p-Ru-bb6"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ruv-UI-DGw" userLabel="热卖单品Banner" customClass="KWMBannerView">
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ruv-UI-DGw" userLabel="热卖单品Banner" customClass="KWMBannerView">
<rect key="frame" x="0.0" y="60" width="375" height="190"/>
<color key="backgroundColor" red="0.90588235289999997" green="0.81960784310000001" blue="0.74117647060000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
......@@ -81,7 +81,6 @@
</collectionViewFlowLayout>
</collectionView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="UGY-II-IMu" secondAttribute="trailing" id="6ji-Iq-sFG"/>
<constraint firstItem="Ruv-UI-DGw" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="9fw-Ph-Q4P"/>
......
......@@ -170,7 +170,7 @@ typedef enum{
-(void)kwm_onClickDeliveryMenu{
NSLog(@"deliverymenu");
[self openURLWithString:@"https://www.cemarose.com/blogs/service-description/sd"];
[self openURLWithString:@"https://www.cemarose.com/pages/service-description/"];
}
#pragma makr - KWMRecommendDelegate KWMClothingSetsDelegate KWMHotSalesDelegate
......@@ -365,12 +365,8 @@ typedef enum{
- (void)setHomeData:(KWMHomeData *)homeData {
_homeData = homeData;
self.adHeader.adArray = self.homeData.ad_banner;
// self.recommendHeader.productArray = self.productArray;
// self.clothingSetsHeader.productArray = self.productArray;
// self.homeData.hot_sales.single_show_count = @(3);
// self.homeData.hot_sales.single_show_count = @(1);
self.clothingSetsHeader.headerImage = self.homeData.clothing_sets.image;
// self.hotSalesHeader.singleShowArray = testArray;
// self.hotSalesHeader.bannerArray = testArray;
// self.homeData.clothing_sets.url =@"https://www.cemarose.cn/collections/skirts/girls+spring-summer-2016";
NSArray *clothingParam = [self.homeData.clothing_sets.url arrayOfCaptureComponentsMatchedByRegex:@"collections\\/([^/]*+)\\/?(.*)$"];
if (clothingParam.count) {
......
......@@ -20,7 +20,6 @@
#import "UIColor+SAMAdditions.h"
#import "KWMProductDetailVC.h"
#import "KWMShoppingCart.h"
#import <RXCollections/RXCollection.h>
@interface KWMNewVC ()
......@@ -428,9 +427,6 @@ static NSString * idStr = @"KWMNewGoodsCell";
[self.client getProductsPage:tagetPage inCollection:identify withTags:tags sortOrder:collectionSort completion:^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){
[weakSelf hideLoading];
loadStatus.isLoading = NO;
products = [products rx_filterWithBlock:^BOOL(BUYProduct *each) {
return each.availableValue;
}];
if (error == nil && products) {
if(tagetPage == 1){
[weakSelf.userDao saveCollectionCache:products collectionId:identify tags:tags];
......
......@@ -7,19 +7,18 @@
//
#import "UIViewController+AppearLog.h"
#import <JRSwizzle/JRSwizzle.h>
#import <Aspects/Aspects.h>
@implementation UIViewController (AppearLog)
#if DEBUG || 1
+ (void)load
{
[self jr_swizzleMethod:@selector(viewWillAppear:) withMethod:@selector(logViewWillAppear:) error:nil];
[self aspect_hookSelector:@selector(viewWillAppear:) withOptions:AspectPositionInstead usingBlock:^(id<AspectInfo> info, BOOL animated) {
NSInvocation *invocation = info.originalInvocation;
NSLog(@"logViewWillAppear: %@",NSStringFromClass([invocation.target class]));
[invocation invoke];
} error:nil];
}
- (void)logViewWillAppear:(BOOL) animated
{
NSLog(@"logViewWillAppear: %@",NSStringFromClass([self class]));
[self logViewWillAppear:animated];
}
#endif
@end
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