Bläddra i källkod

查询所有的职能

rkljw 5 månader sedan
förälder
incheckning
49a7246a5b
2 ändrade filer med 9 tillägg och 5 borttagningar
  1. 9 4
      app/JsonRpc/PublicRpcService.php
  2. 0 1
      runtime/hyperf.pid

+ 9 - 4
app/JsonRpc/PublicRpcService.php

@@ -477,10 +477,15 @@ class PublicRpcService implements PublicRpcServiceInterface
      */
     public function getDepartment(array $data): array
     {
-        $where = [
-            'pid' => $data['pid'] ?? 0,
-        ];
-        $result = Department::where($where)->orderBy("sort", "desc")->get();
+        $where = [];
+        if(isset($data['pid'])){
+            $where  = [
+                'pid'=>$data['pid']??0
+            ];
+        }
+        $result = Department::when(!empty($where),function ($query) use ($where){
+            $query->where($where);
+        })->orderBy("sort","desc")->get();
         if (empty($result)) {
             return Result::error("查询失败", 0);
         } else {

+ 0 - 1
runtime/hyperf.pid

@@ -1 +0,0 @@
-26777