Browse Source

pc权限调整

lizhen_gitee 6 months ago
parent
commit
8651e1bec7
1 changed files with 23 additions and 3 deletions
  1. 23 3
      application/company/controller/auth/Group.php

+ 23 - 3
application/company/controller/auth/Group.php

@@ -256,6 +256,26 @@ class Group extends Apic
         $this->error();
     }
 
+    public function simple_list(){
+        $ruleList = collection(model('AuthRule')->field('id,title as name,pid as parentId,type')->order('weigh', 'desc')->order('id', 'asc')->select())->toArray();
+
+        $this->success(1,$ruleList);
+    }
+    //此角色已选中的
+    public function list_role_menus(){
+        $id = input('id','');
+
+        $currentrules = Db::name('pc_auth_group')->where('id',$id)->value('rules');
+
+        $rules = explode(',',$currentrules);
+        foreach($rules as $key => &$val){
+            $val = intval($val);
+        }
+        unset($val);
+
+        $this->success(1,$rules);
+    }
+
     /**
      * 读取角色权限树
      *
@@ -266,8 +286,8 @@ class Group extends Apic
         $this->loadlang('auth/group');
 
         $model = model('AuthGroup');
-        $id = input('id');
-        $pid = input('pid');
+        $id = $this->request->post("id");
+        $pid = $this->request->post("pid");
         $parentGroupModel = $model->get($pid);
         $currentGroupModel = null;
         if ($id) {
@@ -325,7 +345,7 @@ class Group extends Apic
                     $state = array('selected' => in_array($v['id'], $currentRuleIds) && !in_array($v['id'], $hasChildrens));
                     $nodeList[] = array('id' => $v['id'], 'parent' => $v['pid'] ? $v['pid'] : '#', 'text' => __($v['title']), 'type' => 'menu', 'state' => $state);
                 }
-                $this->success(1, $nodeList);
+                $this->success('', null, $nodeList);
             } else {
                 $this->error(__('Can not change the parent to child'));
             }