CoachController.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace App\Http\Controllers\Client;
  3. use App\Http\Controllers\Controller;
  4. use App\Services\Client\CoachService;
  5. use Illuminate\Http\Request;
  6. class CoachController extends Controller
  7. {
  8. protected CoachService $service;
  9. public function __construct(CoachService $service)
  10. {
  11. $this->service = $service;
  12. }
  13. /**
  14. * [技师管理] 获取技师列表
  15. *
  16. * 根据经纬度获取技师列表
  17. *
  18. * @authenticated
  19. *
  20. * @queryParam latitude float required 纬度. Example: 34.0522
  21. * @queryParam longitude float required 经度. Example: -118.2437
  22. *
  23. * @response {
  24. * "code": 200,
  25. * "message": "获取成功",
  26. * "data": [
  27. * {
  28. * "id": 1,
  29. * "name": "技师A",
  30. * "latitude": 34.0522,
  31. * "longitude": -118.2437
  32. * }
  33. * ]
  34. * }
  35. */
  36. public function list(Request $request)
  37. {
  38. $latitude = $request->input('latitude');
  39. $longitude = $request->input('longitude');
  40. return $this->service->getCoachList($latitude, $longitude);
  41. }
  42. /**
  43. * [技师管理] 获取技师详情
  44. *
  45. * 根据ID获取技师的详细信息
  46. *
  47. * @authenticated
  48. *
  49. * @urlParam id int required 技师ID. Example: 1
  50. *
  51. * @queryParam latitude float 纬度. Example: 34.0522
  52. * @queryParam longitude float 经度. Example: -118.2437
  53. *
  54. * @response {
  55. * "code": 200,
  56. * "message": "获取成功",
  57. * "data": {
  58. * "id": 1,
  59. * "name": "技师A",
  60. * "latitude": 34.0522,
  61. * "longitude": -118.2437,
  62. * "details": "详细信息"
  63. * }
  64. * }
  65. */
  66. public function detail(Request $request, $id)
  67. {
  68. $latitude = $request->input('latitude');
  69. $longitude = $request->input('longitude');
  70. return $this->service->getCoachDetail($id, $latitude, $longitude);
  71. }
  72. }