TestController.php 685 B

12345678910111213141516171819202122232425
  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. $res = $client->get($url);
  18. $res = (string)$res->getBody();
  19. dd($res);
  20. return response()->json(['status' => 'success', 'data' => $res]);
  21. }
  22. }