From 84fc43a1592a16f42607473504c31e993e725807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AD=89=E9=A3=8E=E6=9D=A5?= <136327134@qq.com> Date: Thu, 27 Sep 2018 16:24:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2=E5=88=86?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/model/store/StoreProduct.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/application/admin/model/store/StoreProduct.php b/application/admin/model/store/StoreProduct.php index 850ccb7a..36998f4d 100644 --- a/application/admin/model/store/StoreProduct.php +++ b/application/admin/model/store/StoreProduct.php @@ -71,7 +71,13 @@ class StoreProduct extends ModelBasic $model = $model->where('p.store_name|p.keyword|p.id','LIKE',"%$where[store_name]%"); } if(isset($where['cate_id']) && trim($where['cate_id'])!=''){ - $model = $model->where('p.cate_id','LIKE',"%$where[cate_id]%"); + $cate=CategoryModel::where('id',$where['cate_id'])->find(); + if($cate['pid']==0){ + $arr=CategoryModel::where('pid',$cate['id'])->column('id'); + $model = $model->where('p.cate_id','in',$arr); + }else{ + $model = $model->where('p.cate_id','LIKE',"%$where[cate_id]%"); + } } if(isset($where['order']) && $where['order']!=''){ $model = $model->order(self::setOrder($where['order']));