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]); }