From 07504a4b47693ed3ccd384a9a4a10f62533fc72d Mon Sep 17 00:00:00 2001 From: shengchanzhe <179998674@qq.com> Date: Mon, 25 Dec 2023 11:55:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repositories/store/product/ProductRepository.php | 2 ++ app/controller/api/store/product/CloudWarehouse.php | 11 +++++++---- app/listener/ProductCreate.php | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/common/repositories/store/product/ProductRepository.php b/app/common/repositories/store/product/ProductRepository.php index 3d5917d5..f18eea03 100644 --- a/app/common/repositories/store/product/ProductRepository.php +++ b/app/common/repositories/store/product/ProductRepository.php @@ -2594,8 +2594,10 @@ class ProductRepository extends BaseRepository case 'seven': $data['type'] = 8; } + $store_product=Db::name('store_product')->where('product_id',$data['product_id'])->find(); $datas = [ 'product_id' => $data['product_id'], + 'cate_id' => $store_product['cate_id'], 'mer_id' => $merchant['mer_id'], 'source_mer_id' => 0, 'street_code' => $merchant['street_id'], diff --git a/app/controller/api/store/product/CloudWarehouse.php b/app/controller/api/store/product/CloudWarehouse.php index 118004cb..5a52151a 100644 --- a/app/controller/api/store/product/CloudWarehouse.php +++ b/app/controller/api/store/product/CloudWarehouse.php @@ -43,10 +43,13 @@ class CloudWarehouse extends BaseController * type_id 13云仓商品列表 * @return mixed */ - public function index($street_code, $page = 1, $category_id = 0, $location = '') + public function index($street_code, $page = 1, $category_id = 0, $cate_pid = 0,$cate_id = 0,$location = '') { + if($cate_pid!=0){ + $cate_id=Db::name('store_category')->where('pid',$cate_pid)->where('is_show',1)->column('store_category_id'); + } $cloud_product_arr = Db::name('cloud_product') - ->where('category_id', $category_id) + ->whereIn('cate_id', $cate_id) ->where('street_code', $street_code) ->where(function($query){ $query->whereOr('mer_labels', '') @@ -66,10 +69,10 @@ class CloudWarehouse extends BaseController 'product_type' => 98, 'product_id' => $cloud_product ]; - if (!$cloud_product && $category_id == 0) { + if (!$cloud_product) { return app('json')->success(['count' => 0, 'list' => []]); } - $count = Db::name('cloud_product')->where('category_id', $category_id) + $count = Db::name('cloud_product')->whereIn('cate_id', $cate_id) ->where('street_code', $street_code) ->where(function($query){ $query->whereOr('mer_labels', '') diff --git a/app/listener/ProductCreate.php b/app/listener/ProductCreate.php index f753b2ee..c50d2075 100644 --- a/app/listener/ProductCreate.php +++ b/app/listener/ProductCreate.php @@ -53,6 +53,7 @@ class ProductCreate $datas = [ 'product_id' => $product_id, 'mer_id' => $merchant['mer_id'], + 'cate_id' => $product['cate_id'], 'source_mer_id' => $cityMerchant['mer_id'], 'street_code' => $merchant['street_id'], 'type_id' => $merchant['type_id'],