From 4fc5b2d8dd1caf78d063b958b3b1774d45186abd Mon Sep 17 00:00:00 2001 From: lewis <604446095@qq.com> Date: Wed, 16 Apr 2025 17:14:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lists/store_product/StoreProductLists.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/admin/lists/store_product/StoreProductLists.php b/app/admin/lists/store_product/StoreProductLists.php index 32cc34733..596854c3e 100644 --- a/app/admin/lists/store_product/StoreProductLists.php +++ b/app/admin/lists/store_product/StoreProductLists.php @@ -73,7 +73,6 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa } $class_all = $this->request->get('class_all'); if ($class_all) { - //查3级别的 if (count($class_all) == 1) { $query->where('top_category_id', $class_all[0]); } elseif (count($class_all) == 2) { @@ -183,20 +182,21 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa public function count(): int { $export = $this->request->get('export'); + $query = StoreProduct::where($this->searchWhere); if ($export == 1) { $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)]; + if (count($class_all) == 1) { + $query->where('top_category_id', $class_all[0]); + } elseif (count($class_all) == 2) { + $query->where(function ($query) use ($class_all) { + $query->where('two_cate_id', $class_all[1])->whereOr('cate_id', $class_all[1]); + }); } else { - $this->searchWhere[] = ['cate_id', '=', $class_all]; + $query->where('cate_id', $class_all[2]); } } } - $query = StoreProduct::where($this->searchWhere); if (isset($this->params['type_filter'])) { if ($this->params['type_filter'] == 0) { $query->where(function ($query) { -- 2.47.2 From eb24c561ad8f5f6fec5f192a10e2ea0a3c0bb6d0 Mon Sep 17 00:00:00 2001 From: lewis <604446095@qq.com> Date: Wed, 16 Apr 2025 17:17:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lists/store_product/StoreProductLists.php | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/app/admin/lists/store_product/StoreProductLists.php b/app/admin/lists/store_product/StoreProductLists.php index 596854c3e..63c878223 100644 --- a/app/admin/lists/store_product/StoreProductLists.php +++ b/app/admin/lists/store_product/StoreProductLists.php @@ -181,20 +181,17 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa */ public function count(): int { - $export = $this->request->get('export'); $query = StoreProduct::where($this->searchWhere); - if ($export == 1) { - $class_all = $this->request->get('class_all'); - if ($class_all) { - if (count($class_all) == 1) { - $query->where('top_category_id', $class_all[0]); - } elseif (count($class_all) == 2) { - $query->where(function ($query) use ($class_all) { - $query->where('two_cate_id', $class_all[1])->whereOr('cate_id', $class_all[1]); - }); - } else { - $query->where('cate_id', $class_all[2]); - } + $class_all = $this->request->get('class_all'); + if ($class_all) { + if (count($class_all) == 1) { + $query->where('top_category_id', $class_all[0]); + } elseif (count($class_all) == 2) { + $query->where(function ($query) use ($class_all) { + $query->where('two_cate_id', $class_all[1])->whereOr('cate_id', $class_all[1]); + }); + } else { + $query->where('cate_id', $class_all[2]); } } if (isset($this->params['type_filter'])) { -- 2.47.2