更新查询
This commit is contained in:
parent
327ba73be8
commit
80d34c5c3c
@ -45,13 +45,15 @@ class CloudWarehouse extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function index($street_code, $page = 1, $category_id = 0, $cate_pid = 0,$cate_id = 0,$location = '')
|
public function index($street_code, $page = 1, $category_id = 0, $cate_pid = 0,$cate_id = 0,$location = '')
|
||||||
{
|
{
|
||||||
if($cate_pid!=0){
|
|
||||||
$cate_id=Db::name('store_category')->where('pid',$cate_pid)->where('is_show',1)->column('store_category_id');
|
|
||||||
}
|
|
||||||
$cloud_product_arr = Db::name('cloud_product')
|
$cloud_product_arr = Db::name('cloud_product')
|
||||||
->whereIn('cate_id', $cate_id)
|
|
||||||
->where('street_code', $street_code)
|
->where('street_code', $street_code)
|
||||||
->where(function($query){
|
->where(function($query)use($cate_pid,$cate_id){
|
||||||
|
if($cate_pid!=0){
|
||||||
|
$cate_id=Db::name('store_category')->where('pid',$cate_pid)->where('is_show',1)->column('store_category_id');
|
||||||
|
}
|
||||||
|
if($cate_id>0){
|
||||||
|
$query ->whereIn('cate_id', $cate_id);
|
||||||
|
}
|
||||||
$query->whereOr('mer_labels', '')
|
$query->whereOr('mer_labels', '')
|
||||||
->whereOr('mer_labels',',5,');
|
->whereOr('mer_labels',',5,');
|
||||||
})
|
})
|
||||||
@ -72,9 +74,15 @@ class CloudWarehouse extends BaseController
|
|||||||
if (!$cloud_product) {
|
if (!$cloud_product) {
|
||||||
return app('json')->success(['count' => 0, 'list' => []]);
|
return app('json')->success(['count' => 0, 'list' => []]);
|
||||||
}
|
}
|
||||||
$count = Db::name('cloud_product')->whereIn('cate_id', $cate_id)
|
$count = Db::name('cloud_product')
|
||||||
->where('street_code', $street_code)
|
->where('street_code', $street_code)
|
||||||
->where(function($query){
|
->where(function($query) use($cate_pid,$cate_id){
|
||||||
|
if($cate_pid!=0){
|
||||||
|
$cate_id=Db::name('store_category')->where('pid',$cate_pid)->where('is_show',1)->column('store_category_id');
|
||||||
|
}
|
||||||
|
if($cate_id>0){
|
||||||
|
$query ->whereIn('cate_id', $cate_id);
|
||||||
|
}
|
||||||
$query->whereOr('mer_labels', '')
|
$query->whereOr('mer_labels', '')
|
||||||
->whereOr('mer_labels',',5,');
|
->whereOr('mer_labels',',5,');
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user