diff --git a/app/controller/api/store/product/CloudWarehouse.php b/app/controller/api/store/product/CloudWarehouse.php index e4378479..118004cb 100644 --- a/app/controller/api/store/product/CloudWarehouse.php +++ b/app/controller/api/store/product/CloudWarehouse.php @@ -46,8 +46,13 @@ class CloudWarehouse extends BaseController public function index($street_code, $page = 1, $category_id = 0, $location = '') { $cloud_product_arr = Db::name('cloud_product') - ->where('cate_id', $category_id) - ->whereOR('street_code', $street_code)->whereOR('mer_labels', ',6,')->where('status', 1)->page($page)->field('product_id,mer_labels')->select(); + ->where('category_id', $category_id) + ->where('street_code', $street_code) + ->where(function($query){ + $query->whereOr('mer_labels', '') + ->whereOr('mer_labels',',6,'); + }) + ->where('status', 1)->page($page)->field('product_id,mer_labels')->select(); $cloud_product = []; foreach ($cloud_product_arr as $key => $value) { $cloud_product[] = $value['product_id']; @@ -64,7 +69,13 @@ class CloudWarehouse extends BaseController if (!$cloud_product && $category_id == 0) { return app('json')->success(['count' => 0, 'list' => []]); } - $count = Db::name('cloud_product')->whereOR('street_code', $street_code)->whereOR('mer_labels', ',6,')->where('status', 1)->count(); + $count = Db::name('cloud_product')->where('category_id', $category_id) + ->where('street_code', $street_code) + ->where(function($query){ + $query->whereOr('mer_labels', '') + ->whereOr('mer_labels',',6,'); + }) + ->where('status', 1)->count(); $products = $this->spuRepository->getApiSearch($where, $page, 10, false, true); if ($products['list']) {