소스 검색

菜单按钮

cqpCow 1 년 전
부모
커밋
6244e32148
1개의 변경된 파일10개의 추가작업 그리고 5개의 파일을 삭제
  1. 10 5
      app/Service/EmployeeService.php

+ 10 - 5
app/Service/EmployeeService.php

@@ -662,13 +662,18 @@ class EmployeeService extends Service
             ->select('menu_id','type')
             ->get()->toArray();
         $button = $this->fillRoleButton($role_id);
+        $tmp = [];
         foreach ($search as $value){
-            $object[] = [
-                'menu_id' => $value['menu_id'],
-                'type' => $value['type'],
-                'button' => $button[$value['menu_id']] ?? [],
-            ];
+            if(! in_array($value['menu_id'],$tmp)){
+                $object[] = [
+                    'menu_id' => $value['menu_id'],
+                    'type' => $value['type'],
+                    'button' => $button[$value['menu_id']] ?? [],
+                ];
+                $tmp[] = $value['menu_id'];
+            }
         }
+        unset($tmp);
 
         return $object;
     }