//获取距离
public function space(){
//获取距离
// 我的位置
$latitude=input('latitude');
$longitude=input('longitude');
//店铺位置
$shop_latitude=input('shop_latitude');
$shop_longitude=input('shop_longitude');
//dump($latitude);dump($longitude);die;
$EARTH_RADIUS = 6370.996; // 地球半径系数
$PI = 3.1415926;
$radLat1 = $latitude * $PI / 180.0;
$radLat2 = $shop_latitude * $PI / 180.0;
$radLng1 = $longitude * $PI / 180.0;
$radLng2 = $shop_longitude * $PI /180.0;
$a = $radLat1 - $radLat2;
$b = $radLng1 - $radLng2;
$distance = 2 * asin(sqrt(pow(sin($a/2),2) + cos($radLat1) * cos($radLat2) * pow(sin($b/2),2)));
$distance = $distance * $EARTH_RADIUS * 1000;
//换算成公里数
$distance = $distance / 1000;
$distance=round($distance,2);
$this->ajaxReturn(['status'=>1,'distance'=>$distance]);
}