浏览代码

Merge branch 'dev_wf' of wufeng/fuse into version1.5

wufeng 2 年之前
父节点
当前提交
af1caf9969
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      app/admin/logic/RoleLogic.php

+ 10 - 0
app/admin/logic/RoleLogic.php

@@ -5,6 +5,7 @@ namespace app\admin\logic;
 use app\model\CommonModel;
 use app\model\RoleModel;
 use think\Exception;
+use think\exception\ValidateException;
 use think\facade\Db;
 use think\response\Json;
 
@@ -94,6 +95,15 @@ class RoleLogic extends BaseLogic
             ->where(['id' => $id, 'is_del' => CommonModel::$del_normal])
             ->findOrEmpty()
             ->toArray();
+
+        if (empty($rs)) throw new ValidateException('该角色详情为空');
+
+        //已有的权限信息
+        $rs['action'] = Db::name('role_action')
+            ->where(['roleid' => $id, 'is_del' => CommonModel::$del_normal, 'status' => CommonModel::$status_normal])
+            ->value('action_data');
+        $rs['action'] = explode(',', $rs['action']);
+
         return json_show(CommonModel::$success, '获取角色详情成功', $rs);
 
     }