From fd6b126cf4df10d9c24151b353f0e2bb8d8dc255 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 15 Nov 2023 16:09:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B8=82=E7=BA=A7=E4=BE=9B?= =?UTF-8?q?=E5=BA=94=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/store/product/CloudWarehouse.php | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/app/controller/api/store/product/CloudWarehouse.php b/app/controller/api/store/product/CloudWarehouse.php index b1d8592e..c40d0345 100644 --- a/app/controller/api/store/product/CloudWarehouse.php +++ b/app/controller/api/store/product/CloudWarehouse.php @@ -8,14 +8,11 @@ use app\common\repositories\store\product\SpuRepository; use think\facade\Db; use think\App; use crmeb\basic\BaseController; +use app\common\dao\store\product\SpuDao; class CloudWarehouse extends BaseController { - /** - * @var SpuRepository - */ - protected $repository; /** * @var MerchantDao */ @@ -25,18 +22,20 @@ class CloudWarehouse extends BaseController */ protected $spuRepository; + protected $SpuDao; + /** * StoreProduct constructor. * @param App $app * @param SpuRepository $repository * @param MerchantDao $merchantDao */ - public function __construct(App $app, SpuRepository $repository, MerchantDao $merchantDao, SpuRepository $spuRepository) + public function __construct(App $app, MerchantDao $merchantDao, SpuRepository $spuRepository,SpuDao $SpuDao) { parent::__construct($app); - $this->repository = $repository; $this->merchantDao = $merchantDao; $this->spuRepository = $spuRepository; + $this->SpuDao = $SpuDao; $this->spuRepository->userInfo = $this->request->isLogin() ? $this->request->userInfo() : null; } @@ -104,24 +103,20 @@ class CloudWarehouse extends BaseController 'status' => 1, 'is_del' => 0, 'mer_status' => 1, + 'product_type'=>98, + 'product_id'=>$cloud_product ]; if (!$cloud_product && $category_id==0) { return app('json')->success(['count' => 0, 'list' => []]); } $count = Db::name('cloud_product')->where('street_code', $street_code)->where('status', 1)->count(); - $select = Db::name('store_product')->whereIn('product_id', $cloud_product)->where($where) - ->withAttr('merchant', function ($value, $data) { - $find= Db::name('merchant')->where('mer_id', $data['mer_id'])->field('mer_id,mer_name')->find(); - return $find; - }) - ->withAttr('sku', function ($value, $data) { - $find = Db::name('store_product_attr_value')->where('mer_id', $data['mer_id'])->where('product_id', $data['product_id'])->find(); - return ['' => $find]; - }) - // ->field('product_id,mer_id,store_name,bar_code,price,stock,product_type,image') - ->select(); - return app('json')->success(['count' => $count, 'list' => $select]); + + $products = $this->spuRepository->getApiSearch($where,$page,10); + if($products['list']){ + $list=$products['list']; + } + return app('json')->success(['count' => $count, 'list' => $list]); } /**