coachLocationService = $coachLocationService; } /** * 获取定位列表 * * @authenticated * * @response { * "code": 200, * "message": "获取成功", * "data": [ * { * "id": 1, * "type": "home", * "latitude": 34.0522, * "longitude": -118.2437, * "city": "Los Angeles", * "district": "Downtown", * "location": "123 Main St", * "area_code": "90001" * } * ] * } */ public function index() { return $this->coachLocationService->getAllLocations(); } /** * 创建定位 * * @authenticated * * @bodyParam type string required 类型. Example: home * @bodyParam latitude float required 纬度. Example: 34.0522 * @bodyParam longitude float required 经度. Example: -118.2437 * @bodyParam city string required 市. Example: Los Angeles * @bodyParam district string required 区. Example: Downtown * @bodyParam location string required 详细地址. Example: 123 Main St * @bodyParam area_code string required 区域编码. Example: 90001 * * @response { * "code": 200, * "message": "创建成功", * "data": { * "id": 1, * "type": "home", * "latitude": 34.0522, * "longitude": -118.2437, * "city": "Los Angeles", * "district": "Downtown", * "location": "123 Main St", * "area_code": "90001" * } * } */ public function store(Request $request) { return $this->coachLocationService->createLocation($request->all()); } /** * 删除定位 * * @authenticated * * @bodyParam coach_id int required 技师ID. Example: 1 * @bodyParam type string required 类型. Example: home * * @response { * "code": 200, * "message": "删除成功", * "data": null * } */ public function destroy(Request $request) { $type = $request->type; $coachId = $request->coach_id; return $this->coachLocationService->deleteLocation($coachId, $type); } }