调整云仓商品列表排序
This commit is contained in:
parent
dde3899a58
commit
593875f751
@ -47,6 +47,7 @@ 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 = '')
|
||||||
{
|
{
|
||||||
$keyword = $this->request->get('keyword');
|
$keyword = $this->request->get('keyword');
|
||||||
|
$order = $this->request->get('order');
|
||||||
[$lat, $lng] = (new CityAreaDao())->getLngAndLat($location, $street_code);
|
[$lat, $lng] = (new CityAreaDao())->getLngAndLat($location, $street_code);
|
||||||
$query = Db::name('cloud_product')->where('status', 1);
|
$query = Db::name('cloud_product')->where('status', 1);
|
||||||
$productIds = (new MerchantDao())->getProductByDistance($lat, $lng,false,50000);
|
$productIds = (new MerchantDao())->getProductByDistance($lat, $lng,false,50000);
|
||||||
@ -63,6 +64,15 @@ class CloudWarehouse extends BaseController
|
|||||||
if (!empty($keyword)) {
|
if (!empty($keyword)) {
|
||||||
$query->where('store_name', 'like', '%'. $keyword . '%');
|
$query->where('store_name', 'like', '%'. $keyword . '%');
|
||||||
}
|
}
|
||||||
|
if (!empty($order)) {
|
||||||
|
if ($order == 'sales') {
|
||||||
|
$query->order($order, 'desc');
|
||||||
|
} elseif ($order == 'price_desc') {
|
||||||
|
$query->order('price', 'desc');
|
||||||
|
} else {
|
||||||
|
$query->order('price', 'asc');
|
||||||
|
}
|
||||||
|
}
|
||||||
$cloud_product_arr = $query->where(function($query){
|
$cloud_product_arr = $query->where(function($query){
|
||||||
$query->where('mer_labels', '')
|
$query->where('mer_labels', '')
|
||||||
->whereOr('mer_labels',',5,');
|
->whereOr('mer_labels',',5,');
|
||||||
@ -77,7 +87,8 @@ class CloudWarehouse extends BaseController
|
|||||||
'status' => 1,
|
'status' => 1,
|
||||||
'is_del' => 0,
|
'is_del' => 0,
|
||||||
'mer_status' => 1,
|
'mer_status' => 1,
|
||||||
'product_id' => $cloud_product
|
'product_id' => $cloud_product,
|
||||||
|
'order' => $order
|
||||||
];
|
];
|
||||||
if (!$cloud_product) {
|
if (!$cloud_product) {
|
||||||
return app('json')->success(['count' => 0, 'list' => []]);
|
return app('json')->success(['count' => 0, 'list' => []]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user