调整商品列表查询
This commit is contained in:
parent
07a4dba152
commit
e39c96e65c
@ -47,13 +47,19 @@ class CloudWarehouse extends BaseController
|
||||
public function index($street_code, $page = 1, $category_id = 0, $cate_pid = 0,$cate_id = 0,$location = '')
|
||||
{
|
||||
$query = Db::name('cloud_product')->where('status', 1);
|
||||
if (!empty($street_code)) {
|
||||
if (!empty($location)) {
|
||||
[$lat, $lng] = explode(',', $location);
|
||||
}
|
||||
if (!empty($street_code) && empty($location)) {
|
||||
$location = GeoStreet::where('street_code', $street_code)->field('lng,lat')->find();
|
||||
if (!empty($location)) {
|
||||
$merIds = (new MerchantDao())->getValidMerchantByDistance($location['lat'], $location['lng']);
|
||||
if (!empty($merIds)) {
|
||||
$query->whereIn('mer_id', $merIds);
|
||||
}
|
||||
[$lat, $lng] = [$location['lat'], $location['lng']];
|
||||
}
|
||||
}
|
||||
if (!empty($lat)) {
|
||||
$merIds = (new MerchantDao())->getValidMerchantByDistance($lat, $lng);
|
||||
if (!empty($merIds)) {
|
||||
$query->whereIn('mer_id', $merIds);
|
||||
}
|
||||
}
|
||||
if (empty($merIds)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user