代码功能更新
This commit is contained in:
+838
@@ -0,0 +1,838 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
class AdminMenu 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_menu', [
|
||||
'engine' => 'InnoDB',
|
||||
'comment' => '后台菜单',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
]);
|
||||
|
||||
if ($table->exists()) {
|
||||
$table->drop();
|
||||
}
|
||||
|
||||
$table
|
||||
->addColumn('name', 'string', ['length' => 100, 'default' => '', 'comment' => '名称'])
|
||||
->addColumn('href', 'string', ['length' => 255, 'default' => '', 'comment' => '点击菜单,打开的url地址'])
|
||||
->addColumn('rule', 'string', ['length' => 100, 'default' => '', 'comment' => '路由规则'])
|
||||
->addColumn('is_menu', 'boolean', ['default' => 1, 'comment' => '是否为menu.2=不是,1=是'])
|
||||
->addColumn('sort', 'integer', ['default' => 0, 'comment' => '排序,从大到小,倒叙排序'])
|
||||
->addColumn('pid', 'integer', ['default' => 0, 'comment' => '上级ID'])
|
||||
->addColumn('is_show', 'integer', ['default' => 1, 'comment' => '是否显示.2=隐藏,1=显示'])
|
||||
->addColumn('icon', 'string', ['length' => 100, 'default' => '', 'comment' => '图标'])
|
||||
->addColumn('des', 'text', ['null' => 1, 'comment' => '描述'])
|
||||
->addColumn('create_time', 'datetime', ['null' => 1, 'comment' => '创建时间'])
|
||||
->addColumn('update_time', 'datetime', ['null' => 1, 'comment' => '更新时间'])
|
||||
->addColumn('delete_time', 'datetime', ['null' => 1, 'comment' => '删除时间']);
|
||||
|
||||
$data = [
|
||||
'1' => [
|
||||
'name' => '控制台',
|
||||
'rule' => '',
|
||||
'pid' => 0,
|
||||
'des' => '控制台',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'2' => [
|
||||
'name' => '控制面板',
|
||||
'href' => '/admin/console.html',
|
||||
'pid' => 1,
|
||||
'icon' => 'layui-icon layui-icon-console',
|
||||
'des' => '控制面板',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'3' => [
|
||||
'name' => '权限管理',
|
||||
'pid' => 1,
|
||||
'icon' => 'layui-icon layui-icon-group',
|
||||
'des' => '权限管理',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'4' => [
|
||||
'name' => '管理员管理',
|
||||
'href' => '/admin/user/index.html',
|
||||
'pid' => 3,
|
||||
'des' => '管理员管理',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'5' => [
|
||||
'name' => '查看和搜索列表',
|
||||
'rule' => '/admin.user/index',
|
||||
'is_menu' => 2,
|
||||
'pid' => 4,
|
||||
'des' => '查看和搜索列表',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'6' => [
|
||||
'name' => '查看单条数据详情',
|
||||
'rule' => '/admin.user/info',
|
||||
'is_menu' => 2,
|
||||
'pid' => 4,
|
||||
'des' => '查看单条数据详情',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'7' => [
|
||||
'name' => '添加',
|
||||
'rule' => '/admin.user/add',
|
||||
'is_menu' => 2,
|
||||
'pid' => 4,
|
||||
'des' => '添加',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'8' => [
|
||||
'name' => '编辑',
|
||||
'rule' => '/admin.user/edit',
|
||||
'is_menu' => 2,
|
||||
'pid' => 4,
|
||||
'des' => '编辑',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'9' => [
|
||||
'name' => '删除',
|
||||
'rule' => '/admin.user/del',
|
||||
'is_menu' => 2,
|
||||
'pid' => 4,
|
||||
'des' => '删除',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'10' => [
|
||||
'name' => '设置是否禁用',
|
||||
'rule' => '/admin.user/setStatus',
|
||||
'is_menu' => 2,
|
||||
'pid' => 4,
|
||||
'des' => '设置是否禁用',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'11' => [
|
||||
'name' => '设置是否为超管',
|
||||
'rule' => '/admin.user/setIsSuperManager',
|
||||
'is_menu' => 2,
|
||||
'pid' => 4,
|
||||
'des' => '设置是否为超管',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'12' => [
|
||||
'name' => '回收站',
|
||||
'rule' => '/admin.user/recycle',
|
||||
'is_menu' => 2,
|
||||
'pid' => 4,
|
||||
'des' => '回收站',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'13' => [
|
||||
'name' => '还原',
|
||||
'rule' => '/admin.user/restore',
|
||||
'is_menu' => 2,
|
||||
'pid' => 4,
|
||||
'des' => '还原',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'14' => [
|
||||
'name' => '真实删除',
|
||||
'rule' => '/admin.user/trueDel',
|
||||
'is_menu' => 2,
|
||||
'pid' => 4,
|
||||
'des' => '真实删除',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'15' => [
|
||||
'name' => '角色管理',
|
||||
'href' => '/admin/role/index.html',
|
||||
'pid' => 3,
|
||||
'des' => '角色管理',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'16' => [
|
||||
'name' => '查看和搜索列表',
|
||||
'rule' => '/admin.role/index',
|
||||
'is_menu' => 2,
|
||||
'pid' => 15,
|
||||
'des' => '查看和搜索列表',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'17' => [
|
||||
'name' => '查看单条数据详情',
|
||||
'rule' => '/admin.role/info',
|
||||
'is_menu' => 2,
|
||||
'pid' => 15,
|
||||
'des' => '查看单条数据详情',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'18' => [
|
||||
'name' => '添加',
|
||||
'rule' => '/admin.role/add',
|
||||
'is_menu' => 2,
|
||||
'pid' => 15,
|
||||
'des' => '添加',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'19' => [
|
||||
'name' => '编辑',
|
||||
'rule' => '/admin.role/edit',
|
||||
'is_menu' => 2,
|
||||
'pid' => 15,
|
||||
'des' => '编辑',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'20' => [
|
||||
'name' => '删除',
|
||||
'rule' => '/admin.role/del',
|
||||
'is_menu' => 2,
|
||||
'pid' => 15,
|
||||
'des' => '删除',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'21' => [
|
||||
'name' => '回收站',
|
||||
'rule' => '/admin.role/recycle',
|
||||
'is_menu' => 2,
|
||||
'pid' => 15,
|
||||
'des' => '回收站',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'22' => [
|
||||
'name' => '还原',
|
||||
'rule' => '/admin.role/restore',
|
||||
'is_menu' => 2,
|
||||
'pid' => 15,
|
||||
'des' => '还原',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'23' => [
|
||||
'name' => '真实删除',
|
||||
'rule' => '/admin.role/trueDel',
|
||||
'is_menu' => 2,
|
||||
'pid' => 15,
|
||||
'des' => '真实删除',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'24' => [
|
||||
'name' => '菜单管理',
|
||||
'href' => '/admin/menu/index.html',
|
||||
'pid' => 3,
|
||||
'des' => '菜单管理',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'25' => [
|
||||
'name' => '查看和搜索列表',
|
||||
'rule' => '/admin.menu/index',
|
||||
'is_menu' => 2,
|
||||
'pid' => 24,
|
||||
'des' => '查看和搜索列表',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'26' => [
|
||||
'name' => '查看单条数据详情',
|
||||
'rule' => '/admin.menu/info',
|
||||
'is_menu' => 2,
|
||||
'pid' => 24,
|
||||
'des' => '查看单条数据详情',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'27' => [
|
||||
'name' => '添加',
|
||||
'rule' => '/admin.menu/add',
|
||||
'is_menu' => 2,
|
||||
'pid' => 24,
|
||||
'des' => '添加',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'28' => [
|
||||
'name' => '编辑',
|
||||
'rule' => '/admin.menu/edit',
|
||||
'is_menu' => 2,
|
||||
'pid' => 24,
|
||||
'des' => '编辑',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'29' => [
|
||||
'name' => '删除',
|
||||
'rule' => '/admin.menu/del',
|
||||
'is_menu' => 2,
|
||||
'pid' => 24,
|
||||
'des' => '删除',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'30' => [
|
||||
'name' => '设置是否为菜单',
|
||||
'rule' => '/admin.menu/setIsMenu',
|
||||
'is_menu' => 2,
|
||||
'pid' => 24,
|
||||
'des' => '设置是否为菜单',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'31' => [
|
||||
'name' => '设置是否显示',
|
||||
'rule' => '/admin.menu/setIsShow',
|
||||
'is_menu' => 2,
|
||||
'pid' => 24,
|
||||
'des' => '设置是否显示',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'32' => [
|
||||
'name' => '回收站',
|
||||
'rule' => '/admin.menu/recycle',
|
||||
'is_menu' => 2,
|
||||
'pid' => 24,
|
||||
'des' => '回收站',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'33' => [
|
||||
'name' => '还原',
|
||||
'rule' => '/admin.menu/restore',
|
||||
'is_menu' => 2,
|
||||
'pid' => 24,
|
||||
'des' => '还原',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'34' => [
|
||||
'name' => '真实删除',
|
||||
'rule' => '/admin.menu/trueDel',
|
||||
'is_menu' => 2,
|
||||
'pid' => 24,
|
||||
'des' => '真实删除',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'35' => [
|
||||
'name' => '系统配置',
|
||||
'pid' => 1,
|
||||
'icon' => 'layui-icon layui-icon-set-fill',
|
||||
'des' => '系统配置',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'36' => [
|
||||
'name' => '配置样例',
|
||||
'href' => '/admin/conf/system/demo.html',
|
||||
'is_menu' => 1,
|
||||
'pid' => 35,
|
||||
'des' => '配置样例',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'37' => [
|
||||
'name' => '基础配置',
|
||||
'href' => '/admin/conf/system/basic.html',
|
||||
'is_menu' => 1,
|
||||
'pid' => 35,
|
||||
'des' => '基础配置',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'38' => [
|
||||
'name' => '上传配置',
|
||||
'href' => '/admin/conf/system/upload.html',
|
||||
'is_menu' => 1,
|
||||
'pid' => 35,
|
||||
'des' => '上传配置',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'39' => [
|
||||
'name' => '常规管理',
|
||||
'pid' => 1,
|
||||
'icon' => 'layui-icon layui-icon-set-sm',
|
||||
'des' => '常规管理',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'40' => [
|
||||
'name' => '附件相关',
|
||||
'pid' => 39,
|
||||
'des' => '附件相关',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'41' => [
|
||||
'name' => '附件管理',
|
||||
'href' => '/admin/files/index.html',
|
||||
'pid' => 40,
|
||||
'des' => '附件管理',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'42' => [
|
||||
'name' => '查看和搜索列表',
|
||||
'rule' => '/admin.files/index',
|
||||
'is_menu' => 2,
|
||||
'pid' => 41,
|
||||
'des' => '查看和搜索列表',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'43' => [
|
||||
'name' => '删除',
|
||||
'rule' => '/admin.files/del',
|
||||
'is_menu' => 2,
|
||||
'pid' => 41,
|
||||
'des' => '删除',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'44' => [
|
||||
'name' => '回收站',
|
||||
'rule' => '/admin.files/recycle',
|
||||
'is_menu' => 2,
|
||||
'pid' => 41,
|
||||
'des' => '回收站',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'45' => [
|
||||
'name' => '还原',
|
||||
'rule' => '/admin.files/restore',
|
||||
'is_menu' => 2,
|
||||
'pid' => 41,
|
||||
'des' => '还原',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'46' => [
|
||||
'name' => '真实删除',
|
||||
'rule' => '/admin.files/trueDel',
|
||||
'is_menu' => 2,
|
||||
'pid' => 41,
|
||||
'des' => '真实删除',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'47' => [
|
||||
'name' => '附件分类管理',
|
||||
'href' => '/admin/files/category/index.html',
|
||||
'pid' => 40,
|
||||
'des' => '附件分类管理',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'48' => [
|
||||
'name' => '查看和搜索列表',
|
||||
'rule' => '/admin.files.category/index',
|
||||
'is_menu' => 2,
|
||||
'pid' => 47,
|
||||
'des' => '查看和搜索列表',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'49' => [
|
||||
'name' => '查看单条数据详情',
|
||||
'rule' => '/admin.files.category/info',
|
||||
'is_menu' => 2,
|
||||
'pid' => 47,
|
||||
'des' => '查看单条数据详情',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'50' => [
|
||||
'name' => '添加',
|
||||
'rule' => '/admin.files.category/add',
|
||||
'is_menu' => 2,
|
||||
'pid' => 47,
|
||||
'des' => '添加',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'51' => [
|
||||
'name' => '编辑',
|
||||
'rule' => '/admin.files.category/edit',
|
||||
'is_menu' => 2,
|
||||
'pid' => 47,
|
||||
'des' => '编辑',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'52' => [
|
||||
'name' => '删除',
|
||||
'rule' => '/admin.files.category/del',
|
||||
'is_menu' => 2,
|
||||
'pid' => 47,
|
||||
'des' => '删除',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'53' => [
|
||||
'name' => '回收站',
|
||||
'rule' => '/admin.files.category/recycle',
|
||||
'is_menu' => 2,
|
||||
'pid' => 47,
|
||||
'des' => '回收站',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'54' => [
|
||||
'name' => '还原',
|
||||
'rule' => '/admin.files.category/restore',
|
||||
'is_menu' => 2,
|
||||
'pid' => 47,
|
||||
'des' => '还原',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'55' => [
|
||||
'name' => '真实删除',
|
||||
'rule' => '/admin.files.category/trueDel',
|
||||
'is_menu' => 2,
|
||||
'pid' => 47,
|
||||
'des' => '真实删除',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'56' => [
|
||||
'name' => '地区管理',
|
||||
'href' => '/admin/area/index.html',
|
||||
'pid' => 39,
|
||||
'des' => '地区管理',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'57' => [
|
||||
'name' => '查看和搜索列表',
|
||||
'rule' => '/admin.area/index',
|
||||
'is_menu' => 2,
|
||||
'pid' => 56,
|
||||
'des' => '查看和搜索列表',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'58' => [
|
||||
'name' => '查看单条数据详情',
|
||||
'rule' => '/admin.area/info',
|
||||
'is_menu' => 2,
|
||||
'pid' => 56,
|
||||
'des' => '查看单条数据详情',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'59' => [
|
||||
'name' => '添加',
|
||||
'rule' => '/admin.area/add',
|
||||
'is_menu' => 2,
|
||||
'pid' => 56,
|
||||
'des' => '添加',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'60' => [
|
||||
'name' => '编辑',
|
||||
'rule' => '/admin.area/edit',
|
||||
'is_menu' => 2,
|
||||
'pid' => 56,
|
||||
'des' => '编辑',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'61' => [
|
||||
'name' => '删除',
|
||||
'rule' => '/admin.area/del',
|
||||
'is_menu' => 2,
|
||||
'pid' => 56,
|
||||
'des' => '删除',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'62' => [
|
||||
'name' => '回收站',
|
||||
'rule' => '/admin.area/recycle',
|
||||
'is_menu' => 2,
|
||||
'pid' => 56,
|
||||
'des' => '回收站',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'63' => [
|
||||
'name' => '还原',
|
||||
'rule' => '/admin.area/restore',
|
||||
'is_menu' => 2,
|
||||
'pid' => 56,
|
||||
'des' => '还原',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'64' => [
|
||||
'name' => '真实删除',
|
||||
'rule' => '/admin.area/trueDel',
|
||||
'is_menu' => 2,
|
||||
'pid' => 56,
|
||||
'des' => '真实删除',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'65' => [
|
||||
'name' => '设置排序',
|
||||
'rule' => '/admin.area/setSort',
|
||||
'is_menu' => 2,
|
||||
'pid' => 56,
|
||||
'des' => '设置排序',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'66' => [
|
||||
'name' => '日志相关',
|
||||
'href' => '/admin/api/log/index.html',
|
||||
'pid' => 39,
|
||||
'des' => '日志相关',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'67' => [
|
||||
'name' => '后台登录日志',
|
||||
'href' => '/admin/login/log/index.html',
|
||||
'rule' => '/admin.login.log/index',
|
||||
'pid' => 66,
|
||||
'des' => '后台登录日志',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'68' => [
|
||||
'name' => '后台操作日志',
|
||||
'href' => '/admin/action/log/index.html',
|
||||
'rule' => '/admin.action.log/index',
|
||||
'pid' => 66,
|
||||
'des' => '后台操作日志',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'69' => [
|
||||
'name' => 'Api请求日志',
|
||||
'href' => '/admin/api/log/index.html',
|
||||
'rule' => '/admin.api.log/index',
|
||||
'pid' => 66,
|
||||
'des' => 'Api请求日志',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'70' => [
|
||||
'name' => '插件市场',
|
||||
'pid' => 1,
|
||||
'href' => '/admin/plugins/index.html',
|
||||
'icon' => 'layui-icon layui-icon-component',
|
||||
'des' => '插件市场',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'71' => [
|
||||
'name' => '查看插件列表',
|
||||
'pid' => 70,
|
||||
'rule' => '/admin.plugins/index',
|
||||
'is_menu' => 2,
|
||||
'des' => '查看插件列表',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'72' => [
|
||||
'name' => '查看插件分类列表',
|
||||
'pid' => 70,
|
||||
'rule' => '/admin.plugins/category',
|
||||
'is_menu' => 2,
|
||||
'des' => '查看插件分类列表',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'73' => [
|
||||
'name' => '离线安装',
|
||||
'pid' => 70,
|
||||
'rule' => '/admin.plugins/offLineInstall',
|
||||
'is_menu' => 2,
|
||||
'des' => '离线安装',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'74' => [
|
||||
'name' => '卸载',
|
||||
'pid' => 70,
|
||||
'rule' => '/admin.plugins/uninstall',
|
||||
'is_menu' => 2,
|
||||
'des' => '卸载',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'75' => [
|
||||
'name' => '安装',
|
||||
'pid' => 70,
|
||||
'rule' => '/admin.plugins/install',
|
||||
'is_menu' => 2,
|
||||
'des' => '安装',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'76' => [
|
||||
'name' => '设置排序',
|
||||
'rule' => '/admin.menu/setSort',
|
||||
'is_menu' => 2,
|
||||
'pid' => 24,
|
||||
'des' => '设置排序',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'77' => [
|
||||
'name' => '会员管理',
|
||||
'pid' => 1,
|
||||
'href' => '/admin/member/index.html',
|
||||
'icon' => 'layui-icon layui-icon-username',
|
||||
'des' => '会员管理',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'78' => [
|
||||
'name' => '查看和搜索列表',
|
||||
'pid' => 77,
|
||||
'rule' => '/admin.member/index',
|
||||
'is_menu' => 2,
|
||||
'des' => '查看和搜索列表',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'79' => [
|
||||
'name' => '查看单条数据详情',
|
||||
'pid' => 77,
|
||||
'rule' => '/admin.member/info',
|
||||
'is_menu' => 2,
|
||||
'des' => '查看单条数据详情',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'80' => [
|
||||
'name' => '添加',
|
||||
'pid' => 77,
|
||||
'rule' => '/admin.member/add',
|
||||
'is_menu' => 2,
|
||||
'des' => '添加',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'81' => [
|
||||
'name' => '编辑',
|
||||
'pid' => 77,
|
||||
'rule' => '/admin.member/edit',
|
||||
'is_menu' => 2,
|
||||
'des' => '编辑',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'82' => [
|
||||
'name' => '删除',
|
||||
'pid' => 77,
|
||||
'rule' => '/admin.member/del',
|
||||
'is_menu' => 2,
|
||||
'des' => '删除',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'83' => [
|
||||
'name' => '设置账号状态',
|
||||
'pid' => 77,
|
||||
'rule' => '/admin.member/setStatus',
|
||||
'is_menu' => 2,
|
||||
'des' => '设置账号状态',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'84' => [
|
||||
'name' => '回收站',
|
||||
'pid' => 77,
|
||||
'rule' => '/admin.member/recycle',
|
||||
'is_menu' => 2,
|
||||
'des' => '回收站',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'85' => [
|
||||
'name' => '还原',
|
||||
'pid' => 77,
|
||||
'rule' => '/admin.member/restore',
|
||||
'is_menu' => 2,
|
||||
'des' => '还原',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'86' => [
|
||||
'name' => '真实删除',
|
||||
'pid' => 77,
|
||||
'rule' => '/admin.member/trueDel',
|
||||
'is_menu' => 2,
|
||||
'des' => '真实删除',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'87' => [
|
||||
'name' => '复制菜单',
|
||||
'rule' => '/admin.menu/copy',
|
||||
'is_menu' => 2,
|
||||
'pid' => 24,
|
||||
'des' => '复制菜单',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
'88' => [
|
||||
'name' => '移动菜单',
|
||||
'rule' => '/admin.menu/move',
|
||||
'is_menu' => 2,
|
||||
'pid' => 24,
|
||||
'des' => '复制菜单',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
];
|
||||
|
||||
$table->setData($data)->create();
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
class AdminRole 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_role', [
|
||||
'engine' => 'InnoDB',
|
||||
'comment' => '后台角色',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
]);
|
||||
|
||||
if ($table->exists()) {
|
||||
$table->drop();
|
||||
}
|
||||
|
||||
$table
|
||||
->addColumn('name', 'string', ['length' => 100, 'default' => '', 'comment' => '角色名'])
|
||||
->addColumn('create_time', 'datetime', ['null' => 1, 'comment' => '创建时间'])
|
||||
->addColumn('update_time', 'datetime', ['null' => 1, 'comment' => '更新时间'])
|
||||
->addColumn('delete_time', 'datetime', ['null' => 1, 'comment' => '删除时间'])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
class AdminMenuRole 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_menu_role', [
|
||||
'engine' => 'InnoDB',
|
||||
'comment' => '角色与菜单关系',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
]);
|
||||
|
||||
if ($table->exists()) {
|
||||
$table->drop();
|
||||
}
|
||||
|
||||
$table
|
||||
->addColumn('admin_menu_id', 'integer', ['length' => 11, 'default' => 0, 'comment' => '菜单ID'])
|
||||
->addColumn('admin_role_id', 'integer', ['length' => 11, 'default' => 0, 'comment' => '角色ID'])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
class AdminUser 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_user', [
|
||||
'engine' => 'InnoDB',
|
||||
'comment' => '后台管理员',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
]);
|
||||
|
||||
if ($table->exists()) {
|
||||
$table->drop();
|
||||
}
|
||||
|
||||
$table
|
||||
->addColumn('username', 'string', ['length' => 100, 'default' => '', 'comment' => '用户名'])
|
||||
->addColumn('nickname', 'string', ['length' => 100, 'default' => '', 'comment' => '昵称'])
|
||||
->addColumn('password', 'string', ['length' => 100, 'default' => '', 'comment' => '密码'])
|
||||
->addColumn('avatar', 'string', ['length' => 100, 'default' => '', 'comment' => '头像'])
|
||||
->addColumn('is_super_manager', 'boolean', ['length' => 4, 'default' => 2, 'comment' => '是否超管.2=否,1=是'])
|
||||
->addColumn('status', 'boolean', ['length' => 4, 'default' => 1, 'comment' => '状态.2.禁用,1.正常'])
|
||||
->addColumn('login_time', 'datetime', ['null' => 1, 'comment' => '登录时间'])
|
||||
->addColumn('login_ip', 'string', ['length' => 255, 'default' => '', 'comment' => '登录IP'])
|
||||
->addColumn('create_time', 'datetime', ['null' => 1, 'comment' => '创建时间'])
|
||||
->addColumn('update_time', 'datetime', ['null' => 1, 'comment' => '更新时间'])
|
||||
->addColumn('delete_time', 'datetime', ['null' => 1, 'comment' => '删除时间']);
|
||||
|
||||
$data = [
|
||||
'username' => 'admin',
|
||||
'nickname' => '超级管理员',
|
||||
'password' => \laytp\library\Str::createPassword('123456'),
|
||||
'is_super_manager' => 1,
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
];
|
||||
|
||||
$table->insert($data)->create();
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
class AdminRoleUser 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_role_user', [
|
||||
'engine' => 'InnoDB',
|
||||
'comment' => '角色与管理员关系',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
]);
|
||||
|
||||
if ($table->exists()) {
|
||||
$table->drop();
|
||||
}
|
||||
|
||||
$table
|
||||
->addColumn('admin_user_id', 'integer', ['length' => 11, 'default' => 0, 'comment' => '用户ID'])
|
||||
->addColumn('admin_role_id', 'integer', ['length' => 11, 'default' => 0, 'comment' => '角色ID'])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
class User extends Migrator
|
||||
{
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('user', [
|
||||
'engine' => 'InnoDB',
|
||||
'comment' => '会员管理',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
]);
|
||||
|
||||
//删除表
|
||||
if ($table->exists()) {
|
||||
$table->drop();
|
||||
}
|
||||
|
||||
$table
|
||||
->addColumn('email', 'string', ['limit' => 255, 'default' => '', 'comment' => '邮箱'])
|
||||
->addColumn('password', 'string', ['limit' => 255, 'default' => '', 'comment' => '密码'])
|
||||
->addColumn('nickname', 'string', ['limit' => 255, 'default' => '', 'comment' => '昵称'])
|
||||
->addColumn('sex', 'boolean', ['limit' => 4, 'default' => '0', 'comment' => '性别.1=男,2=女,'])
|
||||
->addColumn('vip_time', 'integer', ['limit' => 11, 'default' => '0', 'comment' => 'vip到期时间.单位秒.0表示未开通过vip'])
|
||||
->addColumn('avatar', 'string', ['limit' => 255, 'default' => '', 'comment' => '头像'])
|
||||
->addColumn('login_time', 'datetime', ['comment' => '注册时间'])
|
||||
->addColumn('login_ip', 'string', ['limit' => 255, 'default' => '', 'comment' => '登录IP'])
|
||||
->addColumn('status', 'boolean', ['limit' => 4, 'default' => '0', 'comment' => '账号状态.2=锁定,1=正常,默认:1'])
|
||||
->addColumn('create_time', 'datetime', ['comment' => '创建时间'])
|
||||
->addColumn('update_time', 'datetime', ['comment' => '更新时间'])
|
||||
->addColumn('delete_time', 'datetime', ['comment' => '删除时间'])
|
||||
;
|
||||
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
class Files extends Migrator
|
||||
{
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('files', [
|
||||
'engine' => 'InnoDB',
|
||||
'comment' => '附件管理',
|
||||
'collation' => 'utf8mb4_general_ci'
|
||||
]);
|
||||
|
||||
//删除表
|
||||
if ($table->exists()) {
|
||||
$table->drop();
|
||||
}
|
||||
|
||||
$table
|
||||
->addColumn('category_id', 'integer', ['limit' => 11, 'default' => '0','comment' => '所属分类'])
|
||||
->addColumn('name', 'string', ['limit' => 255, 'default' => '','comment' => '文件名称'])
|
||||
->addColumn('file_type', 'string', ['limit' => 255, 'default' => '','comment' => '文件类型.image=图片,video=视频,audio=音频,file=文件,'])
|
||||
->addColumn('path', 'string', ['limit' => 255, 'default' => '','comment' => '文件路径'])
|
||||
->addColumn('upload_type', 'string', ['limit' => 255, 'default' => '','comment' => '上传方式.local=本地上传,ali-oss=阿里云OSS,qiniu-kodo=七牛云KODO,'])
|
||||
->addColumn('via_server', 'string', ['limit' => 255, 'default' => 'via','comment' => '上传是否经过服务器。via=经过,unVia=不经过,默认via'])
|
||||
->addColumn('ext', 'string', ['limit' => 255, 'default' => '','comment' => '文件后缀'])
|
||||
->addColumn('size', 'string', ['limit' => 255, 'default' => '','comment' => '文件大小,字节数,单位B'])
|
||||
->addColumn('create_admin_user_id', 'integer', ['limit' => 11, 'default' => '0','comment' => '创建者'])
|
||||
->addColumn('update_admin_user_id', 'integer', ['limit' => 11, 'default' => '0','comment' => '最后更新者'])
|
||||
->addColumn('create_time', 'datetime', ['null' => 1, 'comment' => '创建时间'])
|
||||
->addColumn('update_time', 'datetime', ['null' => 1, 'comment' => '更新时间'])
|
||||
->addColumn('delete_time', 'datetime', ['null' => 1, 'comment' => '删除时间'])
|
||||
|
||||
;
|
||||
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
class UserToken extends Migrator
|
||||
{
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('user_token', [
|
||||
'engine' => 'InnoDB',
|
||||
'comment' => '会员token管理',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
]);
|
||||
|
||||
//删除表
|
||||
if ($table->exists()) {
|
||||
$table->drop();
|
||||
}
|
||||
|
||||
$table
|
||||
->addColumn('token', 'string', ['limit' => 255, 'default' => '', 'comment' => 'token'])
|
||||
->addColumn('user_id', 'integer', ['limit' => 11, 'default' => '0', 'comment' => '用户ID'])
|
||||
->addColumn('create_time', 'integer', ['limit' => 11, 'default' => '0', 'comment' => '创建时间'])
|
||||
->addColumn('expire_time', 'integer', ['limit' => 11, 'default' => '0', 'comment' => '有效期']);
|
||||
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
class AdminLoginLog extends Migrator
|
||||
{
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('admin_login_log', [
|
||||
'engine' => 'InnoDB',
|
||||
'comment' => '后台登录日志管理',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
]);
|
||||
|
||||
//删除表
|
||||
if ($table->exists()) {
|
||||
$table->drop();
|
||||
}
|
||||
|
||||
$table
|
||||
->addColumn('login_status', 'boolean', ['limit' => 4, 'default' => '0', 'comment' => '登录状态.1=成功,2=失败'])
|
||||
->addColumn('admin_id', 'integer', ['limit' => 11, 'default' => '0', 'comment' => '登录者'])
|
||||
->addColumn('request_body', 'text', ['comment' => 'body参数'])
|
||||
->addColumn('request_header', 'text', ['comment' => 'header参数'])
|
||||
->addColumn('ip', 'string', ['limit' => 255, 'default' => '', 'comment' => 'ip'])
|
||||
->addColumn('create_time', 'datetime', ['null' => 1, 'comment' => '创建时间'])
|
||||
;
|
||||
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
class AdminActionLog extends Migrator
|
||||
{
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('admin_action_log', [
|
||||
'engine' => 'InnoDB',
|
||||
'comment' => '后台操作日志管理',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
]);
|
||||
|
||||
//删除表
|
||||
if ($table->exists()) {
|
||||
$table->drop();
|
||||
}
|
||||
|
||||
$table
|
||||
->addColumn('admin_id', 'integer', ['limit' => 11, 'default' => '0', 'comment' => '登录者'])
|
||||
->addColumn('rule', 'string', ['limit' => 255, 'default' => '', 'comment' => '路由规则'])
|
||||
->addColumn('menu', 'string', ['limit' => 255, 'default' => '', 'comment' => '操作菜单'])
|
||||
->addColumn('request_body', 'text', ['comment' => 'body参数'])
|
||||
->addColumn('request_header', 'text', ['comment' => 'header参数'])
|
||||
->addColumn('ip', 'string', ['limit' => 255, 'default' => '', 'comment' => 'ip'])
|
||||
->addColumn('create_time', 'datetime', ['null' => 1, 'comment' => '创建时间'])
|
||||
;
|
||||
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
class Conf extends Migrator
|
||||
{
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('conf', [
|
||||
'engine' => 'InnoDB',
|
||||
'comment' => '系统配置',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
]);
|
||||
|
||||
//删除表
|
||||
if ($table->exists()) {
|
||||
$table->drop();
|
||||
}
|
||||
|
||||
$table
|
||||
->addColumn('group', 'string', ['limit' => 255, 'default' => '', 'comment' => '配置分组'])
|
||||
->addColumn('key', 'string', ['limit' => 255, 'default' => '', 'comment' => '配置key'])
|
||||
->addColumn('value', 'text', ['comment' => '配置值'])
|
||||
->addColumn('form_type', 'string', ['limit' => 255, 'default' => '', 'comment' => '配置表单元素'])
|
||||
;
|
||||
|
||||
$data = [
|
||||
'1' => [
|
||||
'group' => 'system.upload',
|
||||
'key' => 'defaultType',
|
||||
'value' => 'local',
|
||||
'form_type' => 'xmSelect',
|
||||
],
|
||||
'2' => [
|
||||
'group' => 'system.upload',
|
||||
'key' => 'size',
|
||||
'value' => '200MB',
|
||||
'form_type' => 'input',
|
||||
],
|
||||
'3' => [
|
||||
'group' => 'system.upload',
|
||||
'key' => 'mime',
|
||||
'value' => 'png,jpg,gif,jpeg,doc,xls,pdf',
|
||||
'form_type' => 'input',
|
||||
],
|
||||
];
|
||||
|
||||
$table->setData($data)->create();
|
||||
}
|
||||
}
|
||||
Executable
+67507
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
class PluginApiDoc extends Migrator
|
||||
{
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('plugin_apidoc', [
|
||||
'engine' => 'InnoDB',
|
||||
'comment' => 'Api文档',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
]);
|
||||
|
||||
//删除表
|
||||
if ($table->exists()) {
|
||||
$table->drop();
|
||||
}
|
||||
|
||||
$table
|
||||
->addColumn('title', 'string', ['limit' => 255, 'default' => '', 'comment' => '标题'])
|
||||
->addColumn('des', 'text', ['comment' => '描述'])
|
||||
->addColumn('create_time', 'datetime', ['null' => 1, 'comment' => '创建时间'])
|
||||
->addColumn('update_time', 'datetime', ['null' => 1, 'comment' => '更新时间'])
|
||||
->addColumn('delete_time', 'datetime', ['null' => 1, 'comment' => '删除时间'])
|
||||
;
|
||||
|
||||
$data = [
|
||||
[
|
||||
'title' => '文档更新',
|
||||
'des' => '本文档分为两个部分,`全局说明文档`和`其他文档`。
|
||||
|
||||
# 全局说明文档
|
||||
全局说明下的文档在后台生成Api文档菜单中进行添加,添加完成后点击生成Api文档按钮即可在本文档中看见
|
||||
|
||||
# 其他文档
|
||||
其他文档使用PHP程序,通过PHP的类反射机制,获取到`app/controller/api/`目录下所有文件的注解来进行生成。
|
||||
|
||||
注解规则请查阅`laytp.com`官网手册或者框架`app/controller/api/Demo.php`文件。
|
||||
|
||||
如果后端程序员更新了`api`接口程序,并且使用了相应的注解规则,在后台点击`生成Api文档`按钮即可在本文档看到最新的Api文档
|
||||
|
||||
# 注意点
|
||||
由于文档使用的是静态html展示,而浏览器对html页面是有缓存的。所以如果文档进行了更新。可能需要强制刷新页面才能看到最新的文档。',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
[
|
||||
'title' => '在线测试功能使用',
|
||||
'des' => '本文档使用`Laytp极速后台开发框架 - 生成Api文档插件`进行生成。
|
||||
如果需要使用本文档的在线测试功能,需要先进行Api文档配置。
|
||||
|
||||
### Api文档配置
|
||||
点击本文档右上角配置图标会弹出配置层。
|
||||
配置项包括:Api请求域名、签名开关、Header参数。
|
||||
|
||||
#### Api请求域名
|
||||
后台使用单域名部署模式,则无需修改,使用默认值即可。
|
||||
后台使用多域名部署模式,则后端程序员需要提供请求Api的域名地址。使用者不要以/结尾,将请求Api的域名地址填入此处
|
||||
|
||||
#### 签名开关
|
||||
请求Api有签名中间件,签名中间件是否启用要根据后台[系统配置 - 基础配置 - Api签名开关]是否开启的配置来决定。如果后台配置[Api签名开关]开启了,此处也要开启。此处开启后,使用本文档的在线测试功能时,在ajax请求头部会自动添加request-time和sign两个参数。至于签名具体如何生成,请查阅[签名相关]章节说明
|
||||
|
||||
#### Header参数
|
||||
此处填入后端程序员自定义的请求头部参数。框架自定义的请求头部参数有用户登录凭证token,请求时间戳request-time,签名sign三个。一个复杂的系统,一般还会在Header头部定义一些公用参数。比如平台标识,代理标识等等。这些公用参数根据需求不同由后端程序员定义,在使用本文档时,自行在此处进行添加
|
||||
|
||||
### 配置保存
|
||||
点击保存按钮,或者点击页面阴影部分遮罩层,配置都会进行保存
|
||||
|
||||
### 配置持久化
|
||||
Api文档配置使用的是localStorage存储在浏览器端进行持久化的。无需担心页面关闭后,配置不存在的问题',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
[
|
||||
'title' => '统一说明',
|
||||
'des' => '# 请求方式
|
||||
默认使用POST方式进行请求
|
||||
|
||||
# 请求头Content-Type
|
||||
请求头的Content-Type定义请求参数的数据类型。ThinkPHP6兼容多种常用请求头方式。比如`application/json`、`application/form-data`和 `application/x-www-form-urlencoded`。
|
||||
|
||||
一般的接口,客户端可以使用`application/json`,自行将参数定义成`json`格式进行参数传递。
|
||||
|
||||
文件上传不支持`json`方式上传文件`Base64`内容,需要使用提交表单方式上传文件。
|
||||
|
||||
# 接口域名
|
||||
- 正式环境
|
||||
由后端程序员提供
|
||||
|
||||
- 测试环境
|
||||
由后端程序员提供
|
||||
|
||||
# 后台地址
|
||||
- 正式环境
|
||||
- 访问地址
|
||||
由后端程序员提供
|
||||
- 账号
|
||||
admin
|
||||
- 密码
|
||||
123456
|
||||
- 测试环境
|
||||
- 访问地址
|
||||
由后端程序员提供
|
||||
- 账号
|
||||
admin
|
||||
- 密码
|
||||
123456',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
[
|
||||
'title' => '签名相关',
|
||||
'des' => '客户端请求Api接口程序,后端有签名中间件对请求进行拦截。
|
||||
|
||||
签名中间件是否启用要根据后台[系统配置 - 基础配置 - Api签名开关]是否开启的配置来决定。
|
||||
|
||||
如果后台配置[Api签名开关]开启了,那么客户端在请求Api接口时,需要在Header部分传递两个参数`request-time`和`sign`。
|
||||
|
||||
`request-time`的值由客户端自行定义为当前Unix时间戳。
|
||||
|
||||
`sign`的值由签名生成规则计算生成。
|
||||
|
||||
# 签名生成规则
|
||||
- 客户端自行定义request-time的值为当前Unix时间戳,并经过`md5`运算得到`stringA`
|
||||
|
||||
- 后台系统配置 - 基础配置 - Api签名Key的值为生成签名的Key,并经过`md5`运算得到`stringB`
|
||||
|
||||
- 连接`stringA`和`stringB`后经过`md5`运算得到`stringC`
|
||||
|
||||
- 最后将`stringC`全部转成大写即是客户端需要在请求头部分传递的`sign`值',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
[
|
||||
'title' => '接口返回',
|
||||
'des' => '接口统一返回`json`格式的数据。
|
||||
|
||||
# 返回说明
|
||||
|
||||
|参数名|必然存在|类型|说明|
|
||||
|:---- |:---|:----- |----- |
|
||||
|code |是 |integer |接口返回码.0=常规正确码,表示常规操作成功;1=常规错误码,客户端仅需提示message;其他返回码与具体业务相关。框架实现了的唯一其他返回码:10401,前端需要跳转至登录界面。在一个复杂的交互过程中,你可能需要自行定义其他返回码|
|
||||
|msg |是 |string | 接口返回文字描述 |
|
||||
|time |是 |integer | 接口返回时间戳,单位秒 |
|
||||
|data |是 |object/array | 附加数据。单条数据是对象,多条数据是数组。当为空时,会返回一个空对象{}|
|
||||
|
||||
# 返回示例
|
||||
```
|
||||
{
|
||||
"code":1,
|
||||
"msg":"签名错误",
|
||||
"time":1613628412,
|
||||
"data":{}
|
||||
}
|
||||
```',
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
'update_time' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
];
|
||||
|
||||
$table->setData($data)->create();
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
class ApiLog extends Migrator
|
||||
{
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('api_log', [
|
||||
'engine' => 'InnoDB',
|
||||
'comment' => 'Api请求日志管理',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
]);
|
||||
|
||||
//删除表
|
||||
if ($table->exists()) {
|
||||
$table->drop();
|
||||
}
|
||||
|
||||
$table
|
||||
->addColumn('rule', 'string', ['limit' => 255, 'default' => '', 'comment' => '路由规则'])
|
||||
->addColumn('request_body', 'text', ['comment' => 'body参数'])
|
||||
->addColumn('request_header', 'text', ['comment' => 'header参数'])
|
||||
->addColumn('ip', 'string', ['limit' => 255, 'default' => '', 'comment' => 'ip'])
|
||||
->addColumn('status_code', 'string', ['limit' => 255, 'default' => '', 'comment' => '返回状态码'])
|
||||
->addColumn('response_body', 'string', ['limit' => 255, 'default' => '', 'comment' => '返回内容'])
|
||||
->addColumn('create_time', 'datetime', ['null' => 1, 'comment' => '创建时间'])
|
||||
;
|
||||
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
class Member extends Migrator
|
||||
{
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('member', [
|
||||
'engine' => 'InnoDB',
|
||||
'comment' => '会员管理',
|
||||
'collation' => 'utf8mb4_general_ci'
|
||||
]);
|
||||
|
||||
//删除表
|
||||
if ($table->exists()) {
|
||||
$table->drop();
|
||||
}
|
||||
|
||||
$table
|
||||
->addColumn('email', 'string', ['limit' => 2551, 'null' => 1, 'default' => '','comment' => '邮箱'])
|
||||
->addColumn('password', 'string', ['limit' => 255, 'null' => 1, 'default' => '','comment' => '密码'])
|
||||
->addColumn('nickname', 'string', ['limit' => 255, 'null' => 1, 'default' => '','comment' => '昵称'])
|
||||
->addColumn('sex', 'boolean', ['limit' => 4, 'null' => 1, 'default' => '0','comment' => '性别.1=男,2=女,'])
|
||||
->addColumn('vip_time', 'integer', ['limit' => 11, 'null' => 1, 'default' => '0','comment' => 'vip到期时间'])
|
||||
->addColumn('avatar_pic', 'string', ['limit' => 255, 'null' => 1, 'default' => '0','comment' => '头像'])
|
||||
->addColumn('login_time', 'datetime', ['null' => 1, 'comment' => '注册时间'])
|
||||
->addColumn('login_ip', 'string', ['limit' => 255, 'null' => 1, 'default' => '','comment' => '登录IP'])
|
||||
->addColumn('status', 'boolean', ['limit' => 4, 'null' => 1, 'default' => '0','comment' => '账号状态.2=锁定,1=正常,默认:1'])
|
||||
->addColumn('create_time', 'datetime', ['null' => 1, 'comment' => '创建时间'])
|
||||
->addColumn('update_time', 'datetime', ['null' => 1, 'comment' => '更新时间'])
|
||||
->addColumn('delete_time', 'datetime', ['null' => 1, 'comment' => '删除时间'])
|
||||
|
||||
;
|
||||
|
||||
$table->create();
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use think\facade\Config;
|
||||
use think\migration\Migrator;
|
||||
|
||||
class FilesCategory extends Migrator
|
||||
{
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('files_category', [
|
||||
'engine' => 'InnoDB',
|
||||
'comment' => '附件分类管理',
|
||||
'collation' => 'utf8mb4_general_ci'
|
||||
]);
|
||||
|
||||
//删除表
|
||||
if ($table->exists()) {
|
||||
$dbPrefix = Config::get('database.connections.' . Config::get('database.default') . '.prefix');
|
||||
$tableName = $table->getName();
|
||||
\think\facade\Db::execute('drop table if exists ' . $dbPrefix . $tableName);
|
||||
// $table->drop(); // 为什么不用这个方法来删除表,因为在我使用thinkphp6时,think-migrate的composer包并没有对这个方法进行具体实现,所以不能删除表
|
||||
}
|
||||
|
||||
$table
|
||||
->addColumn('name', 'string', ['limit' => 255, 'null' => 0, 'default' => '0', 'comment' => '分类名称'])
|
||||
->addColumn('pid', 'integer', ['limit' => 11, 'null' => 1, 'default' => '0', 'comment' => '父级'])
|
||||
->addColumn('sort', 'integer', ['limit' => 11, 'null' => 1, 'default' => '0', 'comment' => '排序'])
|
||||
->addColumn('create_time', 'datetime', ['null' => 1, 'comment' => '创建时间'])
|
||||
->addColumn('update_time', 'datetime', ['null' => 1, 'comment' => '更新时间'])
|
||||
->addColumn('delete_time', 'datetime', ['null' => 1, 'comment' => '删除时间'])
|
||||
|
||||
;
|
||||
|
||||
$data = [
|
||||
[
|
||||
'id' => '1',
|
||||
'name' => '默认分类',
|
||||
'pid' => '0',
|
||||
'sort' => '0',
|
||||
'create_time' => '2024-07-07 17:15:55',
|
||||
'update_time' => '2024-07-07 17:15:55',
|
||||
'delete_time' => '',
|
||||
],
|
||||
];
|
||||
|
||||
$table->setData($data)->create();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user