diff --git a/app/admin/lists/store_product/StoreProductLists.php b/app/admin/lists/store_product/StoreProductLists.php index 12c737412..360cda901 100644 --- a/app/admin/lists/store_product/StoreProductLists.php +++ b/app/admin/lists/store_product/StoreProductLists.php @@ -4,6 +4,7 @@ namespace app\admin\lists\store_product; use app\admin\lists\BaseAdminDataLists; +use app\common\model\cate\Cate; use app\common\model\store_product\StoreProduct; use app\common\lists\ListsSearchInterface; use app\common\model\store_category\StoreCategory; @@ -45,6 +46,17 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa */ public function lists(): array { + $class_all = $this->request->get('class_all'); + if ($class_all) { + //查3级别的 + $arr = Cate::where('pid', $class_all)->column('id'); + if ($arr) { + $arr2 = Cate::where('pid', 'in', $arr)->column('id'); + $this->searchWhere[] = ['cate_id', 'in', array_merge($arr, $arr2)]; + } else { + $this->searchWhere[] = ['cate_id', '=', $class_all]; + } + } return StoreProduct::where($this->searchWhere) ->field(['id', 'image', 'store_name','swap', 'cate_id','batch', 'price','vip_price','sales', 'stock', 'is_show', 'unit', 'cost','rose','purchase','bar_code','manufacturer_information']) ->limit($this->limitOffset, $this->limitLength)