Browse Source

fixed:获取项目列表添加加钟类型项目

刘学玺 4 tháng trước cách đây
mục cha
commit
50d477082c

+ 3 - 1
app/Http/Controllers/Client/ProjectController.php

@@ -29,6 +29,7 @@ class ProjectController extends Controller
      *
      * @queryParam area_code string 区域代码. Example: 330100
      * @queryParam project_cate_id integer 项目分类ID. Example: 1
+     * @queryParam type string 项目类型(normal:普通项目,add_time:加钟项目). Example: normal
      *
      * @response {
      *   "code": 200,
@@ -57,8 +58,9 @@ class ProjectController extends Controller
     {
         $areaCode = $request->input('area_code');
         $projectCateId = $request->input('project_cate_id');
+        $type = $request->input('type');
 
-        return $this->service->getProjectList($areaCode, $projectCateId);
+        return $this->service->getProjectList($areaCode, $projectCateId, $type);
     }
 
     /**

+ 5 - 1
app/Services/Client/ProjectService.php

@@ -25,7 +25,11 @@ class ProjectService
                 ->paginate(10);
         } else {
             $projectCate = ProjectCate::find($projectCateId);
-            $projects = $projectCate?->services;
+            if ($type == 'normal') {
+                $projects = $projectCate?->services()->where('type', 'normal')->get();
+            } else {
+                $projects = $projectCate?->services;
+            }
         }
 
         return $projects;