CoachController.php 2.0 KB

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