瀏覽代碼

修改bug

rkljw 3 月之前
父節點
當前提交
b924e85d4c
共有 2 個文件被更改,包括 10 次插入5 次删除
  1. 9 4
      app/JsonRpc/PublicRpcService.php
  2. 1 1
      runtime/hyperf.pid

+ 9 - 4
app/JsonRpc/PublicRpcService.php

@@ -471,10 +471,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{

+ 1 - 1
runtime/hyperf.pid

@@ -1 +1 @@
-26777
+29573