From 022a25c6a60cd6d76a6012dee72ae094644659ac Mon Sep 17 00:00:00 2001 From: lewis <604446095@qq.com> Date: Wed, 16 Apr 2025 17:00:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=93=81=E5=88=97?= =?UTF-8?q?=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 | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/app/admin/lists/store_product/StoreProductLists.php b/app/admin/lists/store_product/StoreProductLists.php index e19576e6a..32cc34733 100644 --- a/app/admin/lists/store_product/StoreProductLists.php +++ b/app/admin/lists/store_product/StoreProductLists.php @@ -54,17 +54,6 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa */ public function lists(): array { - $class_all = $this->request->get('class_all'); - if ($class_all) { - //查3级别的 - if (count($class_all) == 1) { - $this->searchWhere[] = ['top_cate_id', '=', $class_all[0]]; - } elseif (count($class_all) == 2) { - $this->searchWhere[] = ['two_cate_id', '=', $class_all[1]]; - } else { - $this->searchWhere[] = ['cate_id', '=', $class_all[2]]; - } - } $is_warehouse = $this->request->get('is_warehouse', 0); $order_type = $this->request->get('order_type', 0); $userShip = 0; @@ -82,6 +71,19 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa $query->where('is_show', 1); } } + $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) { + $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 (!empty($this->params['activity_zone_form_id'])) { $exceptIds = ActivityZone::where('form_id', $this->params['activity_zone_form_id'])->column('product_id'); $query->where('is_show', 1)->where('product_type', '<>', 5)->whereNotIn('id', $exceptIds);