Commit 73fffe50 by lee

u

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