From ee2c8bf106bf447b9dab91a9079bb35273207d52 Mon Sep 17 00:00:00 2001 From: augushong Date: Wed, 4 Sep 2019 13:25:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E8=BF=9B=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=92=8C=E6=9D=83=E9=99=90=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Admin.php | 18 ++++ app/admin/controller/AdminGroup.php | 92 +++++++++++++++++ app/admin/controller/AdminPermission.php | 67 +++++++++++++ app/admin/middleware.php | 5 + app/middleware/PermissionRecord.php | 27 +++++ app/model/Admin.php | 7 ++ app/model/AdminGroup.php | 16 +++ app/model/AdminPermission.php | 14 +++ composer.lock | 46 ++++----- view/admin/admin/create.html | 113 +++++++++++++++++++++ view/admin/admin/index.html | 80 +++++++++++++++ view/admin/admin_group/create.html | 0 view/admin/admin_group/index.html | 59 +++++++++++ view/admin/admin_permission/index.html | 120 +++++++++++++++++++++++ view/admin/common/_header.html | 1 + view/admin/common/left_admin_manage.html | 16 +++ 16 files changed, 658 insertions(+), 23 deletions(-) create mode 100644 app/admin/controller/AdminGroup.php create mode 100644 app/admin/controller/AdminPermission.php create mode 100644 app/admin/middleware.php create mode 100644 app/middleware/PermissionRecord.php create mode 100644 app/model/AdminGroup.php create mode 100644 app/model/AdminPermission.php create mode 100644 view/admin/admin/create.html create mode 100644 view/admin/admin/index.html create mode 100644 view/admin/admin_group/create.html create mode 100644 view/admin/admin_group/index.html create mode 100644 view/admin/admin_permission/index.html create mode 100644 view/admin/common/left_admin_manage.html diff --git a/app/admin/controller/Admin.php b/app/admin/controller/Admin.php index 29c0c2d..76febf8 100644 --- a/app/admin/controller/Admin.php +++ b/app/admin/controller/Admin.php @@ -68,4 +68,22 @@ class Admin extends Common return $this->success('保存成功','Admin/edit'); } + + public function index() + { + + $admin_list = AppAdmin::where('id','<>',1)->paginate(); + View::assign('list',$admin_list); + return View::fetch(); + } + + public function create() + { + return View::fetch(); + } + + public function save() + { + + } } diff --git a/app/admin/controller/AdminGroup.php b/app/admin/controller/AdminGroup.php new file mode 100644 index 0000000..bf863f8 --- /dev/null +++ b/app/admin/controller/AdminGroup.php @@ -0,0 +1,92 @@ +post(); + + $model_permission = AppAdminPermission::find($id); + + if(isset($post_data['url'])){ + $url_info = \explode('/',$post_data['url']); + + $post_data['app'] = $url_info[0]; + $post_data['controller'] = $url_info[1]; + $post_data['action'] = $url_info[2]; + } + + $model_permission->data($post_data); + + $model_permission->save(); + + return json_message(); + } + + /** + * 删除指定资源 + * + * @param int $id + * @return \think\Response + */ + public function delete($id) + { + // + } +} diff --git a/app/admin/middleware.php b/app/admin/middleware.php new file mode 100644 index 0000000..06e50c3 --- /dev/null +++ b/app/admin/middleware.php @@ -0,0 +1,5 @@ +$request->app(), + 'controller'=>$request->controller(), + 'action'=>$request->action() + ]; + + $model_permission = AdminPermission::where($current_access_info)->find(); + + if(empty($model_permission)){ + AdminPermission::create($current_access_info); + } + + return $next($request); + } +} diff --git a/app/model/Admin.php b/app/model/Admin.php index faadbac..4ed433c 100644 --- a/app/model/Admin.php +++ b/app/model/Admin.php @@ -15,4 +15,11 @@ class Admin extends Model { return \get_source_link($value); } + + public function getGroupAttr() + { + if(empty($this->getData('group_id'))){ + return '未分组'; + } + } } diff --git a/app/model/AdminGroup.php b/app/model/AdminGroup.php new file mode 100644 index 0000000..244190d --- /dev/null +++ b/app/model/AdminGroup.php @@ -0,0 +1,16 @@ + + + + + + + 基本资料 + {include file="common/_require"} + + + +
+ {include file="common/_header"} + + {include file="common/left_admin_manage"} + +
+ +
+ +
+
+
+
+ 管理员管理 +
+
+
+
登录账号
+
+ +
+
+
+
昵称
+
+ +
+
+
+
密码
+
+ +
+
+
+
头像
+
+
+
上传
+
+
+ +
+ +
+
+
+ +
+
+
+
+
+
+
+
+
+ + + {include file="common/_footer"} + + +
+ + \ No newline at end of file diff --git a/view/admin/admin/index.html b/view/admin/admin/index.html new file mode 100644 index 0000000..90474a1 --- /dev/null +++ b/view/admin/admin/index.html @@ -0,0 +1,80 @@ + + + + + + + + 应用管理 + {include file="common/_require"} + + + + +
+ {include file="common/_header"} + + {include file="common/left_admin_manage"} + +
+ +
+ +
+ +
+ + + + + + + + + + + + + {volist name='$list' id='vo'} + + + + + + + + + + {/volist} + {if condition="count($list) eq 0" } + + + + {/if} + +
ID头像账号昵称分组操作
{$vo.id}{$vo.account}{$vo.nickname}{$vo.group} +
+ 编辑 +
+ 删除 +
+
+
暂无数据
+
+
+
+
+ + + {include file="common/_footer"} +
+ + + \ No newline at end of file diff --git a/view/admin/admin_group/create.html b/view/admin/admin_group/create.html new file mode 100644 index 0000000..e69de29 diff --git a/view/admin/admin_group/index.html b/view/admin/admin_group/index.html new file mode 100644 index 0000000..d04d249 --- /dev/null +++ b/view/admin/admin_group/index.html @@ -0,0 +1,59 @@ + + + + + + + 应用管理 + {include file="common/_require"} + + + +
+ {include file="common/_header"} + + {include file="common/left_admin_manage"} + +
+ +
+
+ + 首页 + 系统信息 + +
+
+
+ +
+
+ + + + + + + + + + + {if condition="count($list) eq 0" } + + + + {/if} + +
ID分组名称操作
暂无数据
+
+
+
+
+ + + {include file="common/_footer"} +
+ + \ No newline at end of file diff --git a/view/admin/admin_permission/index.html b/view/admin/admin_permission/index.html new file mode 100644 index 0000000..083b4a3 --- /dev/null +++ b/view/admin/admin_permission/index.html @@ -0,0 +1,120 @@ + + + + + + + + 应用管理 + {include file="common/_require"} + + + + +
+ {include file="common/_header"} + + {include file="common/left_admin_manage"} + +
+ +
+
+ + 首页 + 系统信息 + +
+
+
+
+
添加权限
+
+
+
+ + + + + + + + + + + {volist name='list' id='vo'} + + + + + + + + {/volist} + {if condition="count($list) eq 0" } + + + + {/if} + +
ID权限名称权限URL操作
{$vo.id} + {$vo.name} +
设置
+
+ {$vo.app}/{$vo.controller}/{$vo.action} +
设置
+
+
+
删除
+
+
暂无数据
+
+
+
+
+ + + {include file="common/_footer"} + + +
+ + + \ No newline at end of file diff --git a/view/admin/common/_header.html b/view/admin/common/_header.html index 8467850..758fe4a 100644 --- a/view/admin/common/_header.html +++ b/view/admin/common/_header.html @@ -5,6 +5,7 @@
  • 首页
  • 用户管理
  • 文件管理
  • +
  • 管理员管理
  • 系统设置