用户管理模块

This commit is contained in:
wuyanwen 2019-12-03 21:43:37 +08:00
parent 2651ed6305
commit 6b4dd70752
3 changed files with 32 additions and 5 deletions

View File

@ -2,6 +2,8 @@
namespace catchAdmin;
use catcher\command\InstallCommand;
use catcher\command\MigrateRunCommand;
use catcher\command\ModelGeneratorCommand;
use catcher\command\ModuleCacheCommand;
use think\Service;
@ -17,6 +19,8 @@ class CatchAdminService extends Service
$this->commands([
InstallCommand::class,
ModuleCacheCommand::class,
MigrateRunCommand::class,
ModelGeneratorCommand::class,
]);
}
}

View File

@ -28,16 +28,16 @@ class Users extends Migrator
*/
public function change()
{
$table = $this->table('users',array('engine'=>'Innodb'));
$table = $this->table('users',array('engine'=>'Innodb', 'comment' => '用户表', 'signed' => false));
$table->addColumn('username', 'string',array('limit' => 15,'default'=>'','comment'=>'用户名'))
->addColumn('password', 'string',array('limit' => 255,'comment'=>'用户密码'))
->addColumn('email', 'string',array('limit' => 100, 'comment'=>'邮箱 登录'))
->addColumn('status', 'boolean',array('limit' => 1,'default'=> 1,'comment'=>'用户状态 1 正常 2 禁用'))
->addColumn('last_login_ip', 'integer',array('limit' => 11,'default'=>0,'comment'=>'最后登录IP'))
->addColumn('last_login_time', 'integer',array('default'=>0,'comment'=>'最后登录时间', 'unsigned' => true))
->addColumn('created_at', 'integer',array('default'=>0,'comment'=>'创建时间', 'unsigned' => true))
->addColumn('updated_at', 'integer',array('default'=>0,'comment'=>'更新时间', 'unsigned' => true))
->addColumn('delete_at', 'boolean',array('limit' => 1,'default'=>0,'comment'=>'删除状态0未删除 >0 已删除', 'unsigned' => true))
->addColumn('last_login_time', 'integer',array('default'=>0,'comment'=>'最后登录时间', 'signed' => false))
->addColumn('created_at', 'integer', array('default'=>0,'comment'=>'创建时间', 'signed' => false ))
->addColumn('updated_at', 'integer', array('default'=>0,'comment'=>'更新时间', 'signed' => false))
->addColumn('delete_at', 'integer', array('null'=>true,'comment'=>'删除状态0未删除 >0 已删除', 'signed' => false))
->addIndex(array('email'), array('unique' => true))
->create();
}

View File

@ -0,0 +1,23 @@
<?php
namespace catchAdmin\user\model;
use catcher\Model;
class Users extends Model
{
protected $name = 'users';
protected $field = [
'id', //
'username', // 用户名
'password', // 用户密码
'email', // 邮箱 登录
'status', // 用户状态 1 正常 2 禁用
'last_login_ip', // 最后登录IP
'last_login_time', // 最后登录时间
'created_at', // 创建时间
'updated_at', // 更新时间
'delete_at', // 删除状态0未删除 >0 已删除
];
}