TestController.php 648 B

1234567891011121314151617181920212223
  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.916527,116.397128';
  15. $to = $from;
  16. $res = $client->get('https://apis.map.qq.com/ws/distance/v1/', ['from' => $from, 'to' => $to, 'key' => env('TECENT_POSITION_KEY')]);
  17. $res = (string)$res->getBody();
  18. return response()->json(['status' => 'success', 'data' => $res]);
  19. }
  20. }