From 55163e82b0c225d16b5f1108029295e110ea4d3c Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Mon, 26 Feb 2024 15:11:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BA=97=E9=93=BA=E5=95=86?= =?UTF-8?q?=E5=93=81=E6=A0=87=E7=AD=BE=E5=88=97=E8=A1=A8=EF=BC=8C=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=88=97=E8=A1=A8=E6=B7=BB=E5=8A=A0=E6=8C=89=E5=85=91?= =?UTF-8?q?=E6=8D=A2=E6=AF=94=E4=BE=8B=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 | 10 +++++++++- route/api.php | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/common/dao/store/product/SpuDao.php b/app/common/dao/store/product/SpuDao.php index e9e55c65..0c43114a 100644 --- a/app/common/dao/store/product/SpuDao.php +++ b/app/common/dao/store/product/SpuDao.php @@ -11,6 +11,7 @@ namespace app\common\dao\store\product; use app\common\dao\BaseDao; +use app\common\model\store\product\ProductAttrValue; use app\common\model\store\product\ProductCate; use app\common\model\store\product\Spu; use app\common\model\store\StoreCategory; @@ -199,6 +200,12 @@ class SpuDao extends BaseDao ->when(isset($where['svip']) && $where['svip'] !== '',function($query)use($where){ $query->where('svip_price_type','>',0)->where('mer_svip_status',1); }) + ->when(isset($where['exchange_rate']) && $where['exchange_rate'] !== '',function($query)use($where){ + $productIds = ProductAttrValue::where('profit_rate', $where['exchange_rate'])->column('product_id'); + if (!empty($productIds)) { + $query->whereIn('product_id', $productIds); + } + }) ; return $query->order($order); } diff --git a/app/controller/api/store/product/StoreSpu.php b/app/controller/api/store/product/StoreSpu.php index d7cf2d2b..0a9dfc83 100644 --- a/app/controller/api/store/product/StoreSpu.php +++ b/app/controller/api/store/product/StoreSpu.php @@ -10,6 +10,7 @@ // +---------------------------------------------------------------------- namespace app\controller\api\store\product; +use app\common\model\store\product\ProductLabel; use app\common\repositories\store\product\ProductRepository; use app\common\repositories\store\StoreCategoryRepository; use app\common\repositories\system\merchant\MerchantRepository; @@ -58,7 +59,8 @@ class StoreSpu extends BaseController 'product_ids', 'mer_id', 'filter_params', - 'mer_type_id' + 'mer_type_id', + 'exchange_rate' ]); $where['is_gift_bag'] = 0; $where['product_type'] = 0; @@ -288,5 +290,11 @@ class StoreSpu extends BaseController return app('json')->success($data); } + public function storeLabel() + { + $merId = $this->request->get('mer_id'); + $list = ProductLabel::where('mer_id', $merId)->select()->toArray(); + return app('json')->success($list); + } } diff --git a/route/api.php b/route/api.php index 962ffb70..a64f9a2c 100644 --- a/route/api.php +++ b/route/api.php @@ -473,6 +473,8 @@ Route::group('api/', function () { Route::get('/active/category/:type', 'StoreSpu/activeCategory'); //标签获取数据 Route::get('/labels', 'StoreSpu/labelsLst'); + //店铺商品标签列表 + Route::get('/storeLabel', 'StoreSpu/storeLabel'); //本地生活商品 Route::get('/local/:id', 'StoreSpu/local'); //复制口令