更新距离
This commit is contained in:
parent
2bab5ff692
commit
25c31503e5
@ -323,7 +323,7 @@ class MerchantDao extends BaseDao
|
|||||||
* @param $distance 距离,单位米
|
* @param $distance 距离,单位米
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getValidMerchantByDistance($lat, $lng, $sort = false, $distance = 2000)
|
public function getValidMerchantByDistance($lat, $lng, $sort = false, $distance = 10000)
|
||||||
{
|
{
|
||||||
$query = Merchant::where('type_id', 'IN', ["10", "17"])
|
$query = Merchant::where('type_id', 'IN', ["10", "17"])
|
||||||
->where(['is_del' => 0, 'mer_state' => 1])
|
->where(['is_del' => 0, 'mer_state' => 1])
|
||||||
@ -335,9 +335,9 @@ class MerchantDao extends BaseDao
|
|||||||
} else {
|
} else {
|
||||||
$query->having("distance <= {$distance}")->limit(50);
|
$query->having("distance <= {$distance}")->limit(50);
|
||||||
}
|
}
|
||||||
$merchant = $query->select()->toArray();
|
$merchant = $query->select();
|
||||||
if (empty($merchant) && $distance < 5000 && !$sort) {
|
if (empty($merchant) && $distance < 5000 && !$sort) {
|
||||||
$merchant = $this->getValidMerchantByDistance($lat, $lng, $sort, 5000);
|
$merchant = $this->getValidMerchantByDistance($lat, $lng, $sort, 50000);
|
||||||
}
|
}
|
||||||
if (!empty($merchant)) {
|
if (!empty($merchant)) {
|
||||||
return array_column($merchant, 'mer_id');
|
return array_column($merchant, 'mer_id');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user