From 7832a9fee707aef535e7ecebfd8ede133d3d051a Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Thu, 14 Mar 2024 10:07:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8D=E4=BC=98=E7=89=B9?= =?UTF-8?q?=E4=BA=A7=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/dao/store/product/SpuDao.php | 7 +++++++ app/controller/api/store/product/StoreSpu.php | 5 ++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/common/dao/store/product/SpuDao.php b/app/common/dao/store/product/SpuDao.php index d953bb44..2537a8f6 100644 --- a/app/common/dao/store/product/SpuDao.php +++ b/app/common/dao/store/product/SpuDao.php @@ -14,6 +14,7 @@ use app\common\dao\BaseDao; use app\common\Enum; use app\common\model\store\product\ProductAttrValue; use app\common\model\store\product\ProductCate; +use app\common\model\store\product\ProductLabel; use app\common\model\store\product\Spu; use app\common\model\store\StoreCategory; use app\common\model\system\merchant\Merchant; @@ -175,6 +176,12 @@ class SpuDao extends BaseDao ->when(isset($where['spu_status']) && $where['spu_status'] !== '',function($query)use($where){ $query->where('S.status',$where['spu_status']); }) + ->when(isset($where['label_name']) && $where['label_name'] !== '',function($query)use($where){ + $labelId = ProductLabel::where('label_name', $where['label_name'])->value('product_label_id'); + if (!empty($labelId)) { + $query->whereLike('S.sys_labels',"%,{$labelId},%"); + } + }) ->when(isset($where['sys_labels']) && $where['sys_labels'] !== '',function($query)use($where){ $query->whereLike('S.sys_labels',"%,{$where['sys_labels']},%"); }) diff --git a/app/controller/api/store/product/StoreSpu.php b/app/controller/api/store/product/StoreSpu.php index 20e48dfa..e52f3f87 100644 --- a/app/controller/api/store/product/StoreSpu.php +++ b/app/controller/api/store/product/StoreSpu.php @@ -12,12 +12,10 @@ namespace app\controller\api\store\product; use app\common\model\store\product\ProductLabel; use app\common\model\system\merchant\Merchant; -use app\common\repositories\store\product\ProductRepository; use app\common\repositories\store\StoreCategoryRepository; use app\common\repositories\system\merchant\MerchantRepository; use app\common\repositories\user\UserHistoryRepository; -use app\common\repositories\user\UserVisitRepository; -use app\controller\admin\system\merchant\MerchantType; +use app\common\model\system\merchant\MerchantType; use crmeb\services\CopyCommand; use think\App; use crmeb\basic\BaseController; @@ -68,6 +66,7 @@ class StoreSpu extends BaseController 'type_id', 'type_code', 'category_id', + 'label_name', ]); if ($where['type_id'] || $where['type_code']) { $query = Merchant::where(['status' => 1, 'mer_state' => 1, 'is_del' => 0]);