master
wangxinglong 2022-01-27 14:02:28 +08:00
parent dba5acb36d
commit 2182842332
1 changed files with 13 additions and 1 deletions

View File

@ -62,7 +62,7 @@ class Dictionary extends Base
$order["id"] = "desc";
$items = DictionaryRepository::getInstance()->getAllBusinessCircleList($field,$order);
$items->each(function ($item) {
$items->each(function ($item)use($lat,$lng) {
$areaText = '';
if (!empty($item['province_text'])) {
$areaText = $item['province_text'].'·';
@ -79,6 +79,18 @@ class Dictionary extends Base
$item['name_text'] = $item['name'] . '「'.$areaText.'」';
}
if($lng && $lat){
$distance = get_distance($lat,$lng,$item['lat'],$item['lng']);
if($distance>=1000){
$distance = round($distance/1000,2)."Km";
}else{
$distance.="m";
}
$item['distance_text'] = $distance;
}else{
$item['distance_text'] = '';
}
return $item;
});
return $this->json(0, 'success', $items);