From 7a3903dfec587e2a181923b70788bc2d8c1aaacd Mon Sep 17 00:00:00 2001 From: shengchanzhe <179998674@qq.com> Date: Mon, 25 Dec 2023 15:54:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=91=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../merchant/store/product/Product.php | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/app/controller/merchant/store/product/Product.php b/app/controller/merchant/store/product/Product.php index f2cd09af..54a5c341 100644 --- a/app/controller/merchant/store/product/Product.php +++ b/app/controller/merchant/store/product/Product.php @@ -454,10 +454,27 @@ class Product extends BaseController public function cloud_product_list(){ [$page, $limit] = $this->getPage(); - $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(); + $cloud_product_arr=Db::name('cloud_product')->where('mer_id',$this->request->merId()) + ->page($page)->limit($limit)->field('product_id,mer_labels')->select(); + $cloud_product = []; + foreach ($cloud_product_arr as $key => $value) { + $cloud_product[] = $value['product_id']; + } + $select = Db::name('store_product')->where('mer_id', $this->request->merId())->whereIn('product_id',$cloud_product)->select()->toArray(); $count = Db::name('cloud_product')->where('mer_id',$this->request->merId())->count(); + if ($select) { + foreach ($cloud_product_arr as $key => $value) { + foreach ($select as $k => $v) { + if ($value['product_id'] == $v['product_id']) { + if ($value['mer_labels'] == ',5,') { + $select[$k]['mer_labels_name'] = '五日达'; + } else { + $select[$k]['mer_labels_name'] = '次日达'; + } + } + } + } + } return app('json')->success(['list'=>$select,'count'=>$count]); }