diff --git a/application/admin/controller/Admin.php b/application/admin/controller/Admin.php index 91d7d1064..bed8d9b55 100755 --- a/application/admin/controller/Admin.php +++ b/application/admin/controller/Admin.php @@ -50,48 +50,31 @@ class Admin extends Common // 权限校验 $this->IsPower(); - // 参数 - $params = input(); - - // 条件 - $where = AdminService::AdminListWhere($params); - // 总数 - $total = AdminService::AdminTotal($where); + $total = AdminService::AdminTotal($this->form_where); // 分页 - $number = MyC('admin_page_number', 10, true); - $page_params = array( - 'number' => $number, - 'total' => $total, - 'where' => $params, - 'page' => isset($params['page']) ? intval($params['page']) : 1, - 'url' => MyUrl('admin/admin/index'), - ); + $page_params = [ + 'number' => $this->page_size, + 'total' => $total, + 'where' => $this->data_request, + 'page' => $this->page, + 'url' => MyUrl('admin/admin/index'), + ]; $page = new \base\Page($page_params); - $this->assign('page_html', $page->GetPageHtml()); - // 获取管理员列表 + // 获取数据列表 $data_params = [ - 'where' => $where, - 'm' => $page->GetPageStarNumber(), - 'n' => $number, - ]; - $data = AdminService::AdminList($data_params); - $this->assign('data_list', $data['data']); - - // 角色 - $role_params = [ - 'where' => ['is_enable'=>1], - 'field' => 'id,name', - ]; - $role = AdminService::RoleList($role_params); - $this->assign('role_list', $role['data']); + 'where' => $this->form_where, + 'm' => $page->GetPageStarNumber(), + 'n' => $this->page_size, + ]; + $ret = AdminService::AdminList($data_params); - // 性别 - $this->assign('common_gender_list', lang('common_gender_list')); - - $this->assign('params', $params); + // 基础参数赋值 + $this->assign('params', $this->data_request); + $this->assign('page_html', $page->GetPageHtml()); + $this->assign('data_list', $ret['data']); return $this->fetch(); } @@ -108,7 +91,7 @@ class Admin extends Common $this->IsLogin(); // 参数 - $params = input(); + $params = $this->data_request; // 不是操作自己的情况下 if(!isset($params['id']) || $params['id'] != $this->admin['id']) @@ -144,6 +127,7 @@ class Admin extends Common $this->assign('id', isset($params['id']) ? $params['id'] : 0); $this->assign('common_gender_list', lang('common_gender_list')); + $this->assign('common_admin_status_list', lang('common_admin_status_list')); // 管理员编辑页面钩子 $hook_name = 'plugins_view_admin_admin_save'; @@ -181,7 +165,7 @@ class Admin extends Common $this->IsLogin(); // 参数 - $params = input('post.'); + $params = $this->data_post; // 不是操作自己的情况下 if(!isset($params['id']) || $params['id'] != $this->admin['id']) @@ -217,7 +201,7 @@ class Admin extends Common $this->IsPower(); // 开始操作 - $params = input('post.'); + $params = $this->data_post; $params['admin'] = $this->admin; return AdminService::AdminDelete($params); } @@ -264,7 +248,7 @@ class Admin extends Common } // 开始操作 - $params = input('post.'); + $params = $this->data_post; return AdminService::Login($params); } diff --git a/application/admin/controller/Goods.php b/application/admin/controller/Goods.php index b3145cd0f..d2953a814 100755 --- a/application/admin/controller/Goods.php +++ b/application/admin/controller/Goods.php @@ -74,6 +74,7 @@ class Goods extends Common ]; $ret = GoodsService::GoodsList($data_params); + // 基础参数赋值 $this->assign('params', $this->data_request); $this->assign('page_html', $page->GetPageHtml()); $this->assign('data_list', $ret['data']); diff --git a/application/admin/controller/Goodscomments.php b/application/admin/controller/Goodscomments.php index 35bddb97d..e9bedde60 100644 --- a/application/admin/controller/Goodscomments.php +++ b/application/admin/controller/Goodscomments.php @@ -71,6 +71,7 @@ class Goodscomments extends Common ]; $ret = GoodsCommentsService::GoodsCommentsList($data_params); + // 基础参数赋值 $this->assign('params', $this->data_request); $this->assign('page_html', $page->GetPageHtml()); $this->assign('data_list', $ret['data']); diff --git a/application/admin/controller/Order.php b/application/admin/controller/Order.php index 338b65315..d2762d101 100755 --- a/application/admin/controller/Order.php +++ b/application/admin/controller/Order.php @@ -80,7 +80,7 @@ class Order extends Common ]; $this->assign('buy_payment_list', PaymentService::BuyPaymentList($pay_where)); - // 参数 + // 基础参数赋值 $this->assign('params', $this->data_request); $this->assign('page_html', $page->GetPageHtml()); $this->assign('data_list', $ret['data']); diff --git a/application/admin/controller/Orderaftersale.php b/application/admin/controller/Orderaftersale.php index 42b73df9e..a0804ffcb 100644 --- a/application/admin/controller/Orderaftersale.php +++ b/application/admin/controller/Orderaftersale.php @@ -77,7 +77,7 @@ class Orderaftersale extends Common // 静态数据 $this->assign('common_order_aftersale_refundment_list', lang('common_order_aftersale_refundment_list')); - // 参数 + // 基础参数赋值 $this->assign('params', $this->data_request); $this->assign('page_html', $page->GetPageHtml()); $this->assign('data_list', $ret['data']); diff --git a/application/admin/controller/User.php b/application/admin/controller/User.php index a2b28b88f..17e8907da 100755 --- a/application/admin/controller/User.php +++ b/application/admin/controller/User.php @@ -75,6 +75,7 @@ class User extends Common // Excel地址 $this->assign('excel_url', MyUrl('admin/user/excelexport', $this->data_request)); + // 基础参数赋值 $this->assign('params', $this->data_request); $this->assign('page_html', $page->GetPageHtml()); $this->assign('data_list', $ret['data']); diff --git a/application/admin/form/Admin.php b/application/admin/form/Admin.php new file mode 100644 index 000000000..98206564c --- /dev/null +++ b/application/admin/form/Admin.php @@ -0,0 +1,185 @@ + [ + 'key_field' => 'id', + 'status_field' => 'status', + 'is_search' => 1, + 'search_url' => MyUrl('admin/admin/index'), + 'is_delete' => 1, + 'delete_url' => MyUrl('admin/admin/delete'), + 'delete_key' => 'ids', + ], + // 表单配置 + 'form' => [ + [ + 'view_type' => 'checkbox', + 'is_checked' => 0, + 'checked_text' => '反选', + 'not_checked_text' => '全选', + 'align' => 'center', + 'width' => 80, + 'is_not_show' => 1, + 'not_data' => [1], + 'not_key' => 'id', + ], + [ + 'label' => '管理员', + 'view_type' => 'field', + 'view_key' => 'username', + 'search_config' => [ + 'form_type' => 'input', + 'where_type' => 'like', + ], + ], + [ + 'label' => '状态', + 'view_type' => 'field', + 'view_key' => 'status_text', + 'search_config' => [ + 'form_type' => 'select', + 'form_name' => 'status', + 'where_type' => 'in', + 'data' => lang('common_admin_status_list'), + 'data_key' => 'value', + 'data_name' => 'name', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '性别', + 'view_type' => 'field', + 'view_key' => 'gender_text', + 'search_config' => [ + 'form_type' => 'select', + 'form_name' => 'gender', + 'where_type' => 'in', + 'data' => lang('common_gender_list'), + 'data_key' => 'id', + 'data_name' => 'name', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '手机', + 'view_type' => 'field', + 'view_key' => 'mobile', + 'search_config' => [ + 'form_type' => 'input', + 'where_type' => 'like', + ], + ], + [ + 'label' => '角色组', + 'view_type' => 'field', + 'view_key' => 'role_name', + 'search_config' => [ + 'form_type' => 'select', + 'form_name' => 'role_id', + 'where_type' => 'in', + 'data' => $this->GetRoleList(), + 'data_key' => 'id', + 'data_name' => 'name', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '登录次数', + 'view_type' => 'field', + 'view_key' => 'login_total', + 'search_config' => [ + 'form_type' => 'section', + ], + ], + [ + 'label' => '最后登录时间', + 'view_type' => 'field', + 'view_key' => 'login_time', + 'search_config' => [ + 'form_type' => 'datetime', + ], + ], + [ + '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' => 'admin/module/operate', + 'align' => 'center', + 'fixed' => 'right', + ], + ], + ]; + } + + /** + * 获取角色组列表 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-06-11 + * @desc description + */ + public function GetRoleList() + { + // 角色 + $params = [ + 'where' => ['is_enable'=>1], + 'field' => 'id,name', + ]; + $res = AdminService::RoleList($params); + return $res['data']; + } +} +?> \ No newline at end of file diff --git a/application/admin/view/default/admin/index.html b/application/admin/view/default/admin/index.html index bb06b984d..458775a2f 100755 --- a/application/admin/view/default/admin/index.html +++ b/application/admin/view/default/admin/index.html @@ -1,146 +1,9 @@ -{{include file="public/header" /}} + +{{extend name="public/module/form" /}} - -
-
- - - - - - -
- 新增 -
- - - -
- - - - - - - - - - - - - - - {{if !empty($data_list)}} - {{foreach $data_list as $v}} - - - - - - - - - - - {{/foreach}} - {{/if}} - -
管理员性别登录次数手机号码权限组最后登录时间创建时间操作
{{$v.username}}{{:lang('common_gender_list')[$v['gender']]['name']}}{{$v.login_total}}{{if empty($v['mobile'])}}未填写{{else /}}{{$v.mobile}}{{/if}}{{$v.role_name}} - {{if $v['login_total'] eq 0}} - 未登录 - {{else /}} - {{:date('Y-m-d H:i:s', $v['login_time'])}} - {{/if}} - {{:date('Y-m-d H:i:s', $v['add_time'])}} -
- {{if $v['id'] eq 1}} - 不可操作 - {{else /}} - - - 编辑 - - {{if $v['id'] neq $admin['id']}} - - {{/if}} - {{/if}} -
-
- {{if empty($data_list)}} -
没有相关数据
- {{/if}} -
- - - - {{if !empty($data_list)}} - {{$page_html|raw}} - {{/if}} - -
-
- - -{{include file="public/footer" /}} \ No newline at end of file + +{{block name="form_operate_top"}} + 新增 + + {__block__} +{{/block}} \ No newline at end of file diff --git a/application/admin/view/default/admin/module/operate.html b/application/admin/view/default/admin/module/operate.html new file mode 100644 index 000000000..a46fd5e10 --- /dev/null +++ b/application/admin/view/default/admin/module/operate.html @@ -0,0 +1,15 @@ + +{{if $module_data['id'] eq 1}} + 不可操作 +{{else /}} + + + 编辑 + + {{if $module_data['id'] neq $admin['id']}} + + {{/if}} +{{/if}} \ No newline at end of file diff --git a/application/admin/view/default/admin/save_info.html b/application/admin/view/default/admin/save_info.html index 1d1a6c859..97fb9653a 100755 --- a/application/admin/view/default/admin/save_info.html +++ b/application/admin/view/default/admin/save_info.html @@ -27,6 +27,8 @@ + {{include file="lib/gender" /}} + {{if !isset($data['id']) or $admin['id'] neq $data['id']}}
@@ -38,7 +40,15 @@
{{/if}} - {{include file="lib/gender" /}} + +
+ + +
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}} diff --git a/application/admin/view/default/goods/save_info.html b/application/admin/view/default/goods/save_info.html index f3c7e3dc5..ea3c25640 100755 --- a/application/admin/view/default/goods/save_info.html +++ b/application/admin/view/default/goods/save_info.html @@ -578,96 +578,113 @@ {{/if}} {{if !empty($v['element'])}} {{foreach $v.element as $element}} -
- - {{switch element.element}} - {{case input}} - {{if in_array($element['type'], ['radio', 'checkbox']) and !empty($element['element_data']) and is_array($element['element_data'])}} - {{foreach $element.element_data as $element_data_key=>$element_data}} -
+ {{else /}} +

element form-name 配置有误

+ {{/if}} {{/foreach}} {{/if}} diff --git a/application/api/controller/Plugins.php b/application/api/controller/Plugins.php index 71b475761..ee11e88a8 100644 --- a/application/api/controller/Plugins.php +++ b/application/api/controller/Plugins.php @@ -65,7 +65,7 @@ class Plugins extends Common 'error_msg' => '应用操作方法有误', ], ]; - $ret = ParamsChecked($this->data_request, $p); + $ret = ParamsChecked($params['data_request'], $p); if($ret !== true) { return DataReturn($ret, -5000); diff --git a/application/index/controller/Plugins.php b/application/index/controller/Plugins.php index 0803f3e6a..25e6e0f02 100755 --- a/application/index/controller/Plugins.php +++ b/application/index/controller/Plugins.php @@ -64,7 +64,7 @@ class Plugins extends Common 'error_msg' => '应用操作方法有误', ], ]; - $ret = ParamsChecked($params, $p); + $ret = ParamsChecked($params['data_request'], $p); if($ret !== true) { if(IS_AJAX) diff --git a/application/lang/zh-cn.php b/application/lang/zh-cn.php index baccf8f69..da1236527 100755 --- a/application/lang/zh-cn.php +++ b/application/lang/zh-cn.php @@ -350,6 +350,12 @@ return array( 4 => array('value' => 4, 'name' => '销售+自提', 'is_ext' => 1), ), + // 管理员状态 + 'common_admin_status_list' => array( + 0 => array('value' => 0, 'name' => '正常', 'checked' => true), + 1 => array('value' => 1, 'name' => '无效'), + ), + // 色彩值 'common_color_list' => array( diff --git a/application/service/AdminService.php b/application/service/AdminService.php index 88452fcd2..778defd6b 100755 --- a/application/service/AdminService.php +++ b/application/service/AdminService.php @@ -42,57 +42,32 @@ class AdminService $data = Db::name('Admin')->where($where)->field($field)->order($order_by)->limit($m, $n)->select(); if(!empty($data)) { + // 获取当前用户角色名称 + $roles = Db::name('Role')->where('id', 'in', array_column($data, 'role_id'))->column('name', 'id'); + + // 数据处理 + $common_gender_list = lang('common_gender_list'); + $common_admin_status_list = lang('common_admin_status_list'); foreach($data as &$v) { - $v['role_name'] = Db::name('Role')->where(['id'=>$v['role_id']])->value('name'); + // 所在角色组 + $v['role_name'] = isset($roles[$v['role_id']]) ? $roles[$v['role_id']] : ''; + + // 性别 + $v['gender_text'] = isset($common_gender_list[$v['gender']]) ? $common_gender_list[$v['gender']]['name'] : ''; + + // 状态 + $v['status_text'] = isset($common_admin_status_list[$v['status']]) ? $common_admin_status_list[$v['status']]['name'] : ''; + + // 时间 + $v['login_time'] = empty($v['login_time']) ? '' : date('Y-m-d H:i:s', $v['login_time']); + $v['add_time'] = empty($v['add_time']) ? '' : date('Y-m-d H:i:s', $v['add_time']); + $v['upd_time'] = empty($v['upd_time']) ? '' : date('Y-m-d H:i:s', $v['upd_time']); } } return DataReturn('处理成功', 0, $data); } - /** - * 管理员列表条件 - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-10T22:16:29+0800 - * @param [array] $params [输入参数] - */ - public static function AdminListWhere($params = []) - { - $where = []; - if(!empty($params['keywords'])) - { - $where[] = ['username|mobile', 'like', '%'.$params['keywords'].'%']; - } - - // 是否更多条件 - if(isset($params['is_more']) && $params['is_more'] == 1) - { - if(isset($params['role_id']) && $params['role_id'] > -1) - { - $where[] = ['role_id', '=', intval($params['role_id'])]; - } - - // 等值 - if(isset($params['gender']) && $params['gender'] > -1) - { - $where[] = ['gender', '=', intval($params['gender'])]; - } - - if(!empty($params['time_start'])) - { - $where[] = ['add_time', '>', strtotime($params['time_start'])]; - } - if(!empty($params['time_end'])) - { - $where[] = ['add_time', '<', strtotime($params['time_end'])]; - } - } - - return $where; - } - /** * 管理员总数 * @author Devil @@ -152,6 +127,12 @@ class AdminService 'checked_data' => [0,1,2], 'error_msg' => '性别值范围不正确', ], + [ + 'checked_type' => 'in', + 'key_name' => 'status', + 'checked_data' => array_column(lang('common_admin_status_list'), 'value'), + 'error_msg' => '状态值范围不正确', + ], ]; $ret = ParamsChecked($params, $p); if($ret !== true) @@ -221,6 +202,7 @@ class AdminService 'login_pwd' => LoginPwdEncryption($params['login_pwd'], $salt), 'mobile' => isset($params['mobile']) ? $params['mobile'] : '', 'gender' => intval($params['gender']), + 'status' => intval($params['status']), 'role_id' => intval($params['role_id']), 'add_time' => time(), ]; @@ -277,6 +259,7 @@ class AdminService $data = [ 'mobile' => isset($params['mobile']) ? $params['mobile'] : '', 'gender' => intval($params['gender']), + 'status' => intval($params['status']), 'upd_time' => time(), ]; @@ -316,26 +299,29 @@ class AdminService */ public static function AdminDelete($params = []) { - // 请求参数 - $p = [ - [ - 'checked_type' => 'empty', - 'key_name' => 'id', - 'error_msg' => '删除id有误', - ], - ]; - $ret = ParamsChecked($params, $p); - if($ret !== true) + // 参数是否有误 + if(empty($params['ids'])) { - return DataReturn($ret, -1); + return DataReturn('商品id有误', -1); + } + // 是否数组 + if(!is_array($params['ids'])) + { + $params['ids'] = explode(',', $params['ids']); + } + + // 是否包含删除超级管理员 + if(in_array(1, $params['ids'])) + { + return DataReturn('超级管理员不可删除', -1); } // 删除操作 - if(Db::name('Admin')->delete(intval($params['id']))) + if(Db::name('Admin')->where(['id'=>$params['ids']])->delete()) { return DataReturn('删除成功'); } - return DataReturn('删除失败或资源不存在', -100); + return DataReturn('删除失败', -100); } /** diff --git a/application/service/PluginsAdminService.php b/application/service/PluginsAdminService.php index 7ff722d49..f2bbd8865 100755 --- a/application/service/PluginsAdminService.php +++ b/application/service/PluginsAdminService.php @@ -557,6 +557,12 @@ use think\Controller; */ class Admin extends Controller { + // 构造方法 + public function __construct(\$params = []) + { + parent::__construct(); + } + // 后台管理入口 public function index(\$params = []) { @@ -621,6 +627,12 @@ use think\Controller; */ class Index extends Controller { + // 构造方法 + public function __construct(\$params = []) + { + parent::__construct(); + } + // 前端页面入口 public function index(\$params = []) { diff --git a/application/service/PluginsService.php b/application/service/PluginsService.php index 749127662..ebb031c7d 100755 --- a/application/service/PluginsService.php +++ b/application/service/PluginsService.php @@ -246,6 +246,12 @@ class PluginsService { return DataReturn('应用方法未定义['.$action.']', -1); } + + // 调用方法仅传递请求参数 + if(isset($params['data_request'])) + { + $params = $params['data_request']; + } return DataReturn('验证成功', 0, $obj->$action($params)); } } diff --git a/application/tags.php b/application/tags.php index 9dfb98a36..3afdb3bd3 100755 --- a/application/tags.php +++ b/application/tags.php @@ -32,21 +32,57 @@ return array ( 'log_write' => array ( ), + 'plugins_css' => + array ( + 0 => 'app\\plugins\\distribution\\Hook', + ), + 'plugins_service_users_center_left_menu_handle' => + array ( + 0 => 'app\\plugins\\distribution\\Hook', + ), + 'plugins_service_header_navigation_top_right_handle' => + array ( + 0 => 'app\\plugins\\distribution\\Hook', + ), 'plugins_service_order_status_change_history_success_handle' => array ( - 0 => 'app\\plugins\\neworderemail\\Hook', + 0 => 'app\\plugins\\distribution\\Hook', ), - 'plugins_service_order_pay_launch_handle' => + 'plugins_service_order_aftersale_audit_handle_end' => array ( - 0 => 'app\\plugins\\neworderemail\\Hook', + 0 => 'app\\plugins\\distribution\\Hook', ), - 'plugins_admin_js' => + 'plugins_service_site_extraction_address_list' => array ( - 0 => 'app\\plugins\\orderremind\\Hook', + 0 => 'app\\plugins\\distribution\\Hook', ), - 'plugins_admin_view_common_bottom' => + 'plugins_service_buy_order_insert_end' => array ( - 0 => 'app\\plugins\\orderremind\\Hook', + 0 => 'app\\plugins\\distribution\\Hook', + ), + 'plugins_service_goods_spec_extends_handle' => + array ( + 0 => 'app\\plugins\\distribution\\Hook', + ), + 'plugins_view_admin_user_save' => + array ( + 0 => 'app\\plugins\\distribution\\Hook', + ), + 'plugins_service_user_save_handle' => + array ( + 0 => 'app\\plugins\\distribution\\Hook', + ), + 'plugins_view_goods_detail_base_buy_nav_min_inside' => + array ( + 0 => 'app\\plugins\\distribution\\Hook', + ), + 'plugins_view_goods_detail_photo_within' => + array ( + 0 => 'app\\plugins\\distribution\\Hook', + ), + 'plugins_view_goods_detail_base_bottom' => + array ( + 0 => 'app\\plugins\\distribution\\Hook', ), ); ?> \ No newline at end of file diff --git a/public/static/index/default/css/common.css b/public/static/index/default/css/common.css index 800d0c988..0577bb4a5 100755 --- a/public/static/index/default/css/common.css +++ b/public/static/index/default/css/common.css @@ -133,7 +133,7 @@ color: #F5F5F2;font-size: 12px;cursor:pointer;border-radius:0px 0px; position: a .goods-category-s .category-content{ position:relative; width: 150px; float: left; z-index: 113;background:#fff; top: 45px;} .goods-category-s .category-content .all-goods { display: block; padding: 0; border-radius: 5px 5px 0 0; font-weight: 600; line-height: 36px;width:150px;height: 36px; padding: 0; border-radius: 5px 5px 0 0; color: #fff; text-align: center; font: 16px/36px "Microsoft YaHei";} .goods-category-s .category-content .all-goods em{ font: 12px/36px "Microsoft YaHei"; } - .category-content .category{width:150px; border-top: none; background: #2b2b2b;box-shadow: 8px 0 7px -3px rgba(0,0,0,.3); max-height: 360px; overflow-y: auto; overflow-x: hidden; } + .category-content .category{width:150px; border-top: none; background: #2b2b2b;box-shadow: 8px 0 7px -3px rgba(0,0,0,.3); } .category-content .down-ico{ position: absolute; top: 48px; left: 95px; width: 10px; height: 6px; background-position: 0 -131px; z-index: 11111; } .category-content .category-list li { height:36px; margin-top: -2px;z-index:113;border-top: 1px solid #333;border-bottom: 1px solid #252525} .category-content .category-list li.first{ margin-top: 0; } @@ -198,7 +198,7 @@ color: #F5F5F2;font-size: 12px;cursor:pointer;border-radius:0px 0px; position: a /* 分类 */ #goods-category .category-content{ position:relative; width: 180px; float: left; z-index: 113; top: 45px; } #goods-category .category-content .all-goods { width:180px; } - .category-content .category{ width:180px; max-height: 430px; } + .category-content .category{ width:180px; } .category-content .category-info { padding-left: 12px;width: 180px;overflow: hidden; } .category-content .menu-item { left: 179px; height: 430px; } .category-content .category-list li { height:43px; } diff --git a/thinkphp/library/think/Controller.php b/thinkphp/library/think/Controller.php index d16a1ed50..7c8d0acf5 100755 --- a/thinkphp/library/think/Controller.php +++ b/thinkphp/library/think/Controller.php @@ -58,7 +58,7 @@ class Controller * 构造方法 * @access public */ - public function __construct(App $app = null) + /*public function __construct(App $app = null) { $this->app = $app ?: Container::get('app'); $this->request = $this->app['request']; @@ -69,6 +69,35 @@ class Controller $this->registerMiddleware(); + // 前置操作方法 即将废弃 + foreach ((array) $this->beforeActionList as $method => $options) { + is_numeric($method) ? + $this->beforeAction($options) : + $this->beforeAction($method, $options); + } + }*/ + + /** + * 构造方法 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-06-11 + * @desc description + * @param [type] $app [description] + */ + public function __construct($app = null) + { + // 实例化控制器,构造方法参数可传非对象数据 + $this->app = is_object($app) ? $app : Container::get('app'); + $this->request = $this->app['request']; + $this->view = $this->app['view']; + + // 控制器初始化 + $this->initialize(); + + $this->registerMiddleware(); + // 前置操作方法 即将废弃 foreach ((array) $this->beforeActionList as $method => $options) { is_numeric($method) ?