TestController.php 867 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Models\Student;
  4. use App\Models\StudentCourse;
  5. use App\Services\Admin\AdminUser;
  6. use Carbon\Carbon;
  7. use GuzzleHttp\Client;
  8. use Illuminate\Http\Request;
  9. class TestController extends Controller
  10. {
  11. public function index(Request $request)
  12. {
  13. $client = new Client();
  14. $from = '39.071510,117.190091';
  15. $to = $from;
  16. $url = 'https://apis.map.qq.com/ws/distance/v1?from=' . $from . '&to=' . $to . '&key=' . env('TECENT_POSITION_KEY');
  17. $url = 'https://apis.map.qq.com/ws/distance/v1/?mode=driving&from=39.983171,116.308479&to=39.996060,116.353455;39.949227,116.394310&key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77';
  18. $res = $client->get($url);
  19. $res = (string)$res->getBody();
  20. dd($res);
  21. return response()->json(['status' => 'success', 'data' => $res]);
  22. }
  23. }