From a23cf74b37d8b7c8779eeca853ba17785b6cad70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Wed, 16 Oct 2024 20:52:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=20Admin=20=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E5=AE=89=E8=A3=85=E5=8F=8A=E5=8D=87=E7=BA=A7=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../database/20221013031925_install_admin.php | 422 ------------------ .../20221013031926_install_admin_data.php | 97 ---- .../20221013031927_install_admin20230325.php | 39 -- .../20221013031928_install_admin20230621.php | 36 -- .../20241016000003_install_admin20241016.php | 333 ++++++++++++++ 5 files changed, 333 insertions(+), 594 deletions(-) delete mode 100644 plugin/think-plugs-admin/stc/database/20221013031925_install_admin.php delete mode 100644 plugin/think-plugs-admin/stc/database/20221013031926_install_admin_data.php delete mode 100644 plugin/think-plugs-admin/stc/database/20221013031927_install_admin20230325.php delete mode 100644 plugin/think-plugs-admin/stc/database/20221013031928_install_admin20230621.php create mode 100644 plugin/think-plugs-admin/stc/database/20241016000003_install_admin20241016.php diff --git a/plugin/think-plugs-admin/stc/database/20221013031925_install_admin.php b/plugin/think-plugs-admin/stc/database/20221013031925_install_admin.php deleted file mode 100644 index 7807493ac..000000000 --- a/plugin/think-plugs-admin/stc/database/20221013031925_install_admin.php +++ /dev/null @@ -1,422 +0,0 @@ -_create_system_auth(); - $this->_create_system_auth_node(); - $this->_create_system_base(); - $this->_create_system_config(); - $this->_create_system_data(); - $this->_create_system_file(); - $this->_create_system_menu(); - $this->_create_system_oplog(); - $this->_create_system_queue(); - $this->_create_system_user(); - } - - /** - * 创建数据对象 - * @class SystemAuth - * @table system_auth - * @return void - */ - private function _create_system_auth() - { - - // 当前数据表 - $table = 'system_auth'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-权限', - ]) - ->addColumn('title', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '权限名称']) - ->addColumn('utype', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '身份权限']) - ->addColumn('desc', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '备注说明']) - ->addColumn('sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '权限状态(1使用,0禁用)']) - ->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']) - ->addIndex('sort', ['name' => 'i73a781d61_sort']) - ->addIndex('title', ['name' => 'i73a781d61_title']) - ->addIndex('status', ['name' => 'i73a781d61_status']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class SystemAuthNode - * @table system_auth_node - * @return void - */ - private function _create_system_auth_node() - { - - // 当前数据表 - $table = 'system_auth_node'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-授权', - ]) - ->addColumn('auth', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '角色']) - ->addColumn('node', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '节点']) - ->addIndex('auth', ['name' => 'i4cd9aaff6_auth']) - ->addIndex('node', ['name' => 'i4cd9aaff6_node']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class SystemBase - * @table system_base - * @return void - */ - private function _create_system_base() - { - - // 当前数据表 - $table = 'system_base'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-字典', - ]) - ->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '数据类型']) - ->addColumn('code', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '数据代码']) - ->addColumn('name', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '数据名称']) - ->addColumn('content', 'text', ['default' => NULL, 'null' => true, 'comment' => '数据内容']) - ->addColumn('sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '数据状态(0禁用,1启动)']) - ->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0正常,1已删)']) - ->addColumn('deleted_at', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '删除时间']) - ->addColumn('deleted_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '删除用户']) - ->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']) - ->addIndex('type', ['name' => 'i2a29c450f_type']) - ->addIndex('code', ['name' => 'i2a29c450f_code']) - ->addIndex('name', ['name' => 'i2a29c450f_name']) - ->addIndex('sort', ['name' => 'i2a29c450f_sort']) - ->addIndex('status', ['name' => 'i2a29c450f_status']) - ->addIndex('deleted', ['name' => 'i2a29c450f_deleted']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class SystemConfig - * @table system_config - * @return void - */ - private function _create_system_config() - { - - // 当前数据表 - $table = 'system_config'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-配置', - ]) - ->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '配置分类']) - ->addColumn('name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '配置名称']) - ->addColumn('value', 'string', ['limit' => 2048, 'default' => '', 'null' => true, 'comment' => '配置内容']) - ->addIndex('type', ['name' => 'i48e345b98_type']) - ->addIndex('name', ['name' => 'i48e345b98_name']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class SystemData - * @table system_data - * @return void - */ - private function _create_system_data() - { - - // 当前数据表 - $table = 'system_data'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-数据', - ]) - ->addColumn('name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '配置名']) - ->addColumn('value', 'text', ['default' => NULL, 'null' => true, 'comment' => '配置值']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('name', ['name' => 'icbccedc16_name']) - ->addIndex('create_time', ['name' => 'icbccedc16_create_time']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class SystemFile - * @table system_file - * @return void - */ - private function _create_system_file() - { - - // 当前数据表 - $table = 'system_file'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-文件', - ]) - ->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '上传类型']) - ->addColumn('hash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '文件哈希']) - ->addColumn('tags', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '文件标签']) - ->addColumn('name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '文件名称']) - ->addColumn('xext', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '文件后缀']) - ->addColumn('xurl', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '访问链接']) - ->addColumn('xkey', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '文件路径']) - ->addColumn('mime', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '文件类型']) - ->addColumn('size', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '文件大小']) - ->addColumn('uuid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']) - ->addColumn('unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '会员编号']) - ->addColumn('isfast', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '是否秒传']) - ->addColumn('issafe', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '安全模式']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '上传状态(1悬空,2落地)']) - ->addColumn('create_at', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_at', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('type', ['name' => 'i738a363ca_type']) - ->addIndex('hash', ['name' => 'i738a363ca_hash']) - ->addIndex('uuid', ['name' => 'i738a363ca_uuid']) - ->addIndex('xext', ['name' => 'i738a363ca_xext']) - ->addIndex('unid', ['name' => 'i738a363ca_unid']) - ->addIndex('tags', ['name' => 'i738a363ca_tags']) - ->addIndex('name', ['name' => 'i738a363ca_name']) - ->addIndex('status', ['name' => 'i738a363ca_status']) - ->addIndex('issafe', ['name' => 'i738a363ca_issafe']) - ->addIndex('isfast', ['name' => 'i738a363ca_isfast']) - ->addIndex('create_at', ['name' => 'i738a363ca_create_at']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class SystemMenu - * @table system_menu - * @return void - */ - private function _create_system_menu() - { - - // 当前数据表 - $table = 'system_menu'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-菜单', - ]) - ->addColumn('pid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上级ID']) - ->addColumn('title', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '菜单名称']) - ->addColumn('icon', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '菜单图标']) - ->addColumn('node', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '节点代码']) - ->addColumn('url', 'string', ['limit' => 400, 'default' => '', 'null' => true, 'comment' => '链接节点']) - ->addColumn('params', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '链接参数']) - ->addColumn('target', 'string', ['limit' => 20, 'default' => '_self', 'null' => true, 'comment' => '打开方式']) - ->addColumn('sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '状态(0:禁用,1:启用)']) - ->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']) - ->addIndex('pid', ['name' => 'i29b9da675_pid']) - ->addIndex('sort', ['name' => 'i29b9da675_sort']) - ->addIndex('status', ['name' => 'i29b9da675_status']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class SystemOplog - * @table system_oplog - * @return void - */ - private function _create_system_oplog() - { - - // 当前数据表 - $table = 'system_oplog'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-日志', - ]) - ->addColumn('node', 'string', ['limit' => 200, 'default' => '', 'null' => false, 'comment' => '当前操作节点']) - ->addColumn('geoip', 'string', ['limit' => 15, 'default' => '', 'null' => false, 'comment' => '操作者IP地址']) - ->addColumn('action', 'string', ['limit' => 200, 'default' => '', 'null' => false, 'comment' => '操作行为名称']) - ->addColumn('content', 'string', ['limit' => 1024, 'default' => '', 'null' => false, 'comment' => '操作内容描述']) - ->addColumn('username', 'string', ['limit' => 50, 'default' => '', 'null' => false, 'comment' => '操作人用户名']) - ->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '创建时间']) - ->addIndex('create_at', ['name' => 'id7cb1c775_create_at']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class SystemQueue - * @table system_queue - * @return void - */ - private function _create_system_queue() - { - - // 当前数据表 - $table = 'system_queue'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-任务', - ]) - ->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'null' => false, 'comment' => '任务编号']) - ->addColumn('title', 'string', ['limit' => 100, 'default' => '', 'null' => false, 'comment' => '任务名称']) - ->addColumn('command', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '执行指令']) - ->addColumn('exec_pid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '执行进程']) - ->addColumn('exec_data', 'text', ['default' => NULL, 'null' => true, 'comment' => '执行参数']) - ->addColumn('exec_time', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '执行时间']) - ->addColumn('exec_desc', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '执行描述']) - ->addColumn('enter_time', 'decimal', ['precision' => 20, 'scale' => 4, 'default' => '0.0000', 'null' => true, 'comment' => '开始时间']) - ->addColumn('outer_time', 'decimal', ['precision' => 20, 'scale' => 4, 'default' => '0.0000', 'null' => true, 'comment' => '结束时间']) - ->addColumn('loops_time', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '循环时间']) - ->addColumn('attempts', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '执行次数']) - ->addColumn('message', 'text', ['default' => NULL, 'null' => true, 'comment' => '最新消息']) - ->addColumn('rscript', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '任务类型(0单例,1多例)']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '任务状态(1新任务,2处理中,3成功,4失败)']) - ->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '创建时间']) - ->addIndex('code', ['name' => 'if64376974_code']) - ->addIndex('title', ['name' => 'if64376974_title']) - ->addIndex('status', ['name' => 'if64376974_status']) - ->addIndex('rscript', ['name' => 'if64376974_rscript']) - ->addIndex('create_at', ['name' => 'if64376974_create_at']) - ->addIndex('exec_time', ['name' => 'if64376974_exec_time']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class SystemUser - * @table system_user - * @return void - */ - private function _create_system_user() - { - - // 当前数据表 - $table = 'system_user'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-用户', - ]) - ->addColumn('usertype', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '用户类型']) - ->addColumn('username', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户账号']) - ->addColumn('password', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '用户密码']) - ->addColumn('nickname', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户昵称']) - ->addColumn('headimg', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '头像地址']) - ->addColumn('authorize', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '权限授权']) - ->addColumn('contact_qq', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '联系QQ']) - ->addColumn('contact_mail', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '联系邮箱']) - ->addColumn('contact_phone', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '联系手机']) - ->addColumn('login_ip', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '登录地址']) - ->addColumn('login_at', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '登录时间']) - ->addColumn('login_num', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '登录次数']) - ->addColumn('describe', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '备注说明']) - ->addColumn('sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '状态(0禁用,1启用)']) - ->addColumn('is_deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除(1删除,0未删)']) - ->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']) - ->addIndex('sort', ['name' => 'i34b957835_sort']) - ->addIndex('status', ['name' => 'i34b957835_status']) - ->addIndex('username', ['name' => 'i34b957835_username']) - ->addIndex('is_deleted', ['name' => 'i34b957835_is_deleted']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } -} \ No newline at end of file diff --git a/plugin/think-plugs-admin/stc/database/20221013031926_install_admin_data.php b/plugin/think-plugs-admin/stc/database/20221013031926_install_admin_data.php deleted file mode 100644 index 86c0e5d90..000000000 --- a/plugin/think-plugs-admin/stc/database/20221013031926_install_admin_data.php +++ /dev/null @@ -1,97 +0,0 @@ -insertUser(); - $this->insertMenu(); - $this->insertConf(); - } - - /** - * 初始化用户数据 - * @return void - */ - private function insertUser() - { - $model = SystemUser::mk()->whereRaw('1=1')->findOrEmpty(); - $model->isEmpty() && $model->save([ - 'id' => '10000', - 'username' => 'admin', - 'nickname' => '超级管理员', - 'password' => '21232f297a57a5a743894a0e4a801fc3', - 'headimg' => 'https://thinkadmin.top/static/img/head.png', - ]); - } - - /** - * 初始化配置参数 - * @return void - */ - private function insertConf() - { - $modal = SystemConfig::mk()->whereRaw('1=1')->findOrEmpty(); - $modal->isEmpty() && $modal->insertAll([ - ['type' => 'base', 'name' => 'app_name', 'value' => 'ThinkAdmin'], - ['type' => 'base', 'name' => 'app_version', 'value' => 'v6'], - ['type' => 'base', 'name' => 'editor', 'value' => 'ckeditor5'], - ['type' => 'base', 'name' => 'login_name', 'value' => '系统管理'], - ['type' => 'base', 'name' => 'site_copy', 'value' => '©版权所有 2014-' . date('Y') . ' ThinkAdmin'], - ['type' => 'base', 'name' => 'site_icon', 'value' => 'https://thinkadmin.top/static/img/logo.png'], - ['type' => 'base', 'name' => 'site_name', 'value' => 'ThinkAdmin'], - ['type' => 'base', 'name' => 'site_theme', 'value' => 'default'], - ['type' => 'storage', 'name' => 'allow_exts', 'value' => 'doc,gif,ico,jpg,mp3,mp4,p12,pem,png,zip,rar,xls,xlsx'], - ['type' => 'storage', 'name' => 'type', 'value' => 'local'], - ['type' => 'wechat', 'name' => 'type', 'value' => 'api'], - ]); - } - - /** - * 初始化系统菜单 - * @return void - */ - private function insertMenu() - { - // 初始化菜单数据 - PhinxExtend::write2menu([ - [ - 'name' => '系统管理', - 'sort' => '100', - 'subs' => Service::menu(), - ], - ], [ - 'url|node' => 'admin/config/index' - ]); - } -} \ No newline at end of file diff --git a/plugin/think-plugs-admin/stc/database/20221013031927_install_admin20230325.php b/plugin/think-plugs-admin/stc/database/20221013031927_install_admin20230325.php deleted file mode 100644 index d489de7b3..000000000 --- a/plugin/think-plugs-admin/stc/database/20221013031927_install_admin20230325.php +++ /dev/null @@ -1,39 +0,0 @@ -table($table)->hasColumn('unid') || $this->table($table) - ->addColumn('tags', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'after' => 'hash', 'comment' => '文件标签']) - ->addColumn('unid', 'integer', ['limit' => 11, 'default' => 0, 'null' => true, 'after' => 'uuid', 'comment' => '会员编号']) - ->addIndex('uuid', ['name' => 'i738a363ca_uuid']) - ->addIndex('tags', ['name' => 'i738a363ca_tags']) - ->update(); - } -} diff --git a/plugin/think-plugs-admin/stc/database/20221013031928_install_admin20230621.php b/plugin/think-plugs-admin/stc/database/20221013031928_install_admin20230621.php deleted file mode 100644 index 532332b00..000000000 --- a/plugin/think-plugs-admin/stc/database/20221013031928_install_admin20230621.php +++ /dev/null @@ -1,36 +0,0 @@ -table($table)->hasColumn('message') || $this->table($table) - ->addColumn('message', 'text', ['default' => NULL, 'null' => true, 'after' => 'attempts', 'comment' => '最新消息']) - ->update(); - } -} diff --git a/plugin/think-plugs-admin/stc/database/20241016000003_install_admin20241016.php b/plugin/think-plugs-admin/stc/database/20241016000003_install_admin20241016.php new file mode 100644 index 000000000..037121280 --- /dev/null +++ b/plugin/think-plugs-admin/stc/database/20241016000003_install_admin20241016.php @@ -0,0 +1,333 @@ +_create_system_auth(); + $this->_create_system_auth_node(); + $this->_create_system_base(); + $this->_create_system_config(); + $this->_create_system_data(); + $this->_create_system_file(); + $this->_create_system_menu(); + $this->_create_system_oplog(); + $this->_create_system_queue(); + $this->_create_system_user(); + } + + /** + * 创建数据对象 + * @class SystemAuth + * @table system_auth + * @return void + */ + private function _create_system_auth() + { + // 创建数据表对象 + $table = $this->table('system_auth', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-权限', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['title', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '权限名称']], + ['utype', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '身份权限']], + ['desc', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '备注说明']], + ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '权限状态(1使用,0禁用)']], + ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], + ], [ + 'sort', 'title', 'status', + ], true); + } + + /** + * 创建数据对象 + * @class SystemAuthNode + * @table system_auth_node + * @return void + */ + private function _create_system_auth_node() + { + // 创建数据表对象 + $table = $this->table('system_auth_node', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-授权', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['auth', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '角色']], + ['node', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '节点']], + ], [ + 'auth', 'node', + ], true); + } + + /** + * 创建数据对象 + * @class SystemBase + * @table system_base + * @return void + */ + private function _create_system_base() + { + // 创建数据表对象 + $table = $this->table('system_base', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-字典', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '数据类型']], + ['code', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '数据代码']], + ['name', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '数据名称']], + ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '数据内容']], + ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '数据状态(0禁用,1启动)']], + ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0正常,1已删)']], + ['deleted_at', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '删除时间']], + ['deleted_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '删除用户']], + ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], + ], [ + 'type', 'code', 'name', 'sort', 'status', 'deleted', + ], true); + } + + /** + * 创建数据对象 + * @class SystemConfig + * @table system_config + * @return void + */ + private function _create_system_config() + { + // 创建数据表对象 + $table = $this->table('system_config', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-配置', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '配置分类']], + ['name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '配置名称']], + ['value', 'string', ['limit' => 2048, 'default' => '', 'null' => true, 'comment' => '配置内容']], + ], [ + 'type', 'name', + ], true); + } + + /** + * 创建数据对象 + * @class SystemData + * @table system_data + * @return void + */ + private function _create_system_data() + { + // 创建数据表对象 + $table = $this->table('system_data', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-数据', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '配置名']], + ['value', 'text', ['default' => NULL, 'null' => true, 'comment' => '配置值']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], + ], [ + 'name', 'create_time', + ], true); + } + + /** + * 创建数据对象 + * @class SystemFile + * @table system_file + * @return void + */ + private function _create_system_file() + { + // 创建数据表对象 + $table = $this->table('system_file', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-文件', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '上传类型']], + ['hash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '文件哈希']], + ['tags', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '文件标签']], + ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '文件名称']], + ['xext', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '文件后缀']], + ['xurl', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '访问链接']], + ['xkey', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '文件路径']], + ['mime', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '文件类型']], + ['size', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '文件大小']], + ['uuid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], + ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '会员编号']], + ['isfast', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '是否秒传']], + ['issafe', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '安全模式']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '上传状态(1悬空,2落地)']], + ['create_at', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ['update_at', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], + ], [ + 'type', 'hash', 'uuid', 'xext', 'unid', 'tags', 'name', 'status', 'issafe', 'isfast', 'create_at', + ], true); + } + + /** + * 创建数据对象 + * @class SystemMenu + * @table system_menu + * @return void + */ + private function _create_system_menu() + { + // 创建数据表对象 + $table = $this->table('system_menu', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-菜单', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['pid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上级ID']], + ['title', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '菜单名称']], + ['icon', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '菜单图标']], + ['node', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '节点代码']], + ['url', 'string', ['limit' => 400, 'default' => '', 'null' => true, 'comment' => '链接节点']], + ['params', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '链接参数']], + ['target', 'string', ['limit' => 20, 'default' => '_self', 'null' => true, 'comment' => '打开方式']], + ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '状态(0:禁用,1:启用)']], + ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], + ], [ + 'pid', 'sort', 'status', + ], true); + } + + /** + * 创建数据对象 + * @class SystemOplog + * @table system_oplog + * @return void + */ + private function _create_system_oplog() + { + // 创建数据表对象 + $table = $this->table('system_oplog', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-日志', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['node', 'string', ['limit' => 200, 'default' => '', 'null' => false, 'comment' => '当前操作节点']], + ['geoip', 'string', ['limit' => 15, 'default' => '', 'null' => false, 'comment' => '操作者IP地址']], + ['action', 'string', ['limit' => 200, 'default' => '', 'null' => false, 'comment' => '操作行为名称']], + ['content', 'string', ['limit' => 1024, 'default' => '', 'null' => false, 'comment' => '操作内容描述']], + ['username', 'string', ['limit' => 50, 'default' => '', 'null' => false, 'comment' => '操作人用户名']], + ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '创建时间']], + ], [ + 'create_at', + ], true); + } + + /** + * 创建数据对象 + * @class SystemQueue + * @table system_queue + * @return void + */ + private function _create_system_queue() + { + // 创建数据表对象 + $table = $this->table('system_queue', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-任务', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['code', 'string', ['limit' => 20, 'default' => '', 'null' => false, 'comment' => '任务编号']], + ['title', 'string', ['limit' => 100, 'default' => '', 'null' => false, 'comment' => '任务名称']], + ['command', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '执行指令']], + ['exec_pid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '执行进程']], + ['exec_data', 'text', ['default' => NULL, 'null' => true, 'comment' => '执行参数']], + ['exec_time', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '执行时间']], + ['exec_desc', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '执行描述']], + ['enter_time', 'decimal', ['precision' => 20, 'scale' => 4, 'default' => '0.0000', 'null' => true, 'comment' => '开始时间']], + ['outer_time', 'decimal', ['precision' => 20, 'scale' => 4, 'default' => '0.0000', 'null' => true, 'comment' => '结束时间']], + ['loops_time', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '循环时间']], + ['attempts', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '执行次数']], + ['message', 'text', ['default' => NULL, 'null' => true, 'comment' => '最新消息']], + ['rscript', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '任务类型(0单例,1多例)']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '任务状态(1新任务,2处理中,3成功,4失败)']], + ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '创建时间']], + ], [ + 'code', 'title', 'status', 'rscript', 'create_at', 'exec_time', + ], true); + } + + /** + * 创建数据对象 + * @class SystemUser + * @table system_user + * @return void + */ + private function _create_system_user() + { + // 创建数据表对象 + $table = $this->table('system_user', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-用户', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['usertype', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '用户类型']], + ['username', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户账号']], + ['password', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '用户密码']], + ['nickname', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户昵称']], + ['headimg', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '头像地址']], + ['authorize', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '权限授权']], + ['contact_qq', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '联系QQ']], + ['contact_mail', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '联系邮箱']], + ['contact_phone', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '联系手机']], + ['login_ip', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '登录地址']], + ['login_at', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '登录时间']], + ['login_num', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '登录次数']], + ['describe', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '备注说明']], + ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '状态(0禁用,1启用)']], + ['is_deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除(1删除,0未删)']], + ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], + ], [ + 'sort', 'status', 'username', 'is_deleted', + ], true); + } +} \ No newline at end of file