소스 검색

商品列表筛选项

Abel 1 년 전
부모
커밋
c148f219cc

+ 3 - 3
Asteria/Fuction/Home/ASProductListViewController.m

@@ -45,7 +45,7 @@
 
 - (void)viewDidLoad {
     [super viewDidLoad];
-    self.currentSortType = 2;
+    self.currentSortType = 0;
     self.desMoreOpen = false;
     [self loadSubVs];
     [self loadTimerV];
@@ -441,7 +441,7 @@
         __block typeof(self) weakself = self;
         [v setResultFilterDic:^(NSDictionary<NSString *,KWProductListFilterSubModel *> * _Nonnull arr) {
             weakself.vm.selectDic = [NSMutableDictionary dictionaryWithDictionary:arr];
-//            [weakself.collectV.mj_header beginRefreshing];
+            [weakself.collectV.mj_header beginRefreshing];
         }];
         _menuFilterV = v;
     }
@@ -467,7 +467,7 @@
 }
 
 -(void)showMenuV {
-    
+    self.menuFilterV.vm = self.vm;
     [self.menuFilterV showAnimate:self.vm.selectDic];
 }
 

+ 6 - 0
Asteria/Fuction/Home/Models/KWProductListFilterModel.h

@@ -15,6 +15,8 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, copy) NSString *attribute_name;
 @property (nonatomic, strong) NSMutableArray *attribute_data;
 
+
+
 - (KWProductListFilterModel *)copySelf;
 
 + (KWProductListFilterModel *)demoData;
@@ -31,6 +33,10 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, copy) NSString *Id;
 @property (nonatomic, copy) NSString *name;
 @property (nonatomic, copy) NSString *counts;
+@property (nonatomic, assign) NSInteger status;
+
+@property (nonatomic, copy) NSString *inputMin;
+@property (nonatomic, copy) NSString *inputMax;
 
 - (KWProductListFilterSubModel *)copySelf;
 

+ 14 - 1
Asteria/Fuction/Home/Models/KWProductListFilterModel.m

@@ -43,6 +43,15 @@
     
 }
 
++ (NSDictionary *)mj_replacedKeyFromPropertyName {
+    return @{
+        @"attribute_id":@"code",
+        @"attribute_name":@"name",
+        @"attribute_data":@"option"
+    };
+}
+
+
 
 @end
 
@@ -71,7 +80,11 @@
 
 + (NSDictionary *)mj_replacedKeyFromPropertyName {
     return @{
-        @"Id": @"id",
+        @"minPrice":@"optionvalue",
+        @"maxPrice":@"optionName",
+        @"Id": @"optionvalue",
+        @"counts":@"count",
+        @"name":@"optionName",
     };
 }
 

+ 1 - 1
Asteria/Fuction/Home/Views/productList/ASProductSortFilterView.m

@@ -55,7 +55,7 @@
     if (isKey) {
         self.titles = @[@"Popular",@"Price",@"Sold Quantity"];
     } else {
-        self.titles = @[@"Relevance",@"Price",@"Sold Quantity"];
+        self.titles = @[@"Featured",@"Price:Low to Heigh", @"Price:Heigh to Low",@"Best Selling"];
     }
     [self.tableV reloadData];
     [ASHomeAlertWindow showCustomVc:self position:ASAlertPositionBottom];

+ 3 - 0
Asteria/Fuction/Home/Views/productList/ASProductlistFilterPriceCollectCell.h

@@ -6,11 +6,14 @@
 //
 
 #import <UIKit/UIKit.h>
+#import "KWProductListFilterModel.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
 @interface ASProductlistFilterPriceCollectCell : UICollectionViewCell
 
+
+@property (nonatomic, strong) KWProductListFilterSubModel *model;
 @property (nonatomic, strong) UITextField *minTf;
 @property (nonatomic, strong) UITextField *maxTf;
 

+ 16 - 1
Asteria/Fuction/Home/Views/productList/ASProductlistFilterPriceCollectCell.m

@@ -7,7 +7,7 @@
 
 #import "ASProductlistFilterPriceCollectCell.h"
 
-@interface ASProductlistFilterPriceCollectCell()
+@interface ASProductlistFilterPriceCollectCell() <UITextFieldDelegate>
 
 @property (nonatomic, strong) UIView *lineV;
 @property (nonatomic, strong) UIView *minBgV;
@@ -63,6 +63,18 @@
         make.trailing.equalTo(self.maxBgV).offset(-20);
     }];
     
+    [self.minTf addTarget:self action:@selector(textChangeAction:) forControlEvents:UIControlEventEditingChanged];
+    [self.maxTf addTarget:self action:@selector(textChangeAction:) forControlEvents:UIControlEventEditingChanged];
+    
+}
+
+- (void)textChangeAction:(UITextField *)tf {
+    if (tf == self.minTf) {
+        self.model.inputMin = tf.text;
+    }
+    if (tf == self.maxTf) {
+        self.model.inputMax = tf.text;
+    }
 }
 
 - (UIView *)lineV {
@@ -108,6 +120,7 @@
         tf.textColor = Col_000;
         tf.font = [UIFont fontWithName:Rob_Regular size:14];
         tf.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
+        tf.delegate = self;
         _minTf = tf;
     }
     return _minTf;
@@ -121,9 +134,11 @@
         tf.textColor = Col_000;
         tf.font = [UIFont fontWithName:Rob_Regular size:14];
         tf.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
+        tf.delegate = self;
         _maxTf = tf;
     }
     return _maxTf;
 }
 
+
 @end

+ 4 - 5
Asteria/Fuction/Home/Views/productList/KWProductMenuFilterView.h

@@ -22,15 +22,14 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, strong) UIView *bottomV;
 @property (nonatomic, strong) UIButton *closeBt;
 
-@property (nonatomic, copy, nullable) void(^resultFilterDic)(NSDictionary<NSString *,KWProductListFilterSubModel *> * _Nonnull arr);
+@property (nonatomic, strong) ASProductListViewModel *vm;
 
-//@property (nonatomic, copy) void(^resultFilter)(NSMutableArray<KWProductListFilterModel *> *arr);
+@property (nonatomic, copy, nullable) void(^resultFilterDic)(NSDictionary<NSString *,NSMutableArray<KWProductListFilterSubModel *> *> * _Nonnull arr);
 
-- (void)configTypeId:(NSString *)typeId;
 
-//- (void)getFilterData;
+- (void)configTypeId:(NSString *)typeId;
 
-- (void)showAnimate:(NSMutableDictionary<NSString *,KWProductListFilterSubModel *> *)arr;
+- (void)showAnimate:(NSMutableDictionary<NSString *,NSMutableArray<KWProductListFilterSubModel *> *> *)arr;
 
 @end
 

+ 66 - 68
Asteria/Fuction/Home/Views/productList/KWProductMenuFilterView.m

@@ -14,7 +14,7 @@
 
 @property (nonatomic, copy) NSString *typeid;
 
-@property (nonatomic, strong) ASProductListViewModel *vm;
+
 
 @property (nonatomic,strong) UIButton *clearBt;
 @property (nonatomic, strong) UIButton *doneBt;
@@ -29,24 +29,6 @@
 @implementation KWProductMenuFilterView
 
 
-- (void)configTypeId:(NSString *)typeId {
-    self.typeid = typeId;
-    self.vm.selectDic = [NSMutableDictionary dictionary];
-    [self getFilterData];
-}
-
-- (void)getFilterData {
-//    if (self.vm.sourceArr.count != 0) {
-//        return;
-//    }
-//    [self.vm reqFilterListByType:self.typeid view:self callBack:^{
-//        [self.collectV reloadData];
-//    }];
-}
-
-- (void)configBottomBt {
-}
-
 - (instancetype)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];
     if (self) {
@@ -150,6 +132,26 @@
 }
 
 - (void)doneBtAction {
+    for (KWProductListFilterModel *mainM in self.vm.sourceArr) {
+        if ([mainM.attribute_id isEqualToString:@"price"]) {
+            KWProductListFilterSubModel *subM = mainM.attribute_data.firstObject;
+            if (subM.inputMax.length > 0 && subM.inputMin.length > 0) {
+                NSMutableArray *tempSubs = self.vm.selectDic[mainM.attribute_id];
+                if (tempSubs == nil) {
+                    tempSubs = [NSMutableArray array];
+                }
+                [tempSubs addObject:subM];
+                self.vm.selectDic[mainM.attribute_id] = tempSubs;
+                break;
+            }
+            if (subM.inputMax.length <= 0 && subM.inputMin.length <= 0) {
+                break;
+            }
+            [self makeToast:@"Both Max and Min prices need to be set or removed simultaneously"];
+            return;
+        }
+    }
+    
     [self closeAction:^{
         if (self.resultFilterDic) {
             self.resultFilterDic(self.vm.selectDic);
@@ -163,10 +165,10 @@
     [self.collectV reloadData];
 }
 
-- (void)showAnimate:(NSMutableDictionary<NSString *,KWProductListFilterSubModel *> *)arr {
+- (void)showAnimate:(NSMutableDictionary<NSString *,NSMutableArray<KWProductListFilterSubModel *> *> *)arr {
     self.hidden = false;
     self.vm.selectDic = [NSMutableDictionary dictionaryWithDictionary:arr];
-    [self getFilterData];
+    [self.collectV reloadData];
     CGRect oldFrame = self.frame;
     self.frame = CGRectMake(0, -oldFrame.size.height, oldFrame.size.width, oldFrame.size.height);
     self.hidden = false;
@@ -245,74 +247,64 @@
 }
 
 - (BOOL)hadSelectIndex:(NSIndexPath *)index {
-    KWProductListFilterModel *mainM = self.vm.showArr[index.section];
+    if (self.vm.sourceArr.count < index.section) {
+        return false;
+    }
+    KWProductListFilterModel *mainM = self.vm.sourceArr[index.section];
+    if (mainM.attribute_data.count < index.item) {
+        return false;
+    }
     KWProductListFilterSubModel *subM = mainM.attribute_data[index.item];
     
-    KWProductListFilterSubModel *selectSubM = self.vm.selectDic[mainM.attribute_id];
-    if (selectSubM && [selectSubM.Id isEqualToString:subM.Id]) {
+    NSMutableArray *selectSubMs = self.vm.selectDic[mainM.attribute_id];
+    if (selectSubMs.count > 0 && [selectSubMs containsObject:subM]) {
         return  true;
     }
-//    if (index.section < self.vm.selectArr.count) {
-//        return true;
-//    }
     return false;
 }
 
 - (void)selectIndex:(NSIndexPath *)index {
+    if (self.vm.sourceArr.count < index.section) {
+        return;
+    }
+    KWProductListFilterModel *mainM = self.vm.sourceArr[index.section];
+    if (mainM.attribute_data.count < index.item) {
+        return;
+    }
+    KWProductListFilterSubModel *subM = mainM.attribute_data[index.item];
     BOOL isselct = [self hadSelectIndex:index];
     if (isselct) {
-        KWProductListFilterModel *m = self.vm.showArr[index.section];
-        //self.vm.selectArr[index.section];
-        self.vm.selectDic[m.attribute_id] = nil;
-        
-//        if (m.attribute_data.count > index.row) {
-//            [m.attribute_data removeObjectAtIndex:index.row];
-//        }
-//        if (m.attribute_data.count == 0) {
-//            [self.vm.selectArr removeObjectAtIndex:index.section];
-//        }
+        NSMutableArray *tempSubs = self.vm.selectDic[mainM.attribute_id];
+        if (tempSubs != nil && [tempSubs containsObject:subM]) {
+            [tempSubs removeObject:subM];
+        }
         [self.collectV reloadData];
-//        [self getFilterData];
         return;
     }
+    NSMutableArray *tempSubs = self.vm.selectDic[mainM.attribute_id];
+    if (tempSubs == nil) {
+        tempSubs = [NSMutableArray array];
+    }
+    [tempSubs addObject:subM];
+    self.vm.selectDic[mainM.attribute_id] = tempSubs;
     
-    KWProductListFilterModel *m = self.vm.showArr[index.section];
-    KWProductListFilterSubModel *subm = m.attribute_data[index.row];
-    
-//    KWProductListFilterModel *newM = [m copySelf];
-    KWProductListFilterSubModel *newSubm = [subm copySelf];
-    self.vm.selectDic[m.attribute_id] = newSubm;
-    
-//    [newM.attribute_data addObject:newSubm];
-    
-    
-//    [self.vm.selectArr addObject:newM];
     [self.collectV reloadData];
-//    [self getFilterData];
 }
 
 - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
-    if ([self.vm.showArr[indexPath.section].attribute_id isEqualToString: @"-100"]) {
+    if ([self.vm.sourceArr[indexPath.section].attribute_id isEqualToString: @"price"]) {
         return;
     }
     
-//    NSMutableArray<NSIndexPath *> *tempArr = self.currentIndexs;
-//    NSInteger arrIndex = [self hadSelectIndex:indexPath];
-//    if (arrIndex >= 0) {
-//        [tempArr removeObjectAtIndex:arrIndex];
-//    } else {
-//        [tempArr addObject:indexPath];
-//    }
-//    self.currentIndexs = tempArr;
     [self selectIndex:indexPath];
 }
 
 - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
-    return  self.vm.showArr.count;
+    return  self.vm.sourceArr.count;
 }
 
 - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
-    NSArray *subModels = self.vm.showArr[section].attribute_data;
+    NSArray *subModels = self.vm.sourceArr[section].attribute_data;
     if (subModels == nil) {
         return 0;
     }
@@ -321,21 +313,27 @@
 }
 
 - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
-    if ([self.vm.showArr[indexPath.section].attribute_id isEqualToString: @"-100"]) {
+    if ([self.vm.sourceArr[indexPath.section].attribute_id isEqualToString: @"price"]) {
         ASProductlistFilterPriceCollectCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ASProductlistFilterPriceCollectCell" forIndexPath:indexPath];
-        NSArray<KWProductListFilterSubModel *> *subModels = self.vm.showArr[indexPath.section].attribute_data;
+        NSArray<KWProductListFilterSubModel *> *subModels = self.vm.sourceArr[indexPath.section].attribute_data;
         if (indexPath.item >= subModels.count ){
             return cell;
         }
         KWProductListFilterSubModel *m = subModels[indexPath.item];
-        cell.minTf.text = m.minPrice;
-        cell.maxTf.text = m.maxPrice;
+        cell.model = m;
+        cell.minTf.text = m.inputMin;
+        cell.maxTf.text = m.inputMax;
+        if (m.status <= 0) {
+            cell.minTf.placeholder = m.minPrice;
+            cell.maxTf.placeholder = m.maxPrice;
+        }
+        
         return cell;
     }
     KWProductFilterItemCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"KWProductFilterItemCell" forIndexPath:indexPath];
     NSInteger isSelect = [self hadSelectIndex:indexPath];
     
-    NSArray<KWProductListFilterSubModel *> *subModels = self.vm.showArr[indexPath.section].attribute_data;
+    NSArray<KWProductListFilterSubModel *> *subModels = self.vm.sourceArr[indexPath.section].attribute_data;
     if (subModels == nil) {
         return 0;
     }
@@ -361,7 +359,7 @@
 }
 
 - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
-    if ([self.vm.showArr[indexPath.section].attribute_id isEqualToString: @"-100"]) {
+    if ([self.vm.sourceArr[indexPath.section].attribute_id isEqualToString: @"price"]) {
         return CGSizeMake(KScreenWidth-8*2, 45);;
     }
     CGFloat wid = (KScreenWidth-8*3)/2-1;
@@ -372,7 +370,7 @@
 - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
     if ([kind isEqualToString:UICollectionElementKindSectionHeader]) {
         KWProductMenuFilterItemHeaderView *v = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"KWProductMenuFilterItemHeaderView" forIndexPath:indexPath];
-        NSString *ti = [NSString stringWithFormat:@"%@",self.vm.showArr[indexPath.section].attribute_name];
+        NSString *ti = [NSString stringWithFormat:@"%@",self.vm.sourceArr[indexPath.section].attribute_name];
         v.titleLb.text = ti;
         return  v;
     }

+ 2 - 2
Asteria/Fuction/Home/vm/ASProductListViewModel.h

@@ -21,8 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, strong) ASProductListCategoryModel *cateModel;
 
 @property (nonatomic, strong) NSArray<KWProductListFilterModel *> *sourceArr;
-@property (nonatomic, strong) NSMutableDictionary<NSString *,KWProductListFilterSubModel *> *selectDic;
-@property (nonatomic, strong) NSMutableArray<KWProductListFilterModel *> *showArr;
+@property (nonatomic, strong) NSMutableDictionary<NSString *, NSMutableArray<KWProductListFilterSubModel *> *> *selectDic;
+//@property (nonatomic, strong) NSMutableArray<KWProductListFilterModel *> *showArr;
 
 - (void)getProductListData:(NSString *)catId page:(NSInteger)page orderBy:(NSInteger)orderBy dir:(NSString *)dir com:(void(^)(BOOL hasNext, NSString *msg))com;
 

+ 71 - 30
Asteria/Fuction/Home/vm/ASProductListViewModel.m

@@ -17,7 +17,7 @@
     return _productList;
 }
 
-- (NSMutableDictionary<NSString *,KWProductListFilterSubModel *> *)selectDic {
+- (NSMutableDictionary<NSString *,NSMutableArray<KWProductListFilterSubModel *> *> *)selectDic {
     if (!_selectDic) {
         NSMutableDictionary *tempDic = [NSMutableDictionary dictionary];
         _selectDic = tempDic;
@@ -25,24 +25,25 @@
     return _selectDic;
 }
 
--(NSMutableArray<KWProductListFilterModel *> *)showArr {
-    NSMutableArray *arr = [NSMutableArray array];
-//    [arr addObjectsFromArray:self.selectArr];
-    [arr addObjectsFromArray:self.sourceArr];
-    return arr;
-}
+
+//-(NSMutableArray<KWProductListFilterModel *> *)showArr {
+//    NSMutableArray *arr = [NSMutableArray array];
+////    [arr addObjectsFromArray:self.selectArr];
+//    [arr addObjectsFromArray:self.sourceArr];
+//    return arr;
+//}
 
 - (NSArray<KWProductListFilterModel *> *)sourceArr {
     if (!_sourceArr) {
         NSMutableArray *arr = [NSMutableArray array];
-        for (int i=0; i<(arc4random()%10+1);i++) {
-            [arr addObject:[KWProductListFilterModel demoData]];
-        }
-        KWProductListFilterModel *priceM = [KWProductListFilterModel new];
-        priceM.attribute_id = @"-100";
-        priceM.attribute_name = @"PRICE RANGE";
-        priceM.attribute_data = [NSMutableArray arrayWithObject:[KWProductListFilterSubModel demoData]];
-        [arr addObject:priceM];
+//        for (int i=0; i<(arc4random()%10+1);i++) {
+//            [arr addObject:[KWProductListFilterModel demoData]];
+//        }
+//        KWProductListFilterModel *priceM = [KWProductListFilterModel new];
+//        priceM.attribute_id = @"-100";
+//        priceM.attribute_name = @"PRICE RANGE";
+//        priceM.attribute_data = [NSMutableArray arrayWithObject:[KWProductListFilterSubModel demoData]];
+//        [arr addObject:priceM];
         _sourceArr = arr;
     }
     return _sourceArr;
@@ -50,37 +51,77 @@
 
 - (void)getProductListData:(NSString *)catId page:(NSInteger)page orderBy:(NSInteger)orderBy dir:(NSString *)dir com:(void(^)(BOOL hasNext, NSString *msg))com {
     NSMutableDictionary *para = [NSMutableDictionary dictionary];
-    para[@"currencyCode"] = ASCurrencyManager.shared.currentCur;
-    para[@"page"] = @(page);
-    para[@"size"] = @20;
+    para[@"currency_code"] = ASCurrencyManager.shared.currentCur;
+    para[@"ajax_app"] = @1;
+    para[@"id"] = catId;
+    para[@"p"] = @(page);
     if (orderBy != 0) {
-        NSArray *arr = @[@"position", @"price", @"sold_qty"];
+        NSArray *arr = @[@"",@"price_l",@"price_h",@"popularity"];
         if (arr.count > orderBy && orderBy >= 0) {
-            para[@"order"] = arr[orderBy];
+            para[@"product_list_order"] = arr[orderBy];
         } else {
-            para[@"order"] = @"sold_qty";
+            para[@"product_list_order"] = @"";
         }
     } else {
-        para[@"order"] = @"sold_qty";
+        para[@"product_list_order"] = @"";
     }
-    if (dir != nil && ![dir isEqualToString:@""]) {
-        para[@"dir"] = dir;
-    } else {
-        para[@"dir"] = @"DESC";
+    NSArray *filterKeys = self.selectDic.allKeys;
+    for (NSString *key in filterKeys) {
+        NSArray *subMs = self.selectDic[key];
+        NSMutableString *valueStr = [NSMutableString string];
+        for (KWProductListFilterSubModel *subM in subMs) {
+            if ([key isEqualToString:@"price"]) {
+                if (subM.inputMax.length > 0 && subM.inputMin.length > 0) {
+                    valueStr = [NSMutableString stringWithFormat:@"%@-%@", subM.inputMin, subM.inputMax];
+                    para[key] = valueStr;
+                }
+                continue;
+            }
+            [valueStr appendString:[NSString stringWithFormat:@"%@,",subM.Id]];
+            para[key] = valueStr;
+        }
     }
-    NSString *url = [NSString stringWithFormat:getProductListUrl, catId];
-    [ASNetTools.shared getWithPath:url param:para success:^(id _Nonnull json) {
+    
+    [ASNetTools.shared getWithPath:getProductListUrl param:para success:^(id _Nonnull json) {
         ASProductListCategoryModel *m = [ASProductListCategoryModel mj_objectWithKeyValues:json[@"category"]];
         self.cateModel = m;
-        NSArray *arr = json[@"product"];
+        NSArray *arr = json[@"product"][@"productLists"];
         NSMutableArray *products = [ASProductBaseModel mj_objectArrayWithKeyValuesArray:arr];
+        
+        NSArray *filtArr = json[@"filter"];
+        NSMutableArray *filters = [KWProductListFilterModel mj_objectArrayWithKeyValuesArray:filtArr];
+        self.sourceArr = [NSMutableArray arrayWithArray:filters];
+        self.selectDic = [NSMutableDictionary dictionary];
+        for (KWProductListFilterModel *m in filters) {
+            if (m.attribute_data.count > 0) {
+                for (KWProductListFilterSubModel *sub in m.attribute_data) {
+                    if (sub.status != 0) {
+                        NSMutableArray *tempSubs = self.selectDic[m.attribute_id];
+                        if (tempSubs == nil) {
+                            tempSubs = [NSMutableArray array];
+                        }
+                        if ([m.attribute_id isEqualToString:@"price"]) {
+                            sub.inputMin = sub.minPrice;
+                            sub.inputMax = sub.maxPrice;
+                        } else {
+                            sub.inputMax = @"";
+                            sub.inputMin = @"";
+                        }
+                        [tempSubs addObject:sub.copySelf];
+                        self.selectDic[m.attribute_id] = tempSubs;
+                    }
+                }
+            }
+        }
+        
+        
         if (products.count > 0) {
             if (page == 1) {
                 self.productList = products;
             } else {
                 self.productList = [self.productList arrayByAddingObjectsFromArray:products];
             }
-            if (products.count < 20) {
+            if (products.count < 6) {
                 com(false, @"");
             } else {
                 com(true, @"");

+ 2 - 1
Asteria/NetTools/ASNetApis.h

@@ -13,6 +13,7 @@
 
 #define MsgRequestrUrl(url) ([NSString stringWithFormat:@"%@%@",@"api/",url])
 #define BaseRequestrUrl(url) ([NSString stringWithFormat:@"%@%@",@"rest/V1/",url])
+
 #define BaseWebUrl(url) ([NSString stringWithFormat:@"%@%@",@"rest/V1/",url])
 
 #define PointRuleWebUrl @"https://m.bilisar.com/pointsrule"
@@ -39,7 +40,7 @@
 #define CountryList BaseRequestrUrl(@"directory/countries")
 
 // MARK: - 商品列表
-#define getProductListUrl BaseRequestrUrl(@"rewrite/categories/%@/products")
+#define getProductListUrl @"catalog/category/view"
 #define getProdectDetail BaseRequestrUrl(@"rewrite/product/getProductsById")
 
 // MARK: - 货币