ZxcZxc123 1 år sedan
förälder
incheckning
f038198ae1
1 ändrade filer med 1 tillägg och 1 borttagningar
  1. 1 1
      app/api/controller/PublicController.php

+ 1 - 1
app/api/controller/PublicController.php

@@ -314,7 +314,7 @@ class PublicController
             ['longitude', ''],
         ], $request, true);
         $info = SystemStore::get($id);
-        $info['distance'] = sqrt((pow((($latitude - $info['latitude']) * 111000), 2)) + (pow((($longitude - $info['longitude']) * 111000), 2)));
+        $info['distance'] = sqrt((pow((((float)$latitude - (float)$info['latitude']) * 111000), 2)) + (pow((((float)$longitude - (float)$info['longitude']) * 111000), 2)));
         //转换单位
         $info['range'] = bcdiv($info['distance'], 1000, 1);
         return app('json')->successful('ok',compact('info'));