panliang 2024-06-12 15:39:42 +08:00
parent de5c209399
commit 67ab53ba94
3 changed files with 14 additions and 16 deletions

View File

@ -80,12 +80,12 @@ class SignController extends Controller
$lon = $request->input('lon');
$lat = $request->input('lat');
// 切换坐标系
$locationType = $request->input('location_type', 'wgs84');
if ($locationType == 'wgs84') {
$res = wgs84ToGcj02($lat, $lon);
$lon = $res['lon'];
$lat = $res['lat'];
}
// $locationType = $request->input('location_type', 'wgs84');
// if ($locationType == 'wgs84') {
// $res = wgs84ToGcj02($lat, $lon);
// $lon = $res['lon'];
// $lat = $res['lat'];
// }
// 计算距离
$distance = $service->haversineDistance(
$lat,
@ -142,12 +142,12 @@ class SignController extends Controller
$lon = $request->input('position.lon');
$lat = $request->input('position.lat');
// 切换坐标系
$locationType = $request->input('position.location_type', 'wgs84');
if ($locationType == 'wgs84') {
$res = wgs84ToGcj02($lat, $lon);
$lon = $res['lon'];
$lat = $res['lat'];
}
// $locationType = $request->input('position.location_type', 'wgs84');
// if ($locationType == 'wgs84') {
// $res = wgs84ToGcj02($lat, $lon);
// $lon = $res['lon'];
// $lat = $res['lat'];
// }
$distance = $service->haversineDistance(
$lat,
$lon,

View File

@ -12,8 +12,6 @@ class ExampleTest extends TestCase
*/
public function test_the_application_returns_a_successful_response(): void
{
$response = $this->get('/');
// $response->assertStatus(200);
dump(wgs84ToGcj02('29.421605', '106.524698'));
}
}

View File

@ -11,6 +11,6 @@ class ExampleTest extends TestCase
*/
public function test_that_true_is_true(): void
{
dump(round(2.6666, 2, PHP_ROUND_HALF_DOWN));
$this->assertTrue(true);
}
}