Commit 73fffe50 by lee

u

parent 1fe2f360
...@@ -18,4 +18,6 @@ ...@@ -18,4 +18,6 @@
@property (nonatomic) NSArray<Optional> *images; @property (nonatomic) NSArray<Optional> *images;
@property (nonatomic) NSDictionary<Optional> *image; @property (nonatomic) NSDictionary<Optional> *image;
-(BOOL) available;
@end @end
...@@ -7,7 +7,19 @@ ...@@ -7,7 +7,19 @@
// //
#import "KWMDataProduct.h" #import "KWMDataProduct.h"
#import "KWMVariants.h"
@implementation KWMDataProduct @implementation KWMDataProduct
- (BOOL)available {
BOOL ret = NO;
for (KWMVariants *v in self.variants) {
if (v.inventoryQuantity.integerValue > 0) {
ret = YES;
break;
}
}
return ret;
}
@end @end
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
- (void) addTasksObject:(NSURLSessionDataTask *)object { - (void) addTasksObject:(NSURLSessionDataTask *)object {
if (self.tasks.lastObject && [self.tasks.lastObject.currentRequest.URL.absoluteString isEqualToString:object.currentRequest.URL.absoluteString] && [object.currentRequest.URL.absoluteString isMatchedByRegex:@"cart.js$"]) { if (self.tasks.lastObject && [self.tasks.lastObject.currentRequest.URL.absoluteString isEqualToString:object.currentRequest.URL.absoluteString] && [object.currentRequest.URL.absoluteString isMatchedByRegex:@"cart.js$"]) {
return; if(!self.sync)return;
} }
[self.tasks addObject:object]; [self.tasks addObject:object];
if (self.tasks.count == 1) { if (self.tasks.count == 1) {
......
...@@ -394,6 +394,7 @@ typedef enum{ ...@@ -394,6 +394,7 @@ typedef enum{
- (void)setHomeData:(KWMHomeData *)homeData { - (void)setHomeData:(KWMHomeData *)homeData {
_homeData = homeData; _homeData = homeData;
// [self.homeData.ad_banner[0] setUrl:@"https://www.cemarose.cn/collections/skirts/girls"];
self.adHeader.adArray = self.homeData.ad_banner; self.adHeader.adArray = self.homeData.ad_banner;
// self.homeData.hot_sales.single_show_count = @(1); // self.homeData.hot_sales.single_show_count = @(1);
self.clothingSetsHeader.headerImage = self.homeData.clothing_sets.image; self.clothingSetsHeader.headerImage = self.homeData.clothing_sets.image;
......
...@@ -216,8 +216,8 @@ static NSString *idStr = @"KWMBrandCaramelCell"; ...@@ -216,8 +216,8 @@ static NSString *idStr = @"KWMBrandCaramelCell";
[weakSelf.dataList removeAllObjects]; [weakSelf.dataList removeAllObjects];
} }
NSArray *products = [result.productList rx_filterWithBlock:^BOOL(BUYProduct *each) { NSArray *products = [result.productList rx_filterWithBlock:^BOOL(KWMDataProduct *each) {
return each.availableValue; return [each available];
}]; }];
[weakSelf appendDataList:products setPage:tagetPage]; [weakSelf appendDataList:products setPage:tagetPage];
_vSearchFB.lbGoodsNum.text = [NSString stringWithFormat:@"%lu商品",(unsigned long)total]; _vSearchFB.lbGoodsNum.text = [NSString stringWithFormat:@"%lu商品",(unsigned long)total];
......
...@@ -64,11 +64,16 @@ ...@@ -64,11 +64,16 @@
NSArray *ids = [cart.items rx_mapWithBlock:^id(KWMShopCartModel *each) { NSArray *ids = [cart.items rx_mapWithBlock:^id(KWMShopCartModel *each) {
return each.product_id; return each.product_id;
}]; }];
if (ids && ids.count > 0) {
[this.client getProductsByIds:ids completion:^(NSArray<BUYProduct *> * _Nullable products, NSError * _Nullable error) { [this.client getProductsByIds:ids completion:^(NSArray<BUYProduct *> * _Nullable products, NSError * _Nullable error) {
[this hideLoading]; [this hideLoading];
// [this refresh]; // [this refresh];
[this checkInStockWithItems:cart.items products:products]; [this checkInStockWithItems:cart.items products:products];
}]; }];
}else{
[this hideLoading];
[this refresh];
}
}]; }];
} }
......
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