Browse Source

新增接口

wufeng 2 years ago
parent
commit
ded8749867
2 changed files with 36 additions and 1 deletions
  1. 35 1
      app/admin/controller/Role.php
  2. 1 0
      app/admin/route/app.php

+ 35 - 1
app/admin/controller/Role.php

@@ -7,6 +7,8 @@ use think\App;
 use think\facade\Db;
 use app\admin\model\ActionLog;
 use think\facade\Validate;
+use app\admin\model\ActionProcess as APModel;
+use app\admin\model\Process as PModel;
 
 //角色
 class Role extends BaseController
@@ -376,7 +378,7 @@ class Role extends BaseController
     }
 
 
-    //获取角色对应的流程权限详情
+    //获取角色对应的流程权限id
     public function roleProcessInfo()
     {
         $roleid = $this->request->filter('trim')->post('roleid/d', 0);
@@ -447,5 +449,37 @@ class Role extends BaseController
 
     }
 
+    //获取角色对应的流程权限详情
+    public function roleProcessDetail()
+    {
+
+        $roleid = $this->request->filter('trim')->post('roleid/d', 0);
+
+        $action_data = Db::name("role_process")
+            ->where('role_id', $roleid)
+            ->value('action_data');
+
+        $data = PModel::where(['is_del' => PModel::$is_del_normal, 'status' => PModel::$status_normal])
+            ->append(['child'])
+            ->withAttr('child', function () {
+                return [];
+            })
+            ->column('id,process_name,process_type', 'id');
+
+        $action = APModel::where([
+            'is_del' => APModel::$is_del_normal,
+            'status' => APModel::$status_normal
+        ])->whereIn('id', $action_data)
+            ->field('id,process_id,order_process,status_name')
+            ->cursor();
+
+        foreach ($action as $item) {
+            $data[$item->process_id]['child'][] = $item->toArray();
+        }
+
+        return app_show(0, '请求成功', array_column($data, null, null));
+
+    }
+
 
 }

+ 1 - 0
app/admin/route/app.php

@@ -42,6 +42,7 @@ Route::rule('roleadd', 'admin/Role/RoleAdd');
 Route::rule('rolesave', 'admin/Role/RoleSave');
 Route::rule('rolestatus', 'admin/Role/RoleStatus');
 Route::rule('role_process_info', 'admin/Role/roleProcessInfo');
+Route::rule('role_process_detail', 'admin/Role/roleProcessDetail');
 Route::rule('role_process_save', 'admin/Role/roleProcessSave');
 
 Route::rule('ulist','admin/Newfill/list');