Commit 32eb02e5 authored by suntengda's avatar suntengda

update 活动绑定自提点列表按距离排序

parent ac6701ee
......@@ -165,15 +165,19 @@ class TakePlaceService
return $list;
}
//按距离返回自提点列表
$sort = [];
if(!empty($list) && is_array($list)) {
foreach ($list as &$item) {
if($item['longitude'] && $item['latitude']) {
$item['distance'] = Geo::geoDistance($lat,$lng,$item['longitude'],$item['latitude'],true);
$sort[] = $item['distance'];
}else {
$item['distance'] = '';
}
}
unset($item);
//按距离排序
array_multisort($sort, SORT_ASC, $list);
return $list;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment