From cc1c19c9db23534b1dd4d2558e396c5d26f12ff6 Mon Sep 17 00:00:00 2001 From: zhaoxiang Date: Mon, 13 May 2019 17:07:03 +0800 Subject: [PATCH] =?UTF-8?q?modified=20=E5=AE=8C=E6=88=90=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=A1=A8=E5=BB=BA=E7=AB=8B=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/model/AdminUser.php | 1 + .../migrations/20190513081034_admin_user.php | 85 +++++++++++++++++++ .../20190513082503_admin_user_action.php | 73 ++++++++++++++++ .../20190513085755_admin_user_data.php | 70 +++++++++++++++ 4 files changed, 229 insertions(+) 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 diff --git a/application/model/AdminUser.php b/application/model/AdminUser.php index d40ed5d..87bb7af 100644 --- a/application/model/AdminUser.php +++ b/application/model/AdminUser.php @@ -8,5 +8,6 @@ namespace app\model; class AdminUser extends Base { + protected $autoWriteTimestamp = true; } diff --git a/database/migrations/20190513081034_admin_user.php b/database/migrations/20190513081034_admin_user.php new file mode 100644 index 0000000..2e8be46 --- /dev/null +++ b/database/migrations/20190513081034_admin_user.php @@ -0,0 +1,85 @@ +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', 'biginteger', [ + 'limit' => 11, + 'default' => 0, + 'comment' => '注册IP' + ])->addColumn('update_time', 'integer', [ + 'limit' => 11, + 'default' => 0, + 'comment' => '更新时间' + ])->addColumn('status', 'integer', [ + 'limit' => 1, + 'default' => 0, + 'comment' => '账号状态 0封号 1正常' + ])->addColumn('openid', 'string', [ + 'limit' => 100, + 'default' => '', + 'comment' => '三方登录唯一ID' + ])->addIndex(['create_time'])->create(); + + $table->changeColumn('id', 'integer', ['signed' => false]); + } +} diff --git a/database/migrations/20190513082503_admin_user_action.php b/database/migrations/20190513082503_admin_user_action.php new file mode 100644 index 0000000..da6ae2c --- /dev/null +++ b/database/migrations/20190513082503_admin_user_action.php @@ -0,0 +1,73 @@ +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(); + + $table->changeColumn('id', 'integer', ['signed' => false]); + } +} diff --git a/database/migrations/20190513085755_admin_user_data.php b/database/migrations/20190513085755_admin_user_data.php new file mode 100644 index 0000000..267eb63 --- /dev/null +++ b/database/migrations/20190513085755_admin_user_data.php @@ -0,0 +1,70 @@ +table('admin_user_data', [ + 'comment' => '管理员数据表' + ])->setCollation('utf8mb4_general_ci'); + $table->addColumn('login_times', 'integer', [ + 'limit' => 11, + 'default' => 0, + 'comment' => '账号登录次数' + ])->addColumn('last_login_ip', 'biginteger', [ + 'limit' => 11, + '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(); + + $table->changeColumn('id', 'integer', ['signed' => false]); + } +}