From 65da43724155533e82b4f729966ae2a634c1f1f3 Mon Sep 17 00:00:00 2001 From: shengchanzhe <179998674@qq.com> Date: Sat, 23 Dec 2023 17:06:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=93=88=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/server/StoreProduct.php | 5 +++-- app/controller/merchant/store/product/Product.php | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controller/api/server/StoreProduct.php b/app/controller/api/server/StoreProduct.php index 1bbd0676..a2425d5f 100644 --- a/app/controller/api/server/StoreProduct.php +++ b/app/controller/api/server/StoreProduct.php @@ -281,8 +281,9 @@ class StoreProduct extends BaseController public function cloud_product_list(){ [$page, $limit] = $this->getPage(); $merchant = app()->make(MerchantRepository::class)->search(['mer_id' => $this->merId,])->find(); - $select=Db::name('cloud_product')->where('mer_id',$merchant['mer_id']) - ->page($page)->limit($limit)->select()->toArray(); + $product_ids=Db::name('cloud_product')->where('mer_id',$this->merId()) + ->page($page)->limit($limit)->column('product_id'); + $select = Db::name('store_product')->where('mer_id', $this->merId())->whereIn('product_id',$product_ids)->select()->toArray(); $count = Db::name('cloud_product')->where('mer_id',$merchant['mer_id'])->count(); return app('json')->success(['list'=>$select,'count'=>$count]); } diff --git a/app/controller/merchant/store/product/Product.php b/app/controller/merchant/store/product/Product.php index 925218ba..f2cd09af 100644 --- a/app/controller/merchant/store/product/Product.php +++ b/app/controller/merchant/store/product/Product.php @@ -454,8 +454,9 @@ class Product extends BaseController public function cloud_product_list(){ [$page, $limit] = $this->getPage(); - $select=Db::name('cloud_product')->where('mer_id',$this->request->merId()) - ->page($page)->limit($limit)->select()->toArray(); + $product_ids=Db::name('cloud_product')->where('mer_id',$this->request->merId()) + ->page($page)->limit($limit)->column('product_id'); + $select = Db::name('store_product')->where('mer_id', $this->request->merId())->whereIn('product_id',$product_ids)->select()->toArray(); $count = Db::name('cloud_product')->where('mer_id',$this->request->merId())->count(); return app('json')->success(['list'=>$select,'count'=>$count]); }