Browse Source

sunguidong

zhangguidong 2 years ago
parent
commit
8e0bca901c
1 changed files with 18 additions and 2 deletions
  1. 18 2
      app/api/controller/Index.php

+ 18 - 2
app/api/controller/Index.php

@@ -256,7 +256,9 @@ class Index extends BaseApi
         $sort = input('sort',"");
         $min = input('min',"");
         $max = input('max',"");
-
+        $brand_name =input('brand_name',"");
+        $province =input('province',"");
+        $city = input('city',"");
         $condition[] =['goods_name','like','%'.$goods_name.'%'];
         $order = 'sale_num desc';
         if($sort !=""){
@@ -271,13 +273,27 @@ class Index extends BaseApi
             }
         }
         if($min!=""&&$max!=""){
-            $condition[] = [ 'price','between',[$min,$max] ];
+            $condition[] = [ 'brand_name','between',[$min,$max] ];
+        }
+        if($brand_name!=""){
+            $condition[] = [ 'price','like','%'.$brand_name.'%' ];
+        }
+        if($province!=""){
+            $condition[] = [ 'province','=',$province ];
+        }
+        if($city!=""){
+            $condition[] = [ 'city','=',$city ];
         }
 
         $goods_model = new \app\model\goods\Goods();
         $goods=$goods_model->getGoodsPageList($condition,$page,$page_size,$order,'goods_id,goods_name,goods_image,price,market_price,sale_num,goods_stock,site_name,pay_num1,price1,pay_num2,price2,pay_num3,price3,price,sku_id');
         return $this->response($this->success($goods['data']));
     }
+    public function brand(){
+        $goods_brand_model = new \app\model\goods\GoodsBrand();
+        $goods_brand = $goods_brand_model->getBrandList();
+        return  $this->response($this->success($goods_brand['data']));
+    }
 
 
 }