<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## 控制器相關代碼RbacController.class.php ~~~php /** * @title 角色列表 * 角色列表 */ public function role(){ $this->assign('list',$this->search(M('role'),15)); $this->display(); } /** * @title 查看角色 * doAction - 角色 * 查看編輯數據及渲染添加頁面 */ public function show(){ $id = I('get.id',0); if(IS_AJAX){ $model = new RoleModel(); $data =$model->find($id); if($data){ $data['status'] = ($data['status']==1)?true:false; $this->ajaxReturn($data); } $this->ajaxReturn(false); } $this->assign('show_id',$id); $this->display(); } /** * @title 操作角色數據 * 添加或編輯角色 */ public function form(){ if (IS_POST){ $data = I('post.'); $model = new RoleModel(); $this->ajaxReturn($res = $model->store($data)); }else{ new \HttpRequestMethodException('請求不合法'); } } /** * @title 刪除角色 * 刪除角色 */ public function remove(){ $data = I('post.ids'); if(IS_AJAX && is_array($data)){ $map['id'] = ['in',$data]; $result = M('role')->where($map)->delete(); if($result){ $this->ajaxReturn(['status'=>true,'message'=>'刪除成功']); }else{ $this->ajaxReturn(['status'=>false,'message'=>'刪除失敗']); } }else{ new \HttpRequestMethodException('請求不合法'); } } /** * @title 刪除狀態 * 改變角色狀態 */ public function status(){ $ids = I('post.ids'); $action = I('post.action'); if(IS_AJAX && is_array($ids) && in_array($action,['open','off'])){ $map['id'] = ['in',$ids]; switch ($action){ case 'open': $data['status']=1;$message = '角色開啟'; break; case 'off': $data['status']=0;$message = '角色關閉'; break; } $result = M('role')->where($map)->save($data); if($result){ $this->ajaxReturn(['status'=>true,'message'=>$message]); }else{ $this->ajaxReturn(['status'=>false,'message'=>$message.'失敗']); } }else{ new \HttpRequestMethodException('請求不合法'); } } //###########################節點管理部分############################################## /** * @title 節點列表 */ public function index(){ $mode = new NodeModel(); $list = $mode->getTreeList(); //dump($list); $this->assign('list',$list); $this->display(); } /** * @title 查看編輯節點 */ public function look(){ $id = I('get.id',0); if(IS_AJAX&&$id){ $model = new NodeModel(); $data =$model->find($id); if($data){ $this->ajaxReturn($data); } $this->ajaxReturn(false); }else{ new \HttpRequestMethodException('請求不合法'); } } /** * @title 操作節點數據 * 添加或編輯節點 */ public function node(){ if (IS_POST){ $data = I('post.'); $model = new NodeModel(); $this->ajaxReturn($res = $model->store($data)); }else{ new \HttpRequestMethodException('請求不合法'); } } /** * @title 刪除節點數據 * 刪除節點 */ public function deleted(){ if (IS_POST){ $data = I('post.id',0); $model = new NodeModel(); $this->ajaxReturn($res = $model->deleteNode($data)); }else{ new \HttpRequestMethodException('請求不合法'); } } /** * 授權角色授權 */ public function access(){ $id = I('get.role_id',0); if(IS_POST){ $role_id = I('post.role_id'); $node_ids = I('post.rules'); M('access')->where(['role_id'=>$role_id])->delete(); $nodeMap['id'] = ['in',$node_ids]; $node = M('node')->field('id as node_id,level')->where($nodeMap)->select(); foreach($node as $key => $value){ $node[$key]['role_id'] = $role_id; } $node[] = ['node_id'=>1,'level'=>1,'role_id'=>$role_id]; //默認將后臺分組加上去 if(M('access')->addAll($node) ){ $this->ajaxReturn(['status'=>true,'message'=>'授權成功']); }else{ $this->ajaxReturn(['status'=>false,'message'=>'授權失敗']); } } $mode = new NodeModel(); $list = $mode->getTreeList(); $this->assign('list',$list); $this->assign('role',M('role')->find($id)); //取出用戶的節點 $access = M('access')->field('node_id')->where(['role_id'=>$id])->select(); $this->assign('access',implode(',',array_column($access,'node_id'))); $this->display(); } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看