diff --git a/application/admin/controller/Common.php b/application/admin/controller/Common.php index 998472762f3e74d365c6261d5c7d546921237049..494f1479ad426ef19443a8697085d3759ebc98ce 100755 --- a/application/admin/controller/Common.php +++ b/application/admin/controller/Common.php @@ -255,21 +255,21 @@ class Common extends Controller public function FormTableInit() { // 获取表格模型 - $module = FormModulePath($this->data_request); - if(!empty($module)) + $data = FormModulePath($this->data_request); + if(!empty($data)) { // 调用表格处理 - $res = (new FormHandleModule())->Run($module, $this->data_request); - if($res['code'] == 0) + $ret = (new FormHandleModule())->Run($data['module'], $data['action'], $this->data_request); + if($ret['code'] == 0) { - $this->form_table = $res['data']['table']; - $this->form_where = $res['data']['where']; - $this->form_params = $res['data']['params']; + $this->form_table = $ret['data']['table']; + $this->form_where = $ret['data']['where']; + $this->form_params = $ret['data']['params']; $this->assign('form_table', $this->form_table); $this->assign('form_params', $this->form_params); } else { - $this->form_error = $res['msg']; + $this->form_error = $ret['msg']; $this->assign('form_error', $this->form_error); } } diff --git a/application/admin/controller/Goods.php b/application/admin/controller/Goods.php index 40385afaf517f33f448b239aafa5893b077163f5..5a5d1d391a2f1389976022488a4886c3ecb77ddb 100755 --- a/application/admin/controller/Goods.php +++ b/application/admin/controller/Goods.php @@ -129,7 +129,10 @@ class Goods extends Common if(!empty($params['id'])) { // 条件 - $where = GoodsService::GetAdminIndexWhere($params); + $where = [ + ['is_delete_time', '=', 0], + ['id', '=', intval($params['id'])], + ]; // 获取数据 $data_params = [ diff --git a/application/admin/controller/Power.php b/application/admin/controller/Power.php index 39556dc621622a484088aa8e9510ac29d8315244..fa047b0f12513b9b2ff34ab19c70f818ffaa2eaf 100755 --- a/application/admin/controller/Power.php +++ b/application/admin/controller/Power.php @@ -10,11 +10,10 @@ // +---------------------------------------------------------------------- namespace app\admin\controller; -use think\facade\Hook; use app\service\AdminPowerService; /** - * 权限管理 + * 权限菜单管理 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -63,13 +62,13 @@ class Power extends Common } /** - * [PowerSave 权限添加/编辑] + * [Save 权限添加/编辑] * @author Devil * @blog http://gong.gg/ * @version 0.0.1 * @datetime 2016-12-13T21:41:03+0800 */ - public function PowerSave() + public function Save() { // 是否ajax if(!IS_AJAX) @@ -78,19 +77,19 @@ class Power extends Common } // 开始操作 - $params = input('post.'); + $params = $this->data_post; $params['admin'] = $this->admin; return AdminPowerService::PowerSave($params); } /** - * [PowerDelete 权限删除] + * [Delete 权限删除] * @author Devil * @blog http://gong.gg/ * @version 0.0.1 * @datetime 2016-12-14T21:40:29+0800 */ - public function PowerDelete() + public function Delete() { // 是否ajax if(!IS_AJAX) @@ -99,137 +98,9 @@ class Power extends Common } // 开始操作 - $params = input('post.'); + $params = $this->data_post; $params['admin'] = $this->admin; return AdminPowerService::PowerDelete($params); } - - /** - * [Role 角色组列表] - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-14T21:37:02+0800 - */ - public function Role() - { - $data_params = [ - 'field' => 'id,name,is_enable,add_time', - ]; - $data = AdminPowerService::RoleList($data_params); - - $this->assign('data_list', $data); - return $this->fetch(); - } - - /** - * [RoleSaveInfo 角色组添加/编辑页面] - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-14T21:37:02+0800 - */ - public function RoleSaveInfo() - { - // 参数 - $params = input(); - - // 角色组 - $data = []; - if(!empty($params['id'])) - { - $data_params = [ - 'where' => ['id'=>intval($params['id'])], - ]; - $ret = AdminPowerService::RoleList($data_params); - if(!empty($ret[0]['id'])) - { - $data = $ret[0]; - - // 权限关联数据 - $params['role_id'] = $ret[0]['id']; - } - } - - // 菜单列表 - $power = AdminPowerService::RolePowerEditData($params); - $this->assign('common_is_enable_list', lang('common_is_enable_list')); - $this->assign('power', $power); - - // 角色编辑页面钩子 - $hook_name = 'plugins_view_admin_power_role_save'; - $this->assign($hook_name.'_data', Hook::listen($hook_name, - [ - 'hook_name' => $hook_name, - 'is_backend' => true, - 'role_id' => isset($params['id']) ? $params['id'] : 0, - 'data' => &$data, - 'params' => &$params, - ])); - - // 数据 - $this->assign('data', $data); - $this->assign('params', $params); - return $this->fetch(); - } - - /** - * [RoleSave 角色组添加/编辑] - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-14T21:37:02+0800 - */ - public function RoleSave() - { - // 是否ajax请求 - if(!IS_AJAX) - { - $this->error('非法访问'); - } - - // 开始操作 - return AdminPowerService::RoleSave(input('post.')); - } - - /** - * [RoleDelete 角色删除] - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-15T11:03:30+0800 - */ - public function RoleDelete() - { - // 是否ajax请求 - if(!IS_AJAX) - { - $this->error('非法访问'); - } - - // 开始操作 - return AdminPowerService::RoleDelete(input('post.')); - } - - /** - * [RoleStatusUpdate 角色状态更新] - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2017-01-12T22:23:06+0800 - */ - public function RoleStatusUpdate() - { - // 是否ajax - if(!IS_AJAX) - { - return $this->error('非法访问'); - } - - // 开始操作 - $params = input('post.'); - $params['admin'] = $this->admin; - return AdminPowerService::RoleStatusUpdate($params); - } } ?> \ No newline at end of file diff --git a/application/admin/controller/Role.php b/application/admin/controller/Role.php new file mode 100644 index 0000000000000000000000000000000000000000..126d26f086e52949d624c223e04865d6d8a207fb --- /dev/null +++ b/application/admin/controller/Role.php @@ -0,0 +1,219 @@ +IsLogin(); + + // 权限校验 + $this->IsPower(); + } + + /** + * [Index 角色组列表] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-14T21:37:02+0800 + */ + public function Index() + { + // 总数 + $total = AdminRoleService::RoleTotal($this->form_where); + + // 分页 + $page_params = [ + 'number' => $this->page_size, + 'total' => $total, + 'where' => $this->data_request, + 'page' => $this->page, + 'url' => MyUrl('admin/role/index'), + ]; + $page = new \base\Page($page_params); + + // 获取数据列表 + $data_params = [ + 'where' => $this->form_where, + 'm' => $page->GetPageStarNumber(), + 'n' => $this->page_size, + ]; + $ret = AdminRoleService::RoleList($data_params); + + // 基础参数赋值 + $this->assign('params', $this->data_request); + $this->assign('page_html', $page->GetPageHtml()); + $this->assign('data_list', $ret['data']); + return $this->fetch(); + } + + /** + * 详情 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2019-08-05T08:21:54+0800 + */ + public function Detail() + { + if(!empty($this->data_request['id'])) + { + // 条件 + $where = [ + ['id', '=', intval($this->data_request['id'])], + ]; + + // 获取列表 + $data_params = [ + 'm' => 0, + 'n' => 1, + 'where' => $where, + ]; + $ret = AdminRoleService::RoleList($data_params); + $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; + $this->assign('data', $data); + } + return $this->fetch(); + } + + /** + * [SaveInfo 角色组添加/编辑页面] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-14T21:37:02+0800 + */ + public function SaveInfo() + { + // 参数 + $params = $this->data_request; + + // 角色组 + $data = []; + if(!empty($params['id'])) + { + $data_params = [ + 'where' => ['id'=>intval($params['id'])], + ]; + $ret = AdminRoleService::RoleList($data_params); + if(!empty($ret['data'][0]) && !empty($ret['data'][0]['id'])) + { + $data = $ret['data'][0]; + + // 权限关联数据 + $params['role_id'] = $ret['data'][0]['id']; + } + } + + // 菜单列表 + $power = AdminRoleService::RolePowerEditData($params); + $this->assign('power', $power); + + // 角色编辑页面钩子 + $hook_name = 'plugins_view_admin_role_save'; + $this->assign($hook_name.'_data', Hook::listen($hook_name, + [ + 'hook_name' => $hook_name, + 'is_backend' => true, + 'role_id' => isset($params['id']) ? $params['id'] : 0, + 'data' => &$data, + 'params' => &$params, + ])); + + // 数据 + $this->assign('data', $data); + $this->assign('params', $params); + return $this->fetch(); + } + + /** + * [Save 角色组添加/编辑] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-14T21:37:02+0800 + */ + public function Save() + { + // 是否ajax请求 + if(!IS_AJAX) + { + $this->error('非法访问'); + } + + // 开始操作 + return AdminRoleService::RoleSave($this->data_post); + } + + /** + * [Delete 角色删除] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-15T11:03:30+0800 + */ + public function Delete() + { + // 是否ajax请求 + if(!IS_AJAX) + { + $this->error('非法访问'); + } + + // 开始操作 + return AdminRoleService::RoleDelete($this->data_post); + } + + /** + * [StatusUpdate 角色状态更新] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-01-12T22:23:06+0800 + */ + public function StatusUpdate() + { + // 是否ajax + if(!IS_AJAX) + { + return $this->error('非法访问'); + } + + // 开始操作 + $params = $this->data_post; + $params['admin'] = $this->admin; + return AdminRoleService::RoleStatusUpdate($params); + } +} +?> \ No newline at end of file diff --git a/application/admin/form/Role.php b/application/admin/form/Role.php new file mode 100644 index 0000000000000000000000000000000000000000..7bf82a7225885fa6dbdbfa65f2884523658064af --- /dev/null +++ b/application/admin/form/Role.php @@ -0,0 +1,115 @@ + [ + 'key_field' => 'id', + 'status_field' => 'is_enable', + 'is_search' => 1, + 'search_url' => MyUrl('admin/role/index'), + 'is_delete' => 1, + 'delete_url' => MyUrl('admin/role/delete'), + 'delete_key' => 'ids', + 'detail_title' => '基础信息', + ], + // 表单配置 + 'form' => [ + [ + 'view_type' => 'checkbox', + 'is_checked' => 0, + 'checked_text' => '反选', + 'not_checked_text' => '全选', + 'align' => 'center', + 'not_show_data' => [1], + 'not_show_key' => 'id', + 'width' => 80, + ], + [ + 'label' => '角色名称', + 'view_type' => 'field', + 'view_key' => 'name', + 'search_config' => [ + 'form_type' => 'input', + 'where_type' => 'like', + ], + ], + [ + 'label' => '状态', + 'view_type' => 'status', + 'view_key' => 'is_enable', + 'post_url' => MyUrl('admin/role/statusupdate'), + 'is_form_su' => 1, + 'align' => 'center', + 'search_config' => [ + 'form_type' => 'select', + 'where_type' => 'in', + 'data' => lang('common_is_text_list'), + 'data_key' => 'id', + 'data_name' => 'name', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '创建时间', + 'view_type' => 'field', + 'view_key' => 'add_time', + 'search_config' => [ + 'form_type' => 'datetime', + ], + ], + [ + 'label' => '更新时间', + 'view_type' => 'field', + 'view_key' => 'upd_time', + 'search_config' => [ + 'form_type' => 'datetime', + ], + ], + [ + 'label' => '操作', + 'view_type' => 'operate', + 'view_key' => 'role/module/operate', + 'align' => 'center', + 'fixed' => 'right', + ], + ], + ]; + } +} +?> \ No newline at end of file diff --git a/application/admin/view/default/power/index.html b/application/admin/view/default/power/index.html index 8398c71cd02d41357e13ca6ec63d85beaa10fde2..5e38719d820035c639511f8d4c94ee9b0424e187 100755 --- a/application/admin/view/default/power/index.html +++ b/application/admin/view/default/power/index.html @@ -18,7 +18,7 @@