CoachController.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. * @return \Illuminate\Http\JsonResponse
  19. *
  20. * @OA\Get(
  21. * path="/api/coaches",
  22. * summary="获取技师列表",
  23. * description="根据经纬度获取技师列表",
  24. * tags={"Coaches"},
  25. *
  26. * @OA\Parameter(
  27. * name="latitude",
  28. * in="query",
  29. * required=true,
  30. *
  31. * @OA\Schema(type="number", format="float"),
  32. * description="纬度"
  33. * ),
  34. *
  35. * @OA\Parameter(
  36. * name="longitude",
  37. * in="query",
  38. * required=true,
  39. *
  40. * @OA\Schema(type="number", format="float"),
  41. * description="经度"
  42. * ),
  43. *
  44. * @OA\Response(
  45. * response=200,
  46. * description="成功获取技师列表"
  47. * )
  48. * )
  49. */
  50. public function list(Request $request)
  51. {
  52. $latitude = $request->input('latitude');
  53. $longitude = $request->input('longitude');
  54. return $this->service->getCoachList($latitude, $longitude);
  55. }
  56. /**
  57. * [技师管理] 获取技师详情
  58. *
  59. * 根据ID获取技师的详细信息
  60. *
  61. * @param int $id
  62. * @return \Illuminate\Http\JsonResponse
  63. *
  64. * @OA\Get(
  65. * path="/api/coaches/{id}",
  66. * summary="获取技师详情",
  67. * description="根据ID获取技师的详细信息",
  68. * tags={"Coaches"},
  69. *
  70. * @OA\Parameter(
  71. * name="id",
  72. * in="path",
  73. * required=true,
  74. *
  75. * @OA\Schema(type="integer"),
  76. * description="技师ID"
  77. * ),
  78. *
  79. * @OA\Parameter(
  80. * name="latitude",
  81. * in="query",
  82. * required=false,
  83. *
  84. * @OA\Schema(type="number", format="float"),
  85. * description="纬度"
  86. * ),
  87. *
  88. * @OA\Parameter(
  89. * name="longitude",
  90. * in="query",
  91. * required=false,
  92. *
  93. * @OA\Schema(type="number", format="float"),
  94. * description="经度"
  95. * ),
  96. *
  97. * @OA\Response(
  98. * response=200,
  99. * description="成功获取技师详情"
  100. * )
  101. * )
  102. */
  103. public function detail(Request $request, $id)
  104. {
  105. $latitude = $request->input('latitude');
  106. $longitude = $request->input('longitude');
  107. return $this->service->getCoachDetail($id, $latitude, $longitude);
  108. }
  109. }