初始化项目

This commit is contained in:
augushong
2020-08-07 23:49:50 +08:00
parent 30d8c3b64b
commit 3bc46a4b9c
304 changed files with 29675 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class CreateTableUploadFiles extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('upload_files',['comment'=>'上传的文件','signed'=>false]);
$table->addColumn('save_name','string',['limit'=>100,'comment'=>'文件存储地址']);
$table->addColumn('file_name','string',['limit'=>100,'comment'=>'文件原始名称']);
$table->addColumn('mime_type','string',['limit'=>30,'comment'=>'mime type 类型']);
$table->addColumn('file_size','integer',['limit'=>30,'comment'=>'文件大小']);
$table->addColumn('ext_name','string',['limit'=>10,'comment'=>'扩展名']);
$table->addColumn('file_md5','string',['limit'=>32,'comment'=>'文件md5值']);
$table->addColumn('file_sha1','string',['limit'=>40,'comment'=>'文件sha1值']);
$table->addColumn('create_time','integer',['limit'=>10,'default'=>0,'comment'=>'上传时间']);
$table->addColumn('used_time','integer',['limit'=>10,'default'=>0,'comment'=>'标记使用时间,如果为空,可能仅作为了预览图']);
$table->addColumn('delete_time','integer',['limit'=>10,'default'=>0,'comment'=>'删除时间']);
$table->addColumn('clear_time','integer',['limit'=>10,'default'=>0,'comment'=>'清空时间']);
$table->addColumn('type','integer',['limit'=>2,'default'=>1,'comment'=>'文件类型1系统logo;2:管理员头像']);
$table->addColumn('status','integer',['limit'=>2,'default'=>0,'comment'=>'文件状态:0,上传未使用,1:已使用,2:已删除,3已清除']);
$table->addIndex('save_name');
$table->addIndex('create_time');
$table->addIndex('used_time');
$table->addIndex('delete_time');
$table->addIndex('clear_time');
$table->addIndex('type');
$table->addIndex('status');
$table->create();
}
}

View File

@@ -0,0 +1,37 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class CreateTableSystemConfig extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('system_config',['comment'=>'系统配置表','signed'=>false]);
$table->addColumn('name','string',['limit'=>30,'comment'=>'配置名称']);
$table->addColumn('value','text',['comment'=>'值']);
$table->addIndex('name');
$table->create();
}
}

View File

@@ -0,0 +1,44 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class CreateTableAdmin extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('admin',['comment'=>'管理员表','signed'=>false]);
$table->addColumn('account','string',['limit'=>20,'comment'=>'用户帐号']);
$table->addColumn('password','string',['limit'=>32,'comment'=>'密码']);
$table->addColumn('salt','string',['limit'=>6,'comment'=>'密码盐']);
$table->addColumn('nickname','string',['limit'=>10,'default'=>"admin",'comment'=>'昵称']);
$table->addColumn('avatar','string',['limit'=>40,'comment'=>'头像地址']);
$table->addColumn('create_time','integer',['limit'=>10,'default'=>0,'comment'=>'添加时间']);
$table->addColumn('delete_time','integer',['limit'=>10,'default'=>0,'comment'=>'删除时间']);
$table->addColumn('group_id','integer',['limit'=>10,'default'=>0,'comment'=>'管理员组']);
$table->addIndex('account');
$table->addIndex('delete_time');
$table->create();
}
}

View File

@@ -0,0 +1,43 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class CreateTableAdminGroup extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('admin_group',[
'comment'=>'管理员组',
'signed'=>false
]);
$table->addColumn('name','string',['limit'=>20,'comment'=>'组名']);
$table->addColumn('create_time','integer',['limit'=>11,'default'=>0,'comment'=>'添加时间']);
$table->addColumn('update_time','integer',['limit'=>11,'default'=>0,'comment'=>'更新时间']);
$table->addColumn('delete_time','integer',['limit'=>11,'default'=>0,'comment'=>'删除时间']);
$table->addColumn('permissions','text',['comment'=>'拥有权限']);
$table->create();
}
}

View File

@@ -0,0 +1,53 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class CreateTableAdminLog extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('admin_log',[
'comment'=>'管理员日志',
'signed'=>false
]);
$table->addColumn('app','string',['limit'=>50,'comment'=>'应用名']);
$table->addColumn('controller','string',['limit'=>50,'comment'=>'控制器名']);
$table->addColumn('action','string',['limit'=>50,'comment'=>'方法名']);
$table->addColumn('param','text',['comment'=>'参数']);
$table->addColumn('create_time','integer',['limit'=>11,'default'=>0,'comment'=>'添加时间']);
$table->addColumn('delete_time','integer',['limit'=>11,'default'=>0,'comment'=>'删除时间']);
$table->addColumn('admin_id','integer',['limit'=>20,'default'=>0,'comment'=>'管理员id']);
$table->addColumn('ip','string',['limit'=>30,'default'=>'','comment'=>'客户端ip']);
$table->addIndex('app');
$table->addIndex('controller');
$table->addIndex('action');
$table->addIndex('delete_time');
$table->addIndex('admin_id');
$table->create();
}
}

View File

@@ -0,0 +1,43 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class CreateTableAdminPermission extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('admin_permission',[
'comment'=>'后台权限记录',
'signed'=>false
]);
$table->addColumn('name','string',['limit'=>20,'default'=>'0','comment'=>'权限名称']);
$table->addColumn('key','string',['limit'=>100,'comment'=>'权限标识']);
$table->addColumn('is_log','integer',['limit'=>1,'default'=>0,'comment'=>'是否把这个访问记录下来']);
$table->addIndex('key');
$table->addIndex('is_log');
$table->create();
}
}

View File

@@ -0,0 +1,46 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class CreateTableUser extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('user',['comment'=>'用户表','signed'=>false]);
$table->addColumn('account','string',['limit'=>20,'comment'=>'用户帐号']);
$table->addColumn('password','string',['limit'=>32,'comment'=>'密码']);
$table->addColumn('salt','string',['limit'=>6,'comment'=>'密码盐']);
$table->addColumn('nickname','string',['limit'=>10,'comment'=>'昵称']);
$table->addColumn('avatar','string',['limit'=>40,'comment'=>'头像地址']);
$table->addColumn('create_time','integer',['limit'=>10,'default'=>0,'comment'=>'添加时间']);
$table->addColumn('update_time','integer',['limit'=>10,'default'=>0,'comment'=>'更新时间']);
$table->addColumn('delete_time','integer',['limit'=>10,'default'=>0,'comment'=>'删除时间']);
$table->addColumn('last_login_time','integer',['limit'=>10,'default'=>0,'comment'=>'最后一次登陆时间']);
$table->addColumn('status','integer',['limit'=>1,'default'=>0,'comment'=>'状态']);
$table->addIndex('account');
$table->addIndex('delete_time');
$table->create();
}
}

View File

@@ -0,0 +1,54 @@
<?php
use app\admin\controller\Common;
use app\common\ColumnFormat;
use think\migration\Migrator;
use think\migration\db\Column;
class CreateTableNav extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('nav',['comment'=>'多功能导航,可兼容多种类型','sign'=>false]);
$table->addColumn('title','string',['limit'=>100,'comment'=>'名称标题']);
$table->addColumn(Column::make('sort','integer')->setSigned(false)->setComment('排序,越小越靠前'));
$table->addColumn(Column::make('create_time','integer')->setSigned(false)->setLimit(10)->setComment('添加时间'));
$table->addColumn(ColumnFormat::timestamp('update_time'));
$table->addColumn(ColumnFormat::timestamp('delete_time'));
$table->addColumn(ColumnFormat::stringShort('type')->setComment('类型,用于区分业务场景:1:PC导航,2:PC轮播图,3:PC友情链接'));
$table->addColumn(Column::make('img','string')->setLimit(100)->setComment('图片'));
$table->addColumn(ColumnFormat::stringLong('desc')->setComment('副标题描述'));
$table->addColumn(Column::make('target','string')->setLimit(10)->setSigned(false)->setComment('网页链接打开对象,_BLANK,_SELF,iframe_name'));
$table->addColumn(Column::make('xcx_type','integer')->setLimit(10)->setComment('小程序打开方式,1:小程序导航页面,2:普通页面,3:web-view,4:其他小程序,5:电话'));
$table->addColumn(Column::make('value','string')->setLimit(100)->setComment('对象值,有可能是网页链接,小程序导航页面路径,小程序普通页面路径,电话'));
$table->addColumn(Column::make('xcx_appid','string')->setLimit(30)->setComment('小程序appid,目标是其他小程序是有效'));
$table->addColumn(ColumnFormat::integerTypeStatus('status')->setComment('0:下架,1:显示'));
$table->addIndex('delete_time');
$table->addIndex('type');
$table->addIndex('sort');
$table->addIndex('status');
$table->create();
}
}

View File

@@ -0,0 +1,61 @@
<?php
use app\common\ColumnFormat;
use think\migration\Migrator;
use think\migration\db\Column;
class CreateTablePost extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('post',['comment'=>"内容文章"]);
$table->addColumn(ColumnFormat::stringNormal('title')->setComment('标题'));
$table->addColumn(ColumnFormat::stringUrl('poster')->setComment('封面'));
$table->addColumn(ColumnFormat::timestamp('create_time'));
$table->addColumn(ColumnFormat::timestamp('update_time'));
$table->addColumn(ColumnFormat::timestamp('delete_time'));
$table->addColumn(Column::make('content','text'));
$table->addColumn(Column::make('content_html','text'));
$table->addColumn(ColumnFormat::stringLong('desc')->setDefault('描述'));
$table->addColumn(ColumnFormat::integerTypeStatus('is_top')->setComment('是否置顶'));
$table->addColumn(ColumnFormat::integerTypeStatus('status')->setComment('1:显示,0:不显示'));
$table->addColumn(ColumnFormat::timestamp('publish_time')->setComment('发表时间'));
$table->addColumn(ColumnFormat::integer('hits')->setComment('访问量'));
$table->addColumn(ColumnFormat::stringUrl('jump_to_url')->setComment('跳转链接'));
$table->addColumn(ColumnFormat::integerTypeStatus('jump_to_url_status')->setComment('0:不显示,1:显示连接,2:自动跳转'));
$table->addColumn(ColumnFormat::integer('sort')->setComment('排序,越大越靠前'));
$table->addColumn(ColumnFormat::stringShort('type')->setComment('类型,1:文章,有分类有标签,2:页面,无分类无标签,N:其他形式用,用于区分不同的用途'));
$table->addColumn(Column::make('files','text')->setComment('附件'));
$table->addColumn(Column::make('pictures','text')->setComment('相册'));
$table->addColumn(ColumnFormat::stringShort('tpl_name')->setComment('模板名称'));
$table->addIndex('type');
$table->addIndex('status');
$table->addIndex('delete_time');
$table->addIndex('hits');
$table->addIndex('is_top');
$table->create();
}
}

View File

@@ -0,0 +1,43 @@
<?php
use app\common\ColumnFormat;
use think\migration\Migrator;
use think\migration\db\Column;
class CreateTablePostCategory extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('post_category',['comment'=>'文章分类关联表']);
$table->addColumn(ColumnFormat::integer('post_id'))
->addColumn(ColumnFormat::integer('category_id'))
->addColumn(ColumnFormat::timestamp('create_time'))
->addColumn(ColumnFormat::timestamp('update_time'))
->addColumn(ColumnFormat::timestamp('delete_time'))
->addIndex('post_id')
->addIndex('category_id')
->create();
}
}

View File

@@ -0,0 +1,42 @@
<?php
use app\common\ColumnFormat;
use think\migration\Migrator;
use think\migration\db\Column;
class CreateTablePostTag extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('post_tag',['comment'=>'文章分类关联表']);
$table->addColumn(ColumnFormat::integer('post_id'))
->addColumn(ColumnFormat::integer('tag_id'))
->addColumn(ColumnFormat::timestamp('create_time'))
->addColumn(ColumnFormat::timestamp('update_time'))
->addColumn(ColumnFormat::timestamp('delete_time'))
->addIndex('post_id')
->addIndex('tag_id')
->create();
}
}

View File

@@ -0,0 +1,51 @@
<?php
use app\common\ColumnFormat;
use think\migration\Migrator;
use think\migration\db\Column;
class CreateTableCategory extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('category')
->setComment('分类表')
->addColumn(ColumnFormat::stringNormal('title'))
->addColumn(ColumnFormat::timestamp('create_time'))
->addColumn(ColumnFormat::timestamp('update_time'))
->addColumn(ColumnFormat::timestamp('delete_time'))
->addColumn(ColumnFormat::integer('pid')->setComment('上级id'))
->addColumn(ColumnFormat::integer('level')->setDefault(1)->setComment('层级'))
->addColumn(ColumnFormat::stringShort('tpl_name')->setComment('模板名称'))
->addColumn(ColumnFormat::stringUrl('title_img')->setComment('附图'))
->addColumn(ColumnFormat::stringLong('desc')->setComment('副标题描述'))
->addColumn(ColumnFormat::integerTypeStatus('status')->setComment('0:不显示,1:显示'))
->addColumn(ColumnFormat::stringShort('type')->setComment('类型,1:文章,有分类有标签,2:页面,无分类无标签,N:其他形式用,用于区分不同的用途'))
->addIndex('type')
->addIndex('pid')
->addIndex('status')
->addIndex('delete_time')
->create();
}
}

View File

@@ -0,0 +1,42 @@
<?php
use app\common\ColumnFormat;
use think\migration\Migrator;
use think\migration\db\Column;
class CreateTableTag extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('tag')
->setComment('分类表')
->addColumn(ColumnFormat::stringNormal('title'))
->addColumn(ColumnFormat::timestamp('create_time'))
->addColumn(ColumnFormat::timestamp('update_time'))
->addColumn(ColumnFormat::timestamp('delete_time'))
->addColumn(ColumnFormat::stringShort('type')->setComment('类型,1:文章,有分类有标签,2:页面,无分类无标签,N:其他形式用,用于区分不同的用途'))
->addIndex('type')
->create();
}
}