From aa14f1e2c140967d12968302d2b1cab078cff23b Mon Sep 17 00:00:00 2001 From: zhaoxiang Date: Tue, 13 Oct 2020 17:31:18 +0800 Subject: [PATCH] =?UTF-8?q?modified=20=E6=B7=BB=E5=8A=A0=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E5=BA=93=E8=BF=81=E7=A7=BB=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 3 +- composer.lock | 58 +- .../migrations/20190425073802_admin_app.php | 85 +++ .../20190425094427_admin_app_group.php | 61 ++ .../20190508070533_admin_auth_group.php | 56 ++ ...20190508100337_admin_auth_group_access.php | 54 ++ .../20190508101122_admin_auth_rule.php | 64 ++ .../20190508152801_admin_fields.php | 88 +++ .../migrations/20190508153800_admin_group.php | 81 ++ .../migrations/20190513065521_admin_list.php | 88 +++ .../migrations/20190513070628_admin_menu.php | 82 ++ .../migrations/20190513081034_admin_user.php | 84 ++ .../20190513082503_admin_user_action.php | 71 ++ .../20190513085755_admin_user_data.php | 67 ++ .../20190513155519_ini_admin_menu.php | 718 ++++++++++++++++++ .../20190514034923_ini_admin_group.php | 47 ++ .../20190515031308_ini_admin_user.php | 53 ++ .../20200318084219_add_admin_list_field.php | 39 + ...20200318085203_change_admin_menu_field.php | 67 ++ .../20200324080953_update_admin_menu_data.php | 57 ++ .../20200614170824_change_menu_fid.php | 30 + 21 files changed, 1951 insertions(+), 2 deletions(-) create mode 100644 database/migrations/20190425073802_admin_app.php create mode 100644 database/migrations/20190425094427_admin_app_group.php create mode 100644 database/migrations/20190508070533_admin_auth_group.php create mode 100644 database/migrations/20190508100337_admin_auth_group_access.php create mode 100644 database/migrations/20190508101122_admin_auth_rule.php create mode 100644 database/migrations/20190508152801_admin_fields.php create mode 100644 database/migrations/20190508153800_admin_group.php create mode 100644 database/migrations/20190513065521_admin_list.php create mode 100644 database/migrations/20190513070628_admin_menu.php create mode 100644 database/migrations/20190513081034_admin_user.php create mode 100644 database/migrations/20190513082503_admin_user_action.php create mode 100644 database/migrations/20190513085755_admin_user_data.php create mode 100644 database/migrations/20190513155519_ini_admin_menu.php create mode 100644 database/migrations/20190514034923_ini_admin_group.php create mode 100644 database/migrations/20190515031308_ini_admin_user.php create mode 100644 database/migrations/20200318084219_add_admin_list_field.php create mode 100644 database/migrations/20200318085203_change_admin_menu_field.php create mode 100644 database/migrations/20200324080953_update_admin_menu_data.php create mode 100644 database/migrations/20200614170824_change_menu_fid.php diff --git a/composer.json b/composer.json index 3313d05..81f4842 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,8 @@ "require": { "php": ">=7.2.5", "topthink/framework": "^6.0", - "topthink/think-orm": "^2.0" + "topthink/think-orm": "^2.0", + "topthink/think-migration": "^3.0" }, "require-dev": { "symfony/var-dumper": "^4.2", diff --git a/composer.lock b/composer.lock index d25f052..9913cd6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d0bae3786336b8fb3f12db9ee5514cfc", + "content-hash": "58a42c05e879b20be89bd2a57fd4b31e", "packages": [ { "name": "league/flysystem", @@ -591,6 +591,62 @@ "description": "The ThinkPHP6 Helper Package", "time": "2019-11-08T08:01:10+00:00" }, + { + "name": "topthink/think-migration", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-migration.git", + "reference": "e8b3396505617732a57309d2818d70ffe187385c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-migration/zipball/e8b3396505617732a57309d2818d70ffe187385c", + "reference": "e8b3396505617732a57309d2818d70ffe187385c", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "topthink/framework": "^6.0.0", + "topthink/think-helper": "^3.0.3" + }, + "require-dev": { + "fzaninotto/faker": "^1.8" + }, + "suggest": { + "fzaninotto/faker": "Required to use the factory builder (^1.8)." + }, + "type": "library", + "extra": { + "think": { + "services": [ + "think\\migration\\Service" + ] + } + }, + "autoload": { + "psr-4": { + "Phinx\\": "phinx/src/Phinx", + "think\\migration\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ], + "time": "2019-06-17T10:13:39+00:00" + }, { "name": "topthink/think-orm", "version": "v2.0.33", diff --git a/database/migrations/20190425073802_admin_app.php b/database/migrations/20190425073802_admin_app.php new file mode 100644 index 0000000..e6ee033 --- /dev/null +++ b/database/migrations/20190425073802_admin_app.php @@ -0,0 +1,85 @@ +table('admin_app', [ + 'comment' => 'appId和appSecret表', + ])->setCollation('utf8mb4_general_ci'); + $table->addColumn('app_id', 'string', [ + 'limit' => 50, + 'default' => '', + 'comment' => '应用id' + ])->addColumn('app_secret', 'string', [ + 'limit' => 50, + 'default' => '', + 'comment' => '应用密码' + ])->addColumn('app_name', 'string', [ + 'limit' => 50, + 'default' => '', + 'comment' => '应用名称' + ])->addColumn('app_status', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 1, + 'comment' => '应用状态:0表示禁用,1表示启用' + ])->addColumn('app_info', 'text', [ + 'comment' => '应用说明', + 'null' => true + ])->addColumn('app_api', 'text', [ + 'comment' => '当前应用允许请求的全部API接口', + 'null' => true + ])->addColumn('app_group', 'string', [ + 'limit' => 128, + 'default' => 'default', + 'comment' => '当前应用所属的应用组唯一标识' + ])->addColumn('app_add_time', 'integer', [ + 'limit' => 11, + 'default' => 0, + 'comment' => '应用创建时间' + ])->addColumn('app_api_show', 'text', [ + 'comment' => '前台样式显示所需数据格式', + 'null' => true + ])->addIndex(['app_id'], ['unique' => true])->create(); + } +} diff --git a/database/migrations/20190425094427_admin_app_group.php b/database/migrations/20190425094427_admin_app_group.php new file mode 100644 index 0000000..fc51393 --- /dev/null +++ b/database/migrations/20190425094427_admin_app_group.php @@ -0,0 +1,61 @@ +table('admin_app_group', [ + 'comment' => '应用组,目前只做管理使用,没有实际权限控制' + ])->setCollation('utf8mb4_general_ci'); + $table->addColumn('name', 'string', [ + 'limit' => 128, + 'default' => '', + 'comment' => '组名称' + ])->addColumn('description', 'text', [ + 'comment' => '组说明', + 'null' => true + ])->addColumn('status', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 1, + 'comment' => '组状态:0表示禁用,1表示启用' + ])->addColumn('hash', 'string', [ + 'limit' => 128, + 'default' => '', + 'comment' => '组标识' + ])->create(); + } +} diff --git a/database/migrations/20190508070533_admin_auth_group.php b/database/migrations/20190508070533_admin_auth_group.php new file mode 100644 index 0000000..0675744 --- /dev/null +++ b/database/migrations/20190508070533_admin_auth_group.php @@ -0,0 +1,56 @@ +table('admin_auth_group', [ + 'comment' => '权限组' + ])->setCollation('utf8mb4_general_ci'); + $table->addColumn('name', 'string', [ + 'limit' => 50, + 'default' => '', + 'comment' => '组名称' + ])->addColumn('description', 'text', [ + 'comment' => '组描述', + 'null' => true + ])->addColumn('status', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 1, + 'comment' => '组状态:为1正常,为0禁用' + ])->create(); + } +} diff --git a/database/migrations/20190508100337_admin_auth_group_access.php b/database/migrations/20190508100337_admin_auth_group_access.php new file mode 100644 index 0000000..f9eb42f --- /dev/null +++ b/database/migrations/20190508100337_admin_auth_group_access.php @@ -0,0 +1,54 @@ +table('admin_auth_group_access', [ + 'comment' => '用户和组的对应关系' + ])->setCollation('utf8mb4_general_ci'); + $table->addColumn('uid', 'integer', [ + 'limit' => 11, + 'default' => 0, + 'signed' => false, + 'comment' => '' + ])->addColumn('group_id', 'string', [ + 'limit' => 255, + 'default' => '', + 'comment' => '' + ])->addIndex(['uid'])->addIndex(['group_id'])->create(); + } +} diff --git a/database/migrations/20190508101122_admin_auth_rule.php b/database/migrations/20190508101122_admin_auth_rule.php new file mode 100644 index 0000000..f3b1599 --- /dev/null +++ b/database/migrations/20190508101122_admin_auth_rule.php @@ -0,0 +1,64 @@ +table('admin_auth_rule', [ + 'comment' => '权限细节' + ])->setCollation('utf8mb4_general_ci'); + $table->addColumn('url', 'string', [ + 'limit' => 80, + 'default' => '', + 'comment' => '规则唯一标识' + ])->addColumn('group_id', 'integer', [ + 'limit' => 11, + 'default' => 0, + 'signed' => false, + 'comment' => '权限所属组的ID' + ])->addColumn('auth', 'integer', [ + 'limit' => 11, + 'default' => 0, + 'signed' => false, + 'comment' => '权限数值' + ])->addColumn('status', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 1, + 'comment' => '状态:为1正常,为0禁用' + ])->create(); + } +} diff --git a/database/migrations/20190508152801_admin_fields.php b/database/migrations/20190508152801_admin_fields.php new file mode 100644 index 0000000..dcd350a --- /dev/null +++ b/database/migrations/20190508152801_admin_fields.php @@ -0,0 +1,88 @@ +table('admin_fields', [ + 'comment' => '用于保存各个API的字段规则' + ])->setCollation('utf8mb4_general_ci'); + $table->addColumn('field_name', 'string', [ + 'limit' => 50, + 'default' => '', + 'comment' => '字段名称' + ])->addColumn('hash', 'string', [ + 'limit' => 50, + 'default' => '', + 'comment' => '权限所属组的ID' + ])->addColumn('data_type', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 0, + 'comment' => '数据类型,来源于DataType类库' + ])->addColumn('default', 'string', [ + 'limit' => 500, + 'default' => '', + 'comment' => '默认值' + ])->addColumn('is_must', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 0, + 'comment' => '是否必须 0为不必须,1为必须' + ])->addColumn('range', 'string', [ + 'limit' => 500, + 'default' => '', + 'comment' => '范围,Json字符串,根据数据类型有不一样的含义' + ])->addColumn('info', 'string', [ + 'limit' => 500, + 'default' => '', + 'comment' => '字段说明' + ])->addColumn('type', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 0, + 'comment' => '字段用处:0为request,1为response' + ])->addColumn('show_name', 'string', [ + 'limit' => 50, + 'default' => '', + 'comment' => 'wiki显示用字段' + ])->addIndex(['hash'])->create(); + } +} diff --git a/database/migrations/20190508153800_admin_group.php b/database/migrations/20190508153800_admin_group.php new file mode 100644 index 0000000..aad6e8e --- /dev/null +++ b/database/migrations/20190508153800_admin_group.php @@ -0,0 +1,81 @@ +table('admin_group', [ + 'comment' => '接口组管理' + ])->setCollation('utf8mb4_general_ci'); + $table->addColumn('name', 'string', [ + 'limit' => 128, + 'default' => '', + 'comment' => '组名称' + ])->addColumn('description', 'text', [ + 'comment' => '组说明', + 'null' => true + ])->addColumn('status', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 1, + 'comment' => '状态:为1正常,为0禁用' + ])->addColumn('hash', 'string', [ + 'limit' => 128, + 'default' => '', + 'comment' => '组标识' + ])->addColumn('create_time', 'integer', [ + 'limit' => 11, + 'default' => 0, + 'comment' => '创建时间' + ])->addColumn('update_time', 'integer', [ + 'limit' => 11, + 'default' => 0, + 'comment' => '修改时间' + ])->addColumn('image', 'string', [ + 'limit' => 256, + 'null' => true, + 'comment' => '分组封面图' + ])->addColumn('hot', 'integer', [ + 'limit' => 11, + 'default' => 0, + 'comment' => '分组热度' + ])->create(); + } +} diff --git a/database/migrations/20190513065521_admin_list.php b/database/migrations/20190513065521_admin_list.php new file mode 100644 index 0000000..35aeb08 --- /dev/null +++ b/database/migrations/20190513065521_admin_list.php @@ -0,0 +1,88 @@ +table('admin_list', [ + 'comment' => '用于维护接口信息' + ])->setCollation('utf8mb4_general_ci'); + $table->addColumn('api_class', 'string', [ + 'limit' => 50, + 'default' => '', + 'comment' => 'api索引,保存了类和方法' + ])->addColumn('hash', 'string', [ + 'limit' => 50, + 'default' => '', + 'comment' => 'api唯一标识' + ])->addColumn('access_token', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 1, + 'comment' => '认证方式 1:复杂认证,0:简易认证' + ])->addColumn('status', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 1, + 'comment' => 'API状态:0表示禁用,1表示启用' + ])->addColumn('method', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 2, + 'comment' => '请求方式0:不限1:Post,2:Get' + ])->addColumn('info', 'string', [ + 'limit' => 500, + 'default' => '', + 'comment' => 'api中文说明' + ])->addColumn('is_test', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 0, + 'comment' => '是否是测试模式:0:生产模式,1:测试模式' + ])->addColumn('return_str', 'text', [ + 'null' => true, + 'comment' => '返回数据示例' + ])->addColumn('group_hash', 'string', [ + 'limit' => 64, + 'default' => 'default', + 'comment' => '当前接口所属的接口分组' + ])->addIndex(['hash'])->create(); + } +} diff --git a/database/migrations/20190513070628_admin_menu.php b/database/migrations/20190513070628_admin_menu.php new file mode 100644 index 0000000..2972d72 --- /dev/null +++ b/database/migrations/20190513070628_admin_menu.php @@ -0,0 +1,82 @@ +table('admin_menu', [ + 'comment' => '目录信息' + ])->setCollation('utf8mb4_general_ci'); + $table->addColumn('name', 'string', [ + 'limit' => 50, + 'default' => '', + 'comment' => '菜单名' + ])->addColumn('fid', 'integer', [ + 'limit' => 11, + 'default' => 0, + 'comment' => '父级菜单ID' + ])->addColumn('url', 'string', [ + 'limit' => 50, + 'default' => '', + 'comment' => '链接' + ])->addColumn('auth', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 0, + 'comment' => '访客权限' + ])->addColumn('sort', 'integer', [ + 'limit' => 11, + 'default' => 0, + 'comment' => '排序' + ])->addColumn('hide', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 0, + 'comment' => '是否显示' + ])->addColumn('icon', 'string', [ + 'limit' => 50, + 'default' => '', + 'comment' => '菜单图标' + ])->addColumn('level', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 0, + 'comment' => '菜单认证等级' + ])->create(); + } +} diff --git a/database/migrations/20190513081034_admin_user.php b/database/migrations/20190513081034_admin_user.php new file mode 100644 index 0000000..47e4ee5 --- /dev/null +++ b/database/migrations/20190513081034_admin_user.php @@ -0,0 +1,84 @@ +table('admin_user', [ + 'comment' => '管理员认证信息' + ])->setCollation('utf8mb4_general_ci'); + $table->addColumn('username', 'string', [ + 'limit' => 64, + 'default' => '', + 'comment' => '用户名' + ])->addColumn('nickname', 'string', [ + 'limit' => 64, + 'default' => '', + 'comment' => '用户昵称' + ])->addColumn('password', 'char', [ + 'limit' => 32, + 'default' => '', + 'comment' => '用户密码' + ])->addColumn('create_time', 'integer', [ + 'limit' => 11, + 'default' => 0, + 'comment' => '注册时间' + ])->addColumn('create_ip', 'integer', [ + 'limit' => MysqlAdapter::INT_BIG, + 'default' => 0, + 'comment' => '注册IP' + ])->addColumn('update_time', 'integer', [ + 'limit' => 11, + 'default' => 0, + 'comment' => '更新时间' + ])->addColumn('status', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 0, + 'comment' => '账号状态 0封号 1正常' + ])->addColumn('openid', 'string', [ + 'limit' => 100, + 'null' => true, + 'default' => '', + 'comment' => '三方登录唯一ID' + ])->addIndex(['create_time'])->create(); + } +} diff --git a/database/migrations/20190513082503_admin_user_action.php b/database/migrations/20190513082503_admin_user_action.php new file mode 100644 index 0000000..faefe24 --- /dev/null +++ b/database/migrations/20190513082503_admin_user_action.php @@ -0,0 +1,71 @@ +table('admin_user_action', [ + 'comment' => '用户操作日志' + ])->setCollation('utf8mb4_general_ci'); + $table->addColumn('action_name', 'string', [ + 'limit' => 50, + 'default' => '', + 'comment' => '行为名称' + ])->addColumn('uid', 'integer', [ + 'limit' => 11, + 'default' => 0, + 'comment' => '操作用户ID' + ])->addColumn('nickname', 'string', [ + 'limit' => 50, + 'default' => '', + 'comment' => '用户昵称' + ])->addColumn('add_time', 'integer', [ + 'limit' => 11, + 'default' => 0, + 'comment' => '操作时间' + ])->addColumn('data', 'text', [ + 'null' => true, + 'comment' => '用户提交的数据' + ])->addColumn('url', 'string', [ + 'limit' => 200, + 'default' => 0, + 'comment' => '操作URL' + ])->addIndex(['uid'])->create(); + } +} diff --git a/database/migrations/20190513085755_admin_user_data.php b/database/migrations/20190513085755_admin_user_data.php new file mode 100644 index 0000000..598ac35 --- /dev/null +++ b/database/migrations/20190513085755_admin_user_data.php @@ -0,0 +1,67 @@ +table('admin_user_data', [ + 'comment' => '管理员数据表' + ])->setCollation('utf8mb4_general_ci'); + $table->addColumn('login_times', 'integer', [ + 'limit' => 11, + 'default' => 0, + 'comment' => '账号登录次数' + ])->addColumn('last_login_ip', 'integer', [ + 'limit' => MysqlAdapter::INT_BIG, + 'default' => 0, + 'comment' => '最后登录IP' + ])->addColumn('last_login_time', 'integer', [ + 'limit' => 11, + 'default' => 0, + 'comment' => '最后登录时间' + ])->addColumn('uid', 'integer', [ + 'limit' => 11, + 'default' => 0, + 'comment' => '用户ID' + ])->addColumn('head_img', 'text', [ + 'null' => true, + 'comment' => '用户头像' + ])->addIndex(['uid'])->create(); + } +} diff --git a/database/migrations/20190513155519_ini_admin_menu.php b/database/migrations/20190513155519_ini_admin_menu.php new file mode 100644 index 0000000..8571667 --- /dev/null +++ b/database/migrations/20190513155519_ini_admin_menu.php @@ -0,0 +1,718 @@ + + */ + public function up() { + $data = [ + [ + 'id' => 1, + 'name' => '用户登录', + 'fid' => 0, + 'url' => 'admin/Login/index', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 2, + 'name' => '用户登出', + 'fid' => 0, + 'url' => 'admin/Login/logout', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 3, + 'name' => '系统管理', + 'fid' => 0, + 'url' => '', + 'auth' => 0, + 'sort' => 1, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 4, + 'name' => '菜单维护', + 'fid' => 3, + 'url' => '', + 'auth' => 0, + 'sort' => 1, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 5, + 'name' => '菜单状态修改', + 'fid' => 4, + 'url' => 'admin/Menu/changeStatus', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 6, + 'name' => '新增菜单', + 'fid' => 4, + 'url' => 'admin/Menu/add', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 7, + 'name' => '编辑菜单', + 'fid' => 4, + 'url' => 'admin/Menu/edit', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 8, + 'name' => '菜单删除', + 'fid' => 4, + 'url' => 'admin/Menu/del', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 9, + 'name' => '用户管理', + 'fid' => 3, + 'url' => '', + 'auth' => 0, + 'sort' => 2, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 10, + 'name' => '获取当前组的全部用户', + 'fid' => 9, + 'url' => 'admin/User/getUsers', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 11, + 'name' => '用户状态修改', + 'fid' => 9, + 'url' => 'admin/User/changeStatus', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 12, + 'name' => '新增用户', + 'fid' => 9, + 'url' => 'admin/User/add', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 13, + 'name' => '用户编辑', + 'fid' => 9, + 'url' => 'admin/User/edit', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 14, + 'name' => '用户删除', + 'fid' => 9, + 'url' => 'admin/User/del', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 15, + 'name' => '权限管理', + 'fid' => 3, + 'url' => '', + 'auth' => 0, + 'sort' => 3, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 16, + 'name' => '权限组状态编辑', + 'fid' => 15, + 'url' => 'admin/Auth/changeStatus', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 17, + 'name' => '从指定组中删除指定用户', + 'fid' => 15, + 'url' => 'admin/Auth/delMember', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 18, + 'name' => '新增权限组', + 'fid' => 15, + 'url' => 'admin/Auth/add', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 19, + 'name' => '权限组编辑', + 'fid' => 15, + 'url' => 'admin/Auth/edit', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 20, + 'name' => '删除权限组', + 'fid' => 15, + 'url' => 'admin/Auth/del', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 21, + 'name' => '获取全部已开放的可选组', + 'fid' => 15, + 'url' => 'admin/Auth/getGroups', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 22, + 'name' => '获取组所有的权限列表', + 'fid' => 15, + 'url' => 'admin/Auth/getRuleList', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 23, + 'name' => '应用接入', + 'fid' => 0, + 'url' => '', + 'auth' => 0, + 'sort' => 2, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 24, + 'name' => '应用管理', + 'fid' => 23, + 'url' => '', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 25, + 'name' => '应用状态编辑', + 'fid' => 24, + 'url' => 'admin/App/changeStatus', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 26, + 'name' => '获取AppId,AppSecret,接口列表,应用接口权限细节', + 'fid' => 24, + 'url' => 'admin/App/getAppInfo', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 27, + 'name' => '新增应用', + 'fid' => 24, + 'url' => 'admin/App/add', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 28, + 'name' => '编辑应用', + 'fid' => 24, + 'url' => 'admin/App/edit', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 29, + 'name' => '删除应用', + 'fid' => 24, + 'url' => 'admin/App/del', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 30, + 'name' => '接口管理', + 'fid' => 0, + 'url' => '', + 'auth' => 0, + 'sort' => 3, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 31, + 'name' => '接口维护', + 'fid' => 30, + 'url' => '', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 32, + 'name' => '接口状态编辑', + 'fid' => 31, + 'url' => 'admin/InterfaceList/changeStatus', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 33, + 'name' => '获取接口唯一标识', + 'fid' => 31, + 'url' => 'admin/InterfaceList/getHash', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 34, + 'name' => '添加接口', + 'fid' => 31, + 'url' => 'admin/InterfaceList/add', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 35, + 'name' => '编辑接口', + 'fid' => 31, + 'url' => 'admin/InterfaceList/edit', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 36, + 'name' => '删除接口', + 'fid' => 31, + 'url' => 'admin/InterfaceList/del', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 37, + 'name' => '获取接口请求字段', + 'fid' => 31, + 'url' => 'admin/Fields/request', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 38, + 'name' => '获取接口返回字段', + 'fid' => 31, + 'url' => 'admin/Fields/response', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 39, + 'name' => '添加接口字段', + 'fid' => 31, + 'url' => 'admin/Fields/add', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 40, + 'name' => '上传接口返回字段', + 'fid' => 31, + 'url' => 'admin/Fields/upload', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 41, + 'name' => '编辑接口字段', + 'fid' => 31, + 'url' => 'admin/Fields/edit', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 42, + 'name' => '删除接口字段', + 'fid' => 31, + 'url' => 'admin/Fields/del', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 43, + 'name' => '接口分组', + 'fid' => 30, + 'url' => '', + 'auth' => 0, + 'sort' => 1, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 44, + 'name' => '添加接口组', + 'fid' => 43, + 'url' => 'admin/InterfaceGroup/add', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 45, + 'name' => '编辑接口组', + 'fid' => 43, + 'url' => 'admin/InterfaceGroup/edit', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 46, + 'name' => '删除接口组', + 'fid' => 43, + 'url' => 'admin/InterfaceGroup/del', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 47, + 'name' => '获取全部有效的接口组', + 'fid' => 43, + 'url' => 'admin/InterfaceGroup/getAll', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 48, + 'name' => '接口组状态维护', + 'fid' => 43, + 'url' => 'admin/InterfaceGroup/changeStatus', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 49, + 'name' => '应用分组', + 'fid' => 23, + 'url' => '', + 'auth' => 0, + 'sort' => 1, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 50, + 'name' => '添加应用组', + 'fid' => 49, + 'url' => 'admin/AppGroup/add', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 51, + 'name' => '编辑应用组', + 'fid' => 49, + 'url' => 'admin/AppGroup/edit', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 52, + 'name' => '删除应用组', + 'fid' => 49, + 'url' => 'admin/AppGroup/del', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 53, + 'name' => '获取全部可用应用组', + 'fid' => 49, + 'url' => 'admin/AppGroup/getAll', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 54, + 'name' => '应用组状态编辑', + 'fid' => 49, + 'url' => 'admin/AppGroup/changeStatus', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 55, + 'name' => '菜单列表', + 'fid' => 4, + 'url' => 'admin/Menu/index', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 56, + 'name' => '用户列表', + 'fid' => 9, + 'url' => 'admin/User/index', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 57, + 'name' => '权限列表', + 'fid' => 15, + 'url' => 'admin/Auth/index', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 58, + 'name' => '应用列表', + 'fid' => 24, + 'url' => 'admin/App/index', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 59, + 'name' => '应用分组列表', + 'fid' => 49, + 'url' => 'admin/AppGroup/index', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 60, + 'name' => '接口列表', + 'fid' => 31, + 'url' => 'admin/InterfaceList/index', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 61, + 'name' => '接口分组列表', + 'fid' => 43, + 'url' => 'admin/InterfaceGroup/index', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 62, + 'name' => '日志管理', + 'fid' => 3, + 'url' => '', + 'auth' => 0, + 'sort' => 4, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 63, + 'name' => '获取操作日志列表', + 'fid' => 62, + 'url' => 'admin/Log/index', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 64, + 'name' => '删除单条日志记录', + 'fid' => 62, + 'url' => 'admin/Log/del', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 65, + 'name' => '刷新路由', + 'fid' => 31, + 'url' => 'admin/InterfaceList/refresh', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 67, + 'name' => '文件上传', + 'fid' => 0, + 'url' => 'admin/Index/upload', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 68, + 'name' => '更新个人信息', + 'fid' => 9, + 'url' => 'admin/User/own', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 69, + 'name' => '刷新AppSecret', + 'fid' => 24, + 'url' => 'admin/App/refreshAppSecret', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 70, + 'name' => '获取用户信息', + 'fid' => 9, + 'url' => 'admin/Login/getUserInfo', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ], [ + 'id' => 71, + 'name' => '编辑权限细节', + 'fid' => 15, + 'url' => 'admin/Auth/editRule', + 'auth' => 0, + 'sort' => 0, + 'hide' => 0, + 'icon' => '', + 'level' => 0 + ] + ]; + + $this->table('admin_menu')->insert($data)->saveData(); + } +} diff --git a/database/migrations/20190514034923_ini_admin_group.php b/database/migrations/20190514034923_ini_admin_group.php new file mode 100644 index 0000000..9f9bd5d --- /dev/null +++ b/database/migrations/20190514034923_ini_admin_group.php @@ -0,0 +1,47 @@ + '默认分组', + 'description' => '默认分组', + 'status' => 1, + 'hash' => 'default', + 'create_time' => time(), + 'update_time' => time(), + 'image' => '', + 'hot' => 0 + ]; + + $this->table('admin_group')->insert($data)->saveData(); + } +} diff --git a/database/migrations/20190515031308_ini_admin_user.php b/database/migrations/20190515031308_ini_admin_user.php new file mode 100644 index 0000000..5e23e32 --- /dev/null +++ b/database/migrations/20190515031308_ini_admin_user.php @@ -0,0 +1,53 @@ + 1, + 'username' => 'root', + 'nickname' => 'root', + 'password' => Tools::userMd5($pass, $authKey), + 'create_time' => time(), + 'create_ip' => ip2long('127.0.0.1'), + 'update_time' => time(), + 'status' => 1, + 'openid' => null + ]; + + $this->table('admin_user')->insert($data)->saveData(); + + $lockFile = Env::get('app_path') . 'install' . DIRECTORY_SEPARATOR . 'lock.ini'; + file_put_contents($lockFile, "username:root, password:{$pass}" . PHP_EOL); + } +} diff --git a/database/migrations/20200318084219_add_admin_list_field.php b/database/migrations/20200318084219_add_admin_list_field.php new file mode 100644 index 0000000..4d7cc44 --- /dev/null +++ b/database/migrations/20200318084219_add_admin_list_field.php @@ -0,0 +1,39 @@ +table('admin_list')->addColumn('hash_type', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 2, + 'comment' => '是否采用hash映射, 1:普通模式 2:加密模式' + ])->update(); + } + + public function down() { + $this->table('admin_list')->removeColumn('hash_type')->update(); + } +} diff --git a/database/migrations/20200318085203_change_admin_menu_field.php b/database/migrations/20200318085203_change_admin_menu_field.php new file mode 100644 index 0000000..4d88ec2 --- /dev/null +++ b/database/migrations/20200318085203_change_admin_menu_field.php @@ -0,0 +1,67 @@ +table('admin_menu') + ->renameColumn('hide', 'show') + ->renameColumn('name', 'title') + ->changeColumn('level', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 1, + 'comment' => '菜单层级,1-一级菜单,2-二级菜单,3-按钮' + ])->changeColumn('auth', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 1, + 'comment' => '是否需要登录才可以访问,1-需要,0-不需要' + ])->changeColumn('show', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 1, + 'comment' => '是否显示,1-显示,0-隐藏' + ])->addColumn('component', 'string', [ + 'limit' => 255, + 'default' => '', + 'comment' => '前端组件' + ])->addColumn('router', 'string', [ + 'limit' => 255, + 'default' => '', + 'comment' => '前端路由' + ])->addColumn('log', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 1, + 'comment' => '是否记录日志,1-记录,0-不记录' + ])->addColumn('permission', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 1, + 'comment' => '是否验证权限,1-鉴权,0-放行' + ])->addColumn('method', 'integer', [ + 'limit' => MysqlAdapter::INT_TINY, + 'default' => 1, + 'comment' => '请求方式,1-GET, 2-POST, 3-PUT, 4-DELETE' + ])->update(); + } + +} diff --git a/database/migrations/20200324080953_update_admin_menu_data.php b/database/migrations/20200324080953_update_admin_menu_data.php new file mode 100644 index 0000000..dc22225 --- /dev/null +++ b/database/migrations/20200324080953_update_admin_menu_data.php @@ -0,0 +1,57 @@ +execute('UPDATE `admin_menu` SET `show` = 2 WHERE `show` = 0;'); + $this->execute('UPDATE `admin_menu` SET `show` = 0 WHERE `show` = 1;'); + $this->execute('UPDATE `admin_menu` SET `show` = 1 WHERE `show` = 2;'); + $this->execute('UPDATE `admin_menu` SET `level` = 1 WHERE `fid` = 0;'); + $this->execute('UPDATE `admin_menu` SET `level` = 3 WHERE `url` != "";'); + $this->execute('UPDATE `admin_menu` SET `level` = 2 WHERE `level` = 0;'); + $this->execute('UPDATE `admin_menu` SET `auth` = 1 WHERE `url` != "admin/Login/index";'); + $this->execute('UPDATE `admin_menu` SET `method` = 2 WHERE `url` LIKE "%/upload" OR `url` LIKE "%/add" OR `url` LIKE "%/edit%";'); + $this->execute('UPDATE `admin_menu` SET `icon` = "ios-build", `component` = "", `router` = "/system" WHERE `id` = 3;'); + $this->execute('UPDATE `admin_menu` SET `icon` = "md-menu", `component` = "system/menu", `router` = "menu" WHERE `id` = 4;'); + $this->execute('UPDATE `admin_menu` SET `icon` = "ios-people", `component` = "system/user", `router` = "user" WHERE `id` = 9;'); + $this->execute('UPDATE `admin_menu` SET `icon` = "md-lock", `component` = "system/auth", `router` = "auth" WHERE `id` = 15;'); + $this->execute('UPDATE `admin_menu` SET `icon` = "ios-appstore", `component` = "", `router` = "/apps" WHERE `id` = 23;'); + $this->execute('UPDATE `admin_menu` SET `icon` = "md-list-box", `component` = "app/list", `router` = "appsList" WHERE `id` = 24;'); + $this->execute('UPDATE `admin_menu` SET `icon` = "ios-link", `component` = "", `router` = "/interface" WHERE `id` = 30;'); + $this->execute('UPDATE `admin_menu` SET `icon` = "md-infinite", `component` = "interface/list", `router` = "interfaceList" WHERE `id` = 31;'); + $this->execute('UPDATE `admin_menu` SET `icon` = "", `component` = "interface/request", `router` = "request/:hash" WHERE `id` = 37;'); + $this->execute('UPDATE `admin_menu` SET `icon` = "", `component` = "interface/response", `router` = "response/:hash" WHERE `id` = 38;'); + $this->execute('UPDATE `admin_menu` SET `icon` = "md-archive", `component` = "interface/group", `router` = "interfaceGroup" WHERE `id` = 43;'); + $this->execute('UPDATE `admin_menu` SET `icon` = "ios-archive", `component` = "app/group", `router` = "appsGroup" WHERE `id` = 49;'); + $this->execute('UPDATE `admin_menu` SET `icon` = "md-clipboard", `component` = "system/log", `router` = "log" WHERE `id` = 62;'); + $this->execute("INSERT INTO `admin_menu` (`id`, `title`, `fid`, `url`, `auth`, `sort`, `show`, `icon`, `level`, `component`, `router`, `log`, `permission`, `method`) VALUES (72, '获取用户有权限的菜单', 73, 'admin/Login/getAccessMenu', 1, 0, 0, '', 2, '', '', 0, 0, 1);"); + $this->execute("INSERT INTO `admin_menu` (`id`, `title`, `fid`, `url`, `auth`, `sort`, `show`, `icon`, `level`, `component`, `router`, `log`, `permission`, `method`) VALUES (73, '系统支撑', 0, '', 0, 0, 0, 'logo-tux', 1, '', '', 0, 0, 1);"); + $this->execute('UPDATE `admin_menu` SET `fid` = 73, `show` = 0, `level` = 2, `log` = 0, `permission` = 0, `method` = 2 WHERE `id` = 1;'); + $this->execute('UPDATE `admin_menu` SET `fid` = 73, `show` = 0, `level` = 2, `log` = 1, `permission` = 0, `method` = 1 WHERE `id` = 2;'); + $this->execute('UPDATE `admin_menu` SET `fid` = 73, `show` = 0, `level` = 2, `log` = 1, `permission` = 1, `method` = 2 WHERE `id` = 67;'); + $this->execute('UPDATE `admin_menu` SET `fid` = 73, `show` = 0, `level` = 2, `log` = 1, `permission` = 1, `method` = 2 WHERE `id` = 68;'); + $this->execute('UPDATE `admin_menu` SET `fid` = 73, `show` = 0, `level` = 2, `log` = 0, `permission` = 1, `method` = 1 WHERE `id` = 70;'); + } +} diff --git a/database/migrations/20200614170824_change_menu_fid.php b/database/migrations/20200614170824_change_menu_fid.php new file mode 100644 index 0000000..be8db9b --- /dev/null +++ b/database/migrations/20200614170824_change_menu_fid.php @@ -0,0 +1,30 @@ +execute('UPDATE `admin_menu` SET `fid` = 30 WHERE `id` = 37 OR `id` = 38;'); + } +}