123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <?php
- namespace App\Http\Controllers\Client;
- use App\Http\Controllers\Controller;
- use App\Services\Client\ProjectService;
- use Illuminate\Http\Request;
- /**
- * @group 用户端-项目管理
- *
- * 项目相关的API接口
- */
- class ProjectController extends Controller
- {
- protected ProjectService $service;
- public function __construct(ProjectService $service)
- {
- $this->service = $service;
- }
- /**
- * 获取项目列表
- *
- * 根据区域代码获取项目列表
- *
- * @authenticated
- *
- * @queryParam area_code string 区域代码. Example: 330100
- * @queryParam project_cate_id integer 项目分类ID. Example: 1
- *
- * @response {
- * "code": 200,
- * "message": "获取成功",
- * "data": {
- * "current_page": 1,
- * "data": [
- * {
- * "id": 1,
- * "name": "项目名称",
- * "description": "项目描述",
- * "price": "100.00",
- * "duration": 60,
- * "category": {
- * "id": 1,
- * "name": "分类名称"
- * }
- * }
- * ],
- * "total": 10,
- * "per_page": 10
- * }
- * }
- */
- public function index(Request $request)
- {
- $areaCode = $request->input('area_code');
- $projectCateId = $request->input('project_cate_id');
- return $this->service->getProjectList($areaCode, $projectCateId);
- }
- /**
- * 获取项目详情
- *
- * 获取指定项目的详细信息
- *
- * @authenticated
- *
- * @urlParam id integer required 项目ID. Example: 1
- *
- * @queryParam area_code string required 区域代码. Example: 330100
- *
- * @response {
- * "code": 200,
- * "message": "获取成功",
- * "data": {
- * "id": 1,
- * "name": "项目名称",
- * "description": "项目描述",
- * "price": "100.00",
- * "duration": 60,
- * "category": {
- * "id": 1,
- * "name": "分类名称"
- * },
- * "agent": {
- * "id": 1,
- * "name": "代理商名称",
- * "contact": "联系人",
- * "mobile": "13800138000"
- * }
- * }
- * }
- * @response 404 {
- * "code": 404,
- * "message": "项目不存在"
- * }
- * @response 400 {
- * "code": 400,
- * "message": "该区域暂无代理商"
- * }
- */
- public function detail(Request $request, $id)
- {
- $areaCode = $request->input('area_code');
- return $this->service->getProjectDetail($id, $areaCode);
- }
- /**
- * 获取技师项目列表
- *
- * 获取指定技师已开通的项目列表
- *
- * @authenticated
- *
- * @queryParam coach_id integer required 技师ID. Example: 1
- * @queryParam area_code string required 区域代码. Example: 330100
- * @queryParam project_cate_id integer 项目分类ID. Example: 1
- *
- * @response {
- * "code": 200,
- * "message": "获取成功",
- * "data": {
- * "current_page": 1,
- * "data": [
- * {
- * "id": 1,
- * "name": "项目名称",
- * "description": "项目描述",
- * "price": "100.00",
- * "duration": 60,
- * "category": {
- * "id": 1,
- * "name": "分类名称"
- * }
- * }
- * ],
- * "total": 10,
- * "per_page": 10
- * }
- * }
- * @response 404 {
- * "code": 404,
- * "message": "技师不存在或未通过认证"
- * }
- */
- public function coachProjectList(Request $request)
- {
- $coachId = $request->input('coach_id');
- $areaCode = $request->input('area_code');
- $projectCateId = $request->input('project_cate_id');
- return $this->service->getCoachProjectList($coachId, $areaCode, $projectCateId);
- }
- }
|