setter
parent
dba5acb36d
commit
2182842332
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue