Compare commits

...

29 Commits

Author SHA1 Message Date
邹景立
ef35f1d616 修改数据库 2022-10-13 19:52:42 +08:00
邹景立
c67ced5b54 修改数据库 2022-10-13 19:50:05 +08:00
邹景立
6f0f54845e 合并数据库文件 2022-10-13 19:23:46 +08:00
邹景立
ad17150edb 修改数据库文件 2022-10-13 19:05:23 +08:00
邹景立
ffbb29512f Update 20221013031925_system_auth.php 2022-10-13 18:47:15 +08:00
邹景立
dd81cbf778 Update 20221013045837_base_postage_region.php 2022-10-13 18:44:39 +08:00
邹景立
bb7d78078e Update 20221013045837_base_postage_region.php 2022-10-13 18:40:44 +08:00
邹景立
c57bc6fb26 Update readme.md 2022-10-13 18:34:13 +08:00
邹景立
6f66b5cb3e Update readme.md 2022-10-13 18:31:57 +08:00
邹景立
095017c5f2 Update readme.md 2022-10-13 18:29:04 +08:00
邹景立
e53f6e25f9 删除数据库文件 2022-10-13 18:02:57 +08:00
邹景立
928a4d8122 修改项目文档 2022-10-13 18:02:50 +08:00
邹景立
e0fc5216e6 修改系统兼容 2022-10-13 17:37:20 +08:00
邹景立
191fced9ec 修改数据库 2022-10-13 17:13:26 +08:00
邹景立
6a7c9a2a0b 修改数据库文件 2022-10-13 17:10:09 +08:00
邹景立
a6709b275f 修改数据注释 2022-10-13 17:06:59 +08:00
邹景立
d09a587f03 增加数据库 2022-10-13 16:57:14 +08:00
邹景立
faa066cd44 Create 20221013045836_base_postage_company.php 2022-10-13 15:04:56 +08:00
邹景立
bd0e87a1e7 优化数据文件 2022-10-13 14:46:30 +08:00
邹景立
bffaeb75bb 修改数据库文件 2022-10-13 14:44:33 +08:00
邹景立
7b7dda7827 修改数据文件 2022-10-13 14:40:07 +08:00
邹景立
5900ae17d4 Update 20221013032309_system_auth_node.php 2022-10-13 14:25:33 +08:00
邹景立
6e5816ef67 修改文档名称 2022-10-13 14:22:45 +08:00
邹景立
65314f5aea 增加微信数据库文件 2022-10-13 14:20:24 +08:00
邹景立
224f68ab1b Update 20221013045828_system_user.php 2022-10-13 13:16:33 +08:00
邹景立
5c864c8989 Update 20221013045619_system_queue.php 2022-10-13 13:11:54 +08:00
邹景立
607e13f8e4 完善系统管理数据库 2022-10-13 13:08:22 +08:00
邹景立
e6d809445d 默认使用 sqlite 数据库 2022-10-13 12:48:03 +08:00
邹景立
4d820e1618 增加数据文件 2022-10-13 12:01:15 +08:00
15 changed files with 5050 additions and 8973 deletions

1
.gitignore vendored
View File

@ -10,6 +10,7 @@ runtime
safefile
nbproject
composer.lock
database/sqlite.db
public/upload
public/.user.ini
public/favicon.ico

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,96 +0,0 @@
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- 尝试创建微信自动回复数据表
CREATE TABLE IF NOT EXISTS `wechat_auto`
(
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '类型(text,image,news)',
`time` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '延迟时间',
`code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '消息编号',
`appid` char(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '公众号APPID',
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '文本内容',
`image_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '图片链接',
`voice_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '语音链接',
`music_title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '音乐标题',
`music_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '音乐链接',
`music_image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '缩略图片',
`music_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '音乐描述',
`video_title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '视频标题',
`video_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '视频URL',
`video_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '视频描述',
`news_id` bigint(20) UNSIGNED NULL DEFAULT NULL COMMENT '图文ID',
`status` tinyint(1) UNSIGNED NULL DEFAULT 1 COMMENT '状态(0禁用,1启用)',
`create_by` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '创建人',
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_wechat_auto_type` (`type`) USING BTREE,
INDEX `idx_wechat_auto_keys` (`time`) USING BTREE,
INDEX `idx_wechat_auto_appid` (`appid`) USING BTREE,
INDEX `idx_wechat_auto_code` (`code`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT = '微信-回复'
ROW_FORMAT = COMPACT;
-- 调整字段名称长度
ALTER TABLE `system_queue`
MODIFY COLUMN `title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '任务名称' AFTER `code`;
-- 尝试创建数据字典数据表
CREATE TABLE IF NOT EXISTS `system_base`
(
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '数据类型',
`code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '数据代码',
`name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '数据名称',
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '数据内容',
`sort` bigint(20) NULL DEFAULT 0 COMMENT '排序权重',
`status` tinyint(1) NULL DEFAULT 1 COMMENT '数据状态(0禁用,1启动)',
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '删除状态(0正常,1已删)',
`deleted_at` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '删除时间',
`deleted_by` bigint(20) NULL DEFAULT 0 COMMENT '删除用户',
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_system_base_type` (`type`) USING BTREE,
INDEX `idx_system_base_code` (`code`) USING BTREE,
INDEX `idx_system_base_name` (`name`(191)) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT = '系统-字典'
ROW_FORMAT = COMPACT;
-- 权限表增加身份权限字段
ALTER TABLE `system_user`
ADD COLUMN `usertype` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '用户类型' AFTER `id`;
-- 尝试创建系统文件数据表
CREATE TABLE IF NOT EXISTS `system_file` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '上传类型',
`hash` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '文件哈希',
`name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '文件名称',
`xext` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '文件后缀',
`xurl` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '访问链接',
`xkey` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '文件路径',
`mime` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '文件类型',
`size` bigint(20) NULL DEFAULT 0 COMMENT '文件大小',
`uuid` bigint(20) NULL DEFAULT 0 COMMENT '用户编号',
`isfast` tinyint(1) NULL DEFAULT 0 COMMENT '是否秒传',
`issafe` tinyint(1) NULL DEFAULT 0 COMMENT '安全模式',
`status` tinyint(1) NULL DEFAULT 1 COMMENT '上传状态(1悬空,2落地)',
`create_at` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_at` datetime NULL DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_system_file_type`(`type`) USING BTREE,
INDEX `idx_system_file_hash`(`hash`) USING BTREE,
INDEX `idx_system_file_uuid`(`uuid`) USING BTREE,
INDEX `idx_system_file_xext`(`xext`) USING BTREE,
INDEX `idx_system_file_status`(`status`) USING BTREE,
INDEX `idx_system_file_issafe`(`issafe`) USING BTREE,
INDEX `idx_system_file_isfast`(`isfast`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统-文件' ROW_FORMAT = COMPACT;
SET FOREIGN_KEY_CHECKS = 1;

View File

@ -156,20 +156,12 @@
<td><a target="_blank" href="https://thinkadmin.top">ThinkAdmin Version {$version|default='6.0.0'}</a></td>
</tr>
<tr>
<th class="nowrap text-center">服务器信息</th>
<th class="nowrap text-center">服务器系统</th>
<td>{:php_uname()}</td>
</tr>
<tr>
<th class="nowrap text-center">服务器软件</th>
<td>{$request->server('SERVER_SOFTWARE',php_sapi_name())}</td>
</tr>
<tr>
<th class="nowrap text-center">PHP 版本</th>
<td>PHP Version {$Think.const.PHP_VERSION}</td>
</tr>
<tr>
<th class="nowrap text-center">MySQL 版本</th>
<td>MySQL Version {$app->db->query('SELECT VERSION()')[0]['VERSION()']}</td>
<th class="nowrap text-center">服务器环境</th>
<td>{$request->server('SERVER_SOFTWARE',php_sapi_name())}PHP {$Think.const.PHP_VERSION}</td>
</tr>
</tbody>
</table>

View File

@ -44,7 +44,8 @@
"scripts": {
"post-autoload-dump": [
"@php think service:discover",
"@php think vendor:publish"
"@php think vendor:publish",
"@php think migrate:run"
]
}
}

View File

@ -16,7 +16,7 @@
return [
// 默认使用的数据库连接配置
'default' => 'mysql',
'default' => 'sqlite',
// 自定义时间查询规则
'time_query_rule' => [],
// 自动写入时间戳字段
@ -25,7 +25,7 @@ return [
'datetime_format' => 'Y-m-d H:i:s',
// 数据库连接配置信息
'connections' => [
'mysql' => [
'mysql' => [
// 数据库类型
'type' => 'mysql',
// 服务器地址
@ -61,5 +61,21 @@ return [
// 开启字段类型缓存
'fields_cache' => !app()->isDebug(),
],
'sqlite' => [
'charset' => 'utf8',
// 数据库类型
'type' => 'sqlite',
// 数据库文件
'database' => app()->getRootPath() . 'database/sqlite.db',
// 监听执行日志
'trigger_sql' => true,
// 其他参数字段
'deploy' => 0,
'prefix' => '',
'hostname' => '',
'hostport' => '',
'username' => '',
'password' => '',
],
],
];

View File

@ -1,55 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class SystemUser 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_user1', ['comment' => '系统-用户', 'collation' => 'utf8mb4_general_ci']);
$table
->addColumn('usertype', 'string', ['limit' => 20, 'default' => '', 'comment' => '用户类型'])
->addColumn('username', 'string', ['limit' => 50, 'default' => '', 'comment' => '用户账号'])
->addColumn('password', 'string', ['limit' => 32, 'default' => '', 'comment' => '用户密码'])
->addColumn('nickname', 'string', ['limit' => 50, 'default' => '', 'comment' => '用户昵称'])
->addColumn('headimg', 'string', ['limit' => 255, 'default' => '', 'comment' => '头像地址'])
->addColumn('authorize', 'string', ['limit' => 255, 'default' => '', 'comment' => '权限授权'])
->addColumn('contact_qq', 'string', ['limit' => 20, 'default' => '', 'comment' => '联系QQ'])
->addColumn('contact_mail', 'string', ['limit' => 20, 'default' => '', 'comment' => '联系邮箱'])
->addColumn('contact_phone', 'string', ['limit' => 20, 'default' => '', 'comtent' => '联系手机'])
->addColumn('login_ip', 'string', ['limit' => 20, 'default' => '', 'comment' => '登录地址'])
->addColumn('login_at', 'string', ['limit' => 20, 'default' => '', 'comment' => '登录时间'])
->addColumn('login_num', 'bigint', ['limit' => 20, 'default' => 0, 'comment' => '登录次数'])
->addColumn('describe', 'string', ['limit' => 255, 'default' => '', 'comment' => '备注说明'])
->addColumn('status', 'bigint', ['limit' => 20, 'default' => 1, 'comment' => '状态(0禁用,1启用)'])
->addColumn('sort', 'bigint', ['limit' => 20, 'default' => 0, 'comment' => '排序权重'])
->addColumn('is_deleted', 'bigint', ['limit' => 20, 'default' => 0, 'comment' => '删除(1删除,0未删)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('status', ['name' => 'idx_system_user_status'])
->addIndex('username', ['name' => 'idx_system_user_username'])
->addIndex('is_deleted', ['name' => 'idx_system_user_deleted'])
->save();
}
}

View File

@ -0,0 +1,352 @@
<?php
use think\migration\Migrator;
/**
* 系统模块数据
*/
class InstallAdmin extends Migrator
{
public function change()
{
$this->_auth();
$this->_base();
$this->_conf();
$this->_data();
$this->_file();
$this->_menu();
$this->_node();
$this->_oplog();
$this->_queue();
$this->_user();
}
private function _auth()
{
// 当前操作
$table = 'system_auth';
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-权限',
])
->addColumn('title', 'string', ['limit' => 80, 'default' => '', 'comment' => '权限名称'])
->addColumn('utype', 'string', ['limit' => 50, 'default' => '', 'comment' => '身份权限'])
->addColumn('desc', 'string', ['limit' => 500, 'default' => '', 'comment' => '备注说明'])
->addColumn('sort', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '排序权重'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '状态(0禁用,1启用)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('sort', ['name' => 'idx_system_auth_sort'])
->addIndex('title', ['name' => 'idx_system_auth_title'])
->addIndex('status', ['name' => 'idx_system_auth_status'])
->save();
}
private function _node()
{
// 当前操作
$table = 'system_auth_node';
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-授权',
])
->addColumn('auth', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '角色编号'])
->addColumn('node', 'string', ['limit' => 200, 'default' => '', 'comment' => '节点路径'])
->addIndex('auth', ['name' => 'idx_system_auth_node_auth'])
->addIndex('node', ['name' => 'idx_system_auth_node_node'])
->save();
}
private function _base()
{
// 当前操作
$table = 'system_base';
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-字典',
])
->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'comment' => '数据类型'])
->addColumn('code', 'string', ['limit' => 100, 'default' => '', 'comment' => '数据代码'])
->addColumn('name', 'string', ['limit' => 500, 'default' => '', 'comment' => '数据名称'])
->addColumn('content', 'text', ['default' => '', 'comment' => '数据内容'])
->addColumn('sort', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '排序权重'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '状态(0禁用,1启用)'])
->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除(0正常,1已删)'])
->addColumn('deleted_at', 'string', ['limit' => 20, 'default' => '', 'comment' => '删除时间'])
->addColumn('deleted_by', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '删除用户'])
->addIndex('type', ['name' => 'idx_system_base_type'])
->addIndex('code', ['name' => 'idx_system_base_code'])
->addIndex('name', ['name' => 'idx_system_base_name'])
->addIndex('sort', ['name' => 'idx_system_base_sort'])
->addIndex('status', ['name' => 'idx_system_base_status'])
->addIndex('deleted', ['name' => 'idx_system_base_deleted'])
->save();
}
private function _conf()
{
// 当前操作
$table = 'system_config';
// 存在则跳过
if ($this->hasTable($table)) return;
// 创建数据表
$this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-配置',
])
->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'comment' => '配置分类'])
->addColumn('name', 'string', ['limit' => 100, 'default' => '', 'comment' => '配置名称'])
->addColumn('value', 'string', ['limit' => 2048, 'default' => '', 'comment' => '配置内容'])
->addIndex('type', ['name' => 'idx_system_config_type'])
->addIndex('name', ['name' => 'idx_system_config_name'])
->save();
// 初始化配置信息
$this->execute(<<<SQL
INSERT INTO {$table} VALUES (1, 'base', 'app_name', 'ThinkAdmin');
INSERT INTO {$table} VALUES (2, 'base', 'app_version', 'v6');
INSERT INTO {$table} VALUES (3, 'base', 'beian', '');
INSERT INTO {$table} VALUES (4, 'base', 'editor', 'ckeditor5');
INSERT INTO {$table} VALUES (5, 'base', 'login_image', '');
INSERT INTO {$table} VALUES (6, 'base', 'login_name', '系统管理');
INSERT INTO {$table} VALUES (7, 'base', 'miitbeian', '');
INSERT INTO {$table} VALUES (8, 'base', 'site_copy', '©版权所有 2014-2022 楚才科技');
INSERT INTO {$table} VALUES (9, 'base', 'site_host', '');
INSERT INTO {$table} VALUES (10, 'base', 'site_icon', 'https://v6.thinkadmin.top/upload/4b/5a423974e447d5502023f553ed370f.png');
INSERT INTO {$table} VALUES (11, 'base', 'site_name', 'ThinkAdmin');
INSERT INTO {$table} VALUES (12, 'base', 'site_theme', 'default');
INSERT INTO {$table} VALUES (13, 'base', 'xpath', 'admin');
INSERT INTO {$table} VALUES (14, 'storage', 'alioss_http_protocol', 'http');
INSERT INTO {$table} VALUES (15, 'storage', 'allow_exts', 'doc,gif,ico,jpg,mp3,mp4,p12,pem,png,zip,rar,xls,xlsx');
INSERT INTO {$table} VALUES (16, 'storage', 'link_type', 'none');
INSERT INTO {$table} VALUES (17, 'storage', 'local_http_domain', '');
INSERT INTO {$table} VALUES (18, 'storage', 'local_http_protocol', 'follow');
INSERT INTO {$table} VALUES (19, 'storage', 'name_type', 'xmd5');
INSERT INTO {$table} VALUES (20, 'storage', 'type', 'local');
INSERT INTO {$table} VALUES (21, 'wechat', 'type', 'api');
INSERT INTO {$table} VALUES (22, 'storage', 'qiniu_http_protocol', 'http');
SQL
);
}
private function _data()
{
// 当前操作
$table = 'system_data';
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-数据',
])
->addColumn('name', 'string', ['limit' => 100, 'default' => '', 'comment' => '配置名'])
->addColumn('value', 'text', ['default' => '', 'comment' => '配置值'])
->addIndex('type', ['name' => 'idx_system_data_name'])
->save();
}
private function _file()
{
// 当前操作
$table = 'system_file';
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-文件',
])
->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'comment' => '上传类型'])
->addColumn('hash', 'string', ['limit' => 32, 'default' => '', 'comment' => '文件哈希'])
->addColumn('name', 'string', ['limit' => 200, 'default' => '', 'comment' => '文件名称'])
->addColumn('xext', 'string', ['limit' => 100, 'default' => '', 'comment' => '文件后缀'])
->addColumn('xurl', 'string', ['limit' => 500, 'default' => '', 'comment' => '访问链接'])
->addColumn('xkey', 'string', ['limit' => 500, 'default' => '', 'comment' => '文件路径'])
->addColumn('mime', 'string', ['limit' => 100, 'default' => '', 'comment' => '文件类型'])
->addColumn('size', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '文件大小'])
->addColumn('uuid', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '用户编号'])
->addColumn('isfast', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '是否秒传'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '状态(0禁用,1启用)'])
->addColumn('create_at', 'datetime', ['limit' => 20, 'default' => '', 'comment' => '创建时间'])
->addColumn('update_at', 'datetime', ['limit' => 20, 'default' => 0, 'comment' => '更新时间'])
->addIndex('type', ['name' => 'idx_system_file_type'])
->addIndex('hash', ['name' => 'idx_system_file_hash'])
->addIndex('uuid', ['name' => 'idx_system_file_uuid'])
->addIndex('xext', ['name' => 'idx_system_file_xext'])
->addIndex('status', ['name' => 'idx_system_file_status'])
->addIndex('issafe', ['name' => 'idx_system_file_issafe'])
->addIndex('isfast', ['name' => 'idx_system_file_isfast'])
->save();
}
private function _menu()
{
// 当前操作
$table = 'system_menu';
// 存在则跳过
if ($this->hasTable($table)) return;
// 创建数据表
$this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-菜单',
])
->addColumn('pid', 'integer', ['limit' => 20, 'default' => 1, 'comment' => '上级编号'])
->addColumn('title', 'string', ['limit' => 100, 'default' => '', 'comment' => '菜单名称'])
->addColumn('icon', 'string', ['limit' => 100, 'default' => '', 'comment' => '菜单图标'])
->addColumn('node', 'string', ['limit' => 100, 'default' => '', 'comment' => '节点代码'])
->addColumn('url', 'string', ['limit' => 500, 'default' => '', 'comment' => '链接节点'])
->addColumn('params', 'string', ['limit' => 500, 'default' => '', 'comment' => '链接参数'])
->addColumn('target', 'string', ['limit' => 20, 'default' => '_self', 'comment' => '打开方式'])
->addColumn('sort', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '排序权重'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '状态(0禁用,1启用)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('pid', ['name' => 'idx_system_menu_pid'])
->addIndex('sort', ['name' => 'idx_system_menu_sort'])
->addIndex('status', ['name' => 'idx_system_menu_status'])
->save();
// 初始化菜单数据
$this->execute(<<<SQL
INSERT INTO {$table} VALUES (1, 0, '控制台', '', '', '#', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (2, 1, '数据管理', '', '', '#', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (3, 2, '数据统计报表', 'layui-icon layui-icon-theme', 'data/total.portal/index', 'data/total.portal/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (4, 2, '轮播图片管理', 'layui-icon layui-icon-carousel', 'data/base.slider/index', 'data/base.slider/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (5, 2, '页面内容管理', 'layui-icon layui-icon-read', 'data/base.pager/index', 'data/base.pager/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (6, 2, '文章内容管理', 'layui-icon layui-icon-template', 'data/news.item/index', 'data/news.item/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (7, 2, '支付参数管理', 'layui-icon layui-icon-rmb', 'data/base.payment/index', 'data/base.payment/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (8, 2, '系统通知管理', 'layui-icon layui-icon-notice', 'data/base.message/index', 'data/base.message/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (9, 2, '微信小程序配置', 'layui-icon layui-icon-set', 'data/base.config/wxapp', 'data/base.config/wxapp', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (10, 2, '邀请二维码设置', 'layui-icon layui-icon-cols', 'data/base.config/cropper', 'data/base.config/cropper', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (11, 1, '用户管理', '', '', '#', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (12, 11, '会员用户管理', 'layui-icon layui-icon-user', 'data/user.admin/index', 'data/user.admin/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (13, 11, '余额充值管理', 'layui-icon layui-icon-rmb', 'data/user.balance/index', 'data/user.balance/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (14, 11, '用户返利管理', 'layui-icon layui-icon-transfer', 'data/user.rebate/index', 'data/user.rebate/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (15, 11, '用户提现管理', 'layui-icon layui-icon-component', 'data/user.transfer/index', 'data/user.transfer/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (16, 11, '用户等级管理', 'layui-icon layui-icon-senior', 'data/base.upgrade/index', 'data/base.upgrade/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (17, 11, '用户折扣方案', 'layui-icon layui-icon-set', 'data/base.discount/index', 'data/base.discount/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (18, 1, '商城管理', '', '', '#', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (19, 18, '商品数据管理', 'layui-icon layui-icon-star', 'data/shop.goods/index', 'data/shop.goods/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (20, 18, '商品分类管理', 'layui-icon layui-icon-tabs', 'data/shop.cate/index', 'data/shop.cate/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (21, 18, '订单数据管理', 'layui-icon layui-icon-template', 'data/shop.order/index', 'data/shop.order/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (22, 18, '订单发货管理', 'layui-icon layui-icon-transfer', 'data/shop.send/index', 'data/shop.send/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (23, 18, '快递公司管理', 'layui-icon layui-icon-website', 'data/base.postage.company/index', 'data/base.postage.company/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (24, 18, '邮费模板管理', 'layui-icon layui-icon-template-1', 'data/base.postage.template/index', 'data/base.postage.template/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (25, 0, '微信管理', '', '', '#', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (26, 25, '微信管理', '', '', '#', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (27, 26, '微信接口配置', 'layui-icon layui-icon-set', '', 'wechat/config/options', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (28, 26, '微信支付配置', 'layui-icon layui-icon-rmb', '', 'wechat/config/payment', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (29, 25, '微信定制', '', '', '#', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (30, 29, '微信粉丝管理', 'layui-icon layui-icon-username', '', 'wechat/fans/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (31, 29, '微信菜单配置', 'layui-icon layui-icon-cellphone', '', 'wechat/menu/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (32, 29, '微信图文管理', 'layui-icon layui-icon-template-1', '', 'wechat/news/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (33, 29, '回复规则管理', 'layui-icon layui-icon-engine', '', 'wechat/keys/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (34, 29, '关注自动回复', 'layui-icon layui-icon-release', 'wechat/auto/index', 'wechat/auto/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (35, 0, '系统管理', '', '', '#', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (36, 35, '系统配置', '', '', '#', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (37, 36, '系统参数配置', 'layui-icon layui-icon-set', '', 'admin/config/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (38, 36, '系统任务管理', 'layui-icon layui-icon-log', '', 'admin/queue/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (39, 36, '系统日志管理', 'layui-icon layui-icon-form', '', 'admin/oplog/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (40, 36, '数据字典管理', 'layui-icon layui-icon-code-circle', 'admin/base/index', 'admin/base/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (41, 36, '系统文件管理', 'layui-icon layui-icon-carousel', 'admin/file/index', 'admin/file/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (42, 36, '系统菜单管理', 'layui-icon layui-icon-layouts', '', 'admin/menu/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (43, 35, '权限管理', '', '', '#', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (44, 43, '访问权限管理', 'layui-icon layui-icon-vercode', '', 'admin/auth/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
INSERT INTO {$table} VALUES (45, 43, '系统用户管理', 'layui-icon layui-icon-username', '', 'admin/user/index', '', '_self', 0, 1, '2022-10-13 12:19:45');
SQL
);
}
private function _oplog()
{
// 当前操作
$table = 'system_oplog';
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-日志',
])
->addColumn('node', 'string', ['limit' => 200, 'default' => '', 'comment' => '当前操作节点'])
->addColumn('geoip', 'string', ['limit' => 20, 'default' => '', 'comment' => '操作者IP地址'])
->addColumn('action', 'string', ['limit' => 200, 'default' => '', 'comment' => '操作行为名称'])
->addColumn('content', 'string', ['limit' => 1024, 'default' => '', 'comment' => '操作内容描述'])
->addColumn('username', 'string', ['limit' => 50, 'default' => '', 'comment' => '操作人用户名'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
}
private function _queue()
{
// 当前操作
$table = 'system_queue';
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-任务',
])
->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'comment' => '任务编号'])
->addColumn('title', 'string', ['limit' => 100, 'default' => '', 'comment' => '任务名称'])
->addColumn('command', 'string', ['limit' => 500, 'default' => '', 'comment' => '执行指令'])
->addColumn('exec_pid', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '执行进程'])
->addColumn('exec_data', 'text', ['default' => '', 'comment' => '执行参数'])
->addColumn('exec_time', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '执行时间'])
->addColumn('exec_desc', 'string', ['limit' => 500, 'default' => '', 'comment' => '执行描述'])
->addColumn('enter_time', 'decimal', ['precision' => 20, 'scale' => 4, 'default' => 0, 'comment' => '开始时间'])
->addColumn('outer_time', 'decimal', ['precision' => 20, 'scale' => 4, 'default' => 0, 'comment' => '结束时间'])
->addColumn('loops_time', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '循环时间'])
->addColumn('attempts', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '执行次数'])
->addColumn('rscript', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '任务类型(0单例,1多例)'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '任务状态(1新任务,2处理中,3成功,4失败)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('code', ['name' => 'idx_system_queue_code'])
->addIndex('title', ['name' => 'idx_system_queue_title'])
->addIndex('status', ['name' => 'idx_system_queue_status'])
->addIndex('exec_time', ['name' => 'idx_system_queue_exec_time'])
->addIndex('create_at', ['name' => 'idx_system_queue_create_at'])
->save();
}
private function _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' => '', 'comment' => '用户类型'])
->addColumn('username', 'string', ['limit' => 50, 'default' => '', 'comment' => '用户账号'])
->addColumn('password', 'string', ['limit' => 32, 'default' => '', 'comment' => '用户密码'])
->addColumn('nickname', 'string', ['limit' => 50, 'default' => '', 'comment' => '用户昵称'])
->addColumn('headimg', 'string', ['limit' => 500, 'default' => '', 'comment' => '头像地址'])
->addColumn('authorize', 'string', ['limit' => 500, 'default' => '', 'comment' => '权限授权'])
->addColumn('contact_qq', 'string', ['limit' => 20, 'default' => '', 'comment' => '联系QQ'])
->addColumn('contact_mail', 'string', ['limit' => 20, 'default' => '', 'comment' => '联系邮箱'])
->addColumn('contact_phone', 'string', ['limit' => 20, 'default' => '', 'comment' => '联系手机'])
->addColumn('login_ip', 'string', ['limit' => 20, 'default' => '', 'comment' => '登录地址'])
->addColumn('login_at', 'string', ['limit' => 20, 'default' => '', 'comment' => '登录时间'])
->addColumn('login_num', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '登录次数'])
->addColumn('describe', 'string', ['limit' => 500, 'default' => '', 'comment' => '备注说明'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '状态(0禁用,1启用)'])
->addColumn('sort', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '排序权重'])
->addColumn('is_deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除(1删除,0未删)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('status', ['name' => 'idx_system_user_status'])
->addIndex('username', ['name' => 'idx_system_user_username'])
->addIndex('is_deleted', ['name' => 'idx_system_user_deleted'])
->save();
// 初始化默认数据
$data = [
'id' => 10000,
'username' => 'admin',
'nickname' => '超级管理员',
'password' => '21232f297a57a5a743894a0e4a801fc3',
'headimg' => 'https://thinkadmin.top/static/img/icon.png',
];
$this->table($table)->insert($data)->saveData();
}
}

View File

@ -0,0 +1,210 @@
<?php
use think\migration\Migrator;
/**
* 微信模块数据表
*/
class InstallWechat extends Migrator
{
public function change()
{
$this->_auto();
$this->_article();
$this->_fans();
$this->_media();
$this->_news();
$this->_tags();
$this->_keys();
}
private function _auto()
{
// 当前操作
$table = 'wechat_auto';
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-回复',
])
->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'comment' => '类型(text,image,news)'])
->addColumn('time', 'string', ['limit' => 50, 'default' => '', 'comment' => '延迟时间'])
->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'comment' => '消息编号'])
->addColumn('appid', 'string', ['limit' => 50, 'default' => '', 'comment' => '公众号编号'])
->addColumn('content', 'text', ['default' => '', 'comment' => '文本内容'])
->addColumn('image_url', 'string', ['limit' => 500, 'default' => '', 'comment' => '图片链接'])
->addColumn('voice_url', 'string', ['limit' => 500, 'default' => '', 'comment' => '语音链接'])
->addColumn('music_title', 'string', ['limit' => 500, 'default' => '', 'comment' => '音乐标题'])
->addColumn('music_url', 'string', ['limit' => 500, 'default' => '', 'comment' => '音乐链接'])
->addColumn('music_image', 'string', ['limit' => 500, 'default' => '', 'comment' => '缩略图片'])
->addColumn('music_desc', 'string', ['limit' => 500, 'default' => '', 'comment' => '音乐描述'])
->addColumn('video_title', 'string', ['limit' => 500, 'default' => '', 'comment' => '视频标题'])
->addColumn('video_url', 'string', ['limit' => 500, 'default' => '', 'comment' => '视频链接'])
->addColumn('video_desc', 'string', ['limit' => 500, 'default' => '', 'comment' => '视频描述'])
->addColumn('news_id', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '图文编号'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '状态(0禁用,1启用)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('code', ['name' => 'idx_wechat_auto_code'])
->addIndex('type', ['name' => 'idx_wechat_auto_type'])
->addIndex('time', ['name' => 'idx_wechat_auto_time'])
->addIndex('appid', ['name' => 'idx_wechat_auto_appid'])
->addIndex('status', ['name' => 'idx_wechat_auto_status'])
->save();
}
private function _fans()
{
// 当前操作
$table = 'wechat_fans';
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-粉丝',
])
->addColumn('appid', 'string', ['limit' => 50, 'default' => '', 'comment' => '公众号编号'])
->addColumn('unionid', 'string', ['limit' => 100, 'default' => '', 'comment' => 'UNIONID'])
->addColumn('openid', 'string', ['limit' => 100, 'default' => '', 'comment' => 'OPENID'])
->addColumn('tagid_list', 'string', ['limit' => 100, 'default' => '', 'comment' => '粉丝标签'])
->addColumn('is_black', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '黑名单状态'])
->addColumn('subscribe', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '黑名单状态'])
->addColumn('nickname', 'string', ['limit' => 200, 'default' => '', 'comment' => '用户昵称'])
->addColumn('sex', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '用户性别(1男性,2女性,0未知)'])
->addColumn('country', 'string', ['limit' => 50, 'default' => '', 'comment' => '用户所在国家'])
->addColumn('province', 'string', ['limit' => 50, 'default' => '', 'comment' => '用户所在省份'])
->addColumn('city', 'string', ['limit' => 50, 'default' => '', 'comment' => '用户所在城市'])
->addColumn('language', 'string', ['limit' => 50, 'default' => '', 'comment' => '用户的语言'])
->addColumn('headimgurl', 'string', ['limit' => 500, 'default' => '', 'comment' => '用户头像'])
->addColumn('subscribe_time', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '关注时间'])
->addColumn('subscribe_at', 'datetime', ['limit' => 20, 'default' => null, 'comment' => '关注时间'])
->addColumn('subscribe_scene', 'string', ['limit' => 200, 'default' => '', 'comment' => '扫码场景'])
->addColumn('qr_scene', 'string', ['limit' => 200, 'default' => '', 'comment' => '场景数值'])
->addColumn('qr_scene_str', 'string', ['limit' => 200, 'default' => '', 'comment' => '场景内容'])
->addColumn('remark', 'string', ['limit' => 500, 'default' => '', 'comment' => '用户备注'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('appid', ['name' => 'idx_wechat_fans_appid'])
->addIndex('openid', ['name' => 'idx_wechat_fans_openid'])
->addIndex('unionid', ['name' => 'idx_wechat_fans_unionid'])
->addIndex('is_black', ['name' => 'idx_wechat_fans_black'])
->addIndex('subscribe', ['name' => 'idx_wechat_fans_subscribe'])
->save();
}
private function _tags()
{
// 当前操作
$table = 'wechat_fans_tags';
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-标签',
])
->addColumn('appid', 'string', ['limit' => 50, 'default' => '', 'comment' => '公众号编号'])
->addColumn('name', 'string', ['limit' => 50, 'default' => '', 'comment' => '标签名称'])
->addColumn('openid', 'string', ['limit' => 100, 'default' => '', 'comment' => 'OPENID'])
->addColumn('count', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '粉丝数量'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('appid', ['name' => 'idx_wechat_fans_appid'])
->save();
}
private function _keys()
{
// 当前操作
$table = 'wechat_keys';
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-规则',
])
->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'comment' => '类型(text,image,news)'])
->addColumn('keys', 'string', ['limit' => 100, 'default' => '', 'comment' => '关键字'])
->addColumn('appid', 'string', ['limit' => 50, 'default' => '', 'comment' => '公众号编号'])
->addColumn('content', 'text', ['default' => '', 'comment' => '文本内容'])
->addColumn('image_url', 'string', ['limit' => 500, 'default' => '', 'comment' => '图片链接'])
->addColumn('voice_url', 'string', ['limit' => 500, 'default' => '', 'comment' => '语音链接'])
->addColumn('music_title', 'string', ['limit' => 500, 'default' => '', 'comment' => '音乐标题'])
->addColumn('music_url', 'string', ['limit' => 500, 'default' => '', 'comment' => '音乐链接'])
->addColumn('music_image', 'string', ['limit' => 500, 'default' => '', 'comment' => '缩略图片'])
->addColumn('music_desc', 'string', ['limit' => 500, 'default' => '', 'comment' => '音乐描述'])
->addColumn('video_title', 'string', ['limit' => 500, 'default' => '', 'comment' => '视频标题'])
->addColumn('video_url', 'string', ['limit' => 500, 'default' => '', 'comment' => '视频链接'])
->addColumn('video_desc', 'string', ['limit' => 500, 'default' => '', 'comment' => '视频描述'])
->addColumn('news_id', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '图文编号'])
->addColumn('sort', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '排序权重'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '状态(0禁用,1启用)'])
->addColumn('create_by', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '创建用户'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('sort', ['name' => 'idx_wechat_keys_sort'])
->addIndex('keys', ['name' => 'idx_wechat_keys_keys'])
->addIndex('type', ['name' => 'idx_wechat_keys_type'])
->addIndex('time', ['name' => 'idx_wechat_keys_time'])
->addIndex('appid', ['name' => 'idx_wechat_keys_appid'])
->addIndex('status', ['name' => 'idx_wechat_keys_status'])
->save();
}
private function _media()
{
// 当前操作
$table = 'wechat_media';
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-素材',
])
->addColumn('md5', 'string', ['limit' => 32, 'default' => '', 'comment' => '文件哈希'])
->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'comment' => '媒体类型'])
->addColumn('appid', 'string', ['limit' => 50, 'default' => '', 'comment' => '公众号编号'])
->addColumn('media_id', 'string', ['limit' => 100, 'default' => '', 'comment' => '永久素材MediaID'])
->addColumn('local_url', 'string', ['limit' => 500, 'default' => '', 'comment' => '本地文件链接'])
->addColumn('media_url', 'string', ['limit' => 500, 'default' => '', 'comment' => '远程图片链接'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('md5', ['name' => 'idx_wechat_media_md5'])
->addIndex('type', ['name' => 'idx_wechat_media_type'])
->addIndex('appid', ['name' => 'idx_wechat_media_appid'])
->addIndex('media_id', ['name' => 'idx_wechat_media_id'])
->save();
}
private function _news()
{
// 当前操作
$table = 'wechat_news';
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-图文',
])
->addColumn('media_id', 'string', ['limit' => 100, 'default' => '', 'comment' => '永久素材编号'])
->addColumn('local_url', 'string', ['limit' => 500, 'default' => '', 'comment' => '本地文件链接'])
->addColumn('article_id', 'string', ['limit' => 100, 'default' => '', 'comment' => '关联文章编号(用英文逗号做分割)'])
->addColumn('is_deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除(1删除,0未删)'])
->addColumn('create_by', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '创建用户'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->addIndex('media_id', ['name' => 'idx_wechat_news_media_id'])
->addIndex('article_id', ['name' => 'idx_wechat_news_article_id'])
->addIndex('is_deleted', ['name' => 'idx_wechat_news_deleted'])
->save();
}
private function _article()
{
// 当前操作
$table = 'wechat_news_article';
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-文章',
])
->addColumn('title', 'string', ['limit' => 100, 'default' => '', 'comment' => '素材标题'])
->addColumn('local_url', 'string', ['limit' => 500, 'default' => '', 'comment' => '素材链接'])
->addColumn('show_cover_pic', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '显示封面(0隐藏,1显示)'])
->addColumn('author', 'string', ['limit' => 20, 'default' => '', 'comment' => '文章作者'])
->addColumn('digest', 'string', ['limit' => 300, 'default' => '', 'comment' => '摘要内容'])
->addColumn('content', 'text', ['default' => '', 'comment' => '图文内容'])
->addColumn('content_source_url', 'string', ['limit' => 200, 'default' => '', 'comment' => '原文地址'])
->addColumn('read_num', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '阅读数量'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,277 @@
<?php
use think\migration\Migrator;
/**
* 用户数据
*/
class InstallUser extends Migrator
{
public function change()
{
$this->_user();
$this->_token();
$this->_rebate();
$this->_address();
$this->_balance();
$this->_payment();
$this->_message();
$this->_upgrade();
$this->_transfer();
}
private function _user()
{
// 当前操作
$table = "data_user";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-用户',
])
->addColumn('pid0', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '临时推荐人UID'])
->addColumn('pid1', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '推荐人一级UID'])
->addColumn('pid2', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '推荐人二级UID'])
->addColumn('pids', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '推荐人绑定状态'])
->addColumn('path', 'string', ['limit' => 999, 'default' => '-', 'comment' => '推荐关系路径'])
->addColumn('layer', 'integer', ['limit' => 20, 'default' => 1, 'comment' => '推荐关系层级'])
->addColumn('openid1', 'string', ['limit' => 50, 'default' => '', 'comment' => '小程序OPENID'])
->addColumn('openid2', 'string', ['limit' => 50, 'default' => '', 'comment' => '服务号OPENID'])
->addColumn('unionid', 'string', ['limit' => 50, 'default' => '', 'comment' => '公众号UnionID'])
->addColumn('phone', 'string', ['limit' => 20, 'default' => '', 'comment' => '用户手机'])
->addColumn('headimg', 'string', ['limit' => 500, 'default' => '', 'comment' => '用户头像'])
->addColumn('username', 'string', ['limit' => 50, 'default' => '', 'comment' => '用户姓名'])
->addColumn('nickname', 'string', ['limit' => 99, 'default' => '', 'comment' => '用户昵称'])
->addColumn('password', 'string', ['limit' => 32, 'default' => '', 'comment' => '登录密码'])
->addColumn('region_province', 'string', ['limit' => 30, 'default' => '', 'comment' => '所在省份'])
->addColumn('region_city', 'string', ['limit' => 30, 'default' => '', 'comment' => '所在城市'])
->addColumn('region_area', 'string', ['limit' => 30, 'default' => '', 'comment' => '所在区域'])
->addColumn('base_age', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '用户年龄'])
->addColumn('base_sex', 'string', ['limit' => 10, 'default' => '', 'comment' => '用户性别'])
->addColumn('base_height', 'string', ['limit' => 10, 'default' => '', 'comment' => '用户身高'])
->addColumn('base_weight', 'string', ['limit' => 10, 'default' => '', 'comment' => '用户体重'])
->addColumn('base_birthday', 'string', ['limit' => 20, 'default' => '', 'comment' => '用户生日'])
->addColumn('vip_code', 'integer', ['limit' => 20, 'default' => 0, 'comment' => 'VIP等级编号'])
->addColumn('vip_name', 'string', ['limit' => 30, 'default' => '普通用户', 'comment' => 'VIP等级名称'])
->addColumn('vip_order', 'string', ['limit' => 20, 'default' => '', 'comment' => 'VIP升级订单'])
->addColumn('vip_datetime', 'string', ['limit' => 20, 'default' => '', 'comment' => 'VIP等级时间'])
->addColumn('buy_vip_entry', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '是否入会礼包'])
->addColumn('buy_last_date', 'string', ['limit' => 20, 'default' => '', 'comment' => '最后支付时间'])
->addColumn('rebate_total', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '返利金额统计'])
->addColumn('rebate_used', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '返利提现统计'])
->addColumn('rebate_lock', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '返利锁定统计'])
->addColumn('balance_total', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '累计充值统计'])
->addColumn('balance_used', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '已经使用统计'])
->addColumn('teams_users_total', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '团队人数统计'])
->addColumn('teams_users_direct', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '直属人数团队'])
->addColumn('teams_users_indirect', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '间接人数团队'])
->addColumn('order_amount_total', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '订单交易统计'])
->addColumn('teams_amount_total', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '二级团队业绩'])
->addColumn('teams_amount_direct', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '直属团队业绩'])
->addColumn('teams_amount_indirect', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '间接团队业绩'])
->addColumn('remark', 'string', ['limit' => 500, 'default' => '', 'comment' => '用户备注描述'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '用户状态(1正常,0已黑)'])
->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除状态(0未删,1已删)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '注册时间'])
->save();
}
private function _upgrade()
{
// 当前操作
$table = "base_user_upgrade";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-用户-等级',
])
->addColumn('name', 'string', ['limit' => 200, 'default' => '', 'comment' => '用户级别名称'])
->addColumn('number', 'integer', ['limit' => 2, 'default' => 0, 'comment' => '用户级别序号'])
->addColumn('rebate_rule', 'string', ['limit' => 255, 'default' => '', 'comment' => '用户奖利规则'])
->addColumn('upgrade_type', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '会员升级规则(0单个,1同时)'])
->addColumn('upgrade_team', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '团队人数统计(0不计,1累计)'])
->addColumn('goods_vip_status', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '入会礼包状态'])
->addColumn('order_amount_status', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '订单金额状态'])
->addColumn('order_amount_number', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '订单金额累计'])
->addColumn('teams_users_status', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '团队人数状态'])
->addColumn('teams_users_number', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '团队人数累计'])
->addColumn('teams_direct_status', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '直推人数状态'])
->addColumn('teams_direct_number', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '直推人数累计'])
->addColumn('teams_indirect_status', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '间推人数状态'])
->addColumn('teams_indirect_number', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '间推人数累计'])
->addColumn('remark', 'string', ['limit' => 500, 'default' => '', 'comment' => '用户级别描述'])
->addColumn('utime', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '等级更新时间'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '用户等级状态(1使用,0禁用)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '等级创建时间'])
->save();
}
private function _transfer()
{
$table = "data_user_transfer";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-用户-提现',
])
->addColumn('uuid', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '用户UID'])
->addColumn('type', 'string', ['limit' => 30, 'default' => '', 'comment' => '提现方式'])
->addColumn('date', 'string', ['limit' => 20, 'default' => '', 'comment' => '提现日期'])
->addColumn('code', 'string', ['limit' => 100, 'default' => '', 'comment' => '提现单号'])
->addColumn('appid', 'string', ['limit' => 100, 'default' => '', 'comment' => '公众号APPID'])
->addColumn('openid', 'string', ['limit' => 100, 'default' => '', 'comment' => '公众号OPENID'])
->addColumn('charge_rate', 'decimal', ['precision' => 20, 'scale' => 4, 'default' => '0.0000', 'comment' => '提现手续费比例'])
->addColumn('charge_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '提现手续费金额'])
->addColumn('amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '提现转账金额'])
->addColumn('qrcode', 'string', ['limit' => 999, 'default' => '', 'comment' => '收款码图片地址'])
->addColumn('bank_wseq', 'string', ['limit' => 20, 'default' => '', 'comment' => '微信银行编号'])
->addColumn('bank_name', 'string', ['limit' => 100, 'default' => '', 'comment' => '开户银行名称'])
->addColumn('bank_bran', 'string', ['limit' => 100, 'default' => '', 'comment' => '开户分行名称'])
->addColumn('bank_user', 'string', ['limit' => 100, 'default' => '', 'comment' => '开户账号姓名'])
->addColumn('bank_code', 'string', ['limit' => 100, 'default' => '', 'comment' => '开户银行卡号'])
->addColumn('alipay_user', 'string', ['limit' => 100, 'default' => '', 'comment' => '支付宝姓名'])
->addColumn('alipay_code', 'string', ['limit' => 100, 'default' => '', 'comment' => '支付宝账号'])
->addColumn('remark', 'string', ['limit' => 200, 'default' => '', 'comment' => '提现描述'])
->addColumn('trade_no', 'string', ['limit' => 100, 'default' => '', 'comment' => '交易单号'])
->addColumn('trade_time', 'string', ['limit' => 20, 'default' => '', 'comment' => '打款时间'])
->addColumn('change_time', 'string', ['limit' => 20, 'default' => '', 'comment' => '处理时间'])
->addColumn('change_desc', 'string', ['limit' => 500, 'default' => '', 'comment' => '处理描述'])
->addColumn('audit_status', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '审核状态'])
->addColumn('audit_remark', 'string', ['limit' => 500, 'default' => '', 'comment' => '审核描述'])
->addColumn('audit_datetime', 'string', ['limit' => 20, 'default' => '', 'comment' => '审核时间'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '提现状态(0失败,1待审核,2已审核,3打款中,4已打款,5已收款)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
}
private function _token()
{
// 当前操作
$table = "data_user_token";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-用户-认证',
])
->addColumn('uuid', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '用户UID'])
->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'comment' => '授权类型'])
->addColumn('time', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '有效时间'])
->addColumn('token', 'string', ['limit' => 32, 'default' => '', 'comment' => '授权令牌'])
->addColumn('tokenv', 'string', ['limit' => 32, 'default' => '', 'comment' => '授权验证'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
}
private function _rebate()
{
// 当前操作
$table = "data_user_rebate";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-用户-返利',
])
->addColumn('uuid', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '用户UID'])
->addColumn('date', 'string', ['limit' => 20, 'default' => '', 'comment' => '奖励日期'])
->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'comment' => '奖励编号'])
->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'comment' => '奖励类型'])
->addColumn('name', 'string', ['limit' => 100, 'default' => '', 'comment' => '奖励名称'])
->addColumn('amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '奖励数量'])
->addColumn('order_no', 'string', ['limit' => 20, 'default' => '', 'comment' => '订单单号'])
->addColumn('order_uuid', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '订单用户'])
->addColumn('order_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '订单金额'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '生效状态(0未生效,1已生效)'])
->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除状态(0未删除,1已删除)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
}
private function _payment()
{
// 当前操作
$table = "data_user_payment";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-用户-支付',
])
->addColumn('order_no', 'string', ['limit' => 20, 'default' => '', 'comment' => '订单单号'])
->addColumn('order_name', 'string', ['limit' => 255, 'default' => '', 'comment' => '订单描述'])
->addColumn('order_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '订单金额'])
->addColumn('payment_code', 'string', ['limit' => 20, 'default' => '', 'comment' => '支付编号'])
->addColumn('payment_type', 'string', ['limit' => 50, 'default' => '', 'comment' => '支付通道'])
->addColumn('payment_trade', 'string', ['limit' => 100, 'default' => '', 'comment' => '支付单号'])
->addColumn('payment_status', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '支付状态'])
->addColumn('payment_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '支付金额'])
->addColumn('payment_datatime', 'string', ['limit' => 20, 'default' => '', 'comment' => '支付时间'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
}
private function _message()
{
// 当前操作
$table = "data_user_message";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-用户-短信',
])
->addColumn('type', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '短信类型'])
->addColumn('msgid', 'string', ['limit' => 50, 'default' => '', 'comment' => '消息编号'])
->addColumn('phone', 'string', ['limit' => 100, 'default' => '', 'comment' => '目标手机'])
->addColumn('region', 'string', ['limit' => 100, 'default' => '', 'comment' => '国家编号'])
->addColumn('result', 'string', ['limit' => 100, 'default' => '', 'comment' => '返回结果'])
->addColumn('content', 'string', ['limit' => 512, 'default' => '', 'comment' => '短信内容'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '短信状态(0失败,1成功)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
}
private function _balance()
{
// 当前操作
$table = "data_user_balance";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-用户-余额',
])
->addColumn('uuid', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '用户UID'])
->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'comment' => '充值编号'])
->addColumn('name', 'string', ['limit' => 200, 'default' => '', 'comment' => '充值名称'])
->addColumn('remark', 'string', ['limit' => 999, 'default' => '', 'comment' => '充值备注'])
->addColumn('amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '充值金额'])
->addColumn('upgrade', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '强制升级'])
->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除状态'])
->addColumn('create_by', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '系统用户'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
}
private function _address()
{
// 当前操作
$table = "data_user_address";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-用户-收货地址',
])
->addColumn('uuid', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '用户UID'])
->addColumn('type', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '地址类型(0普通,1默认)'])
->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'comment' => '地址编号'])
->addColumn('name', 'string', ['limit' => 100, 'default' => '', 'comment' => '收货姓名'])
->addColumn('phone', 'string', ['limit' => 20, 'default' => '', 'comment' => '收货手机'])
->addColumn('idcode', 'string', ['limit' => 255, 'default' => '', 'comment' => '身体证号'])
->addColumn('idimg1', 'string', ['limit' => 500, 'default' => '', 'comment' => '身份证正面'])
->addColumn('idimg2', 'string', ['limit' => 500, 'default' => '', 'comment' => '身份证反面'])
->addColumn('province', 'string', ['limit' => 100, 'default' => '', 'comment' => '地址-省份'])
->addColumn('city', 'string', ['limit' => 100, 'default' => '', 'comment' => '地址-城市'])
->addColumn('area', 'string', ['limit' => 100, 'default' => '', 'comment' => '地址-区域'])
->addColumn('address', 'string', ['limit' => 255, 'default' => '', 'comment' => '地址-详情'])
->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除状态'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
}
}

View File

@ -0,0 +1,78 @@
<?php
use think\migration\Migrator;
/**
* 文章数据
*/
class InstallNews extends Migrator
{
public function change()
{
$this->_news();
$this->_mark();
$this->_collect();
}
private function _collect()
{
// 当前操作
$table = "data_news_x_collect";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-文章-交互',
])
->addColumn('uuid', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '用户UID'])
->addColumn('type', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '记录类型(1收藏,2点赞,3历史,4评论)'])
->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'comment' => '文章编号'])
->addColumn('reply', 'text', ['default' => null, 'comment' => '评论内容'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '记录状态(0无效,1待审核,2已审核)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
}
private function _mark()
{
// 当前操作
$table = "data_news_mark";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-文章-标签',
])
->addColumn('name', 'string', ['limit' => 100, 'default' => '', 'comment' => '标签名称'])
->addColumn('remark', 'string', ['limit' => 500, 'default' => '', 'comment' => '标签说明'])
->addColumn('sort', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '排序权重'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '标签状态(1使用,0禁用)'])
->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除状态'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
}
private function _news()
{
// 当前操作
$table = "data_news_item";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-文章',
])
->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'comment' => '文章编号'])
->addColumn('name', 'string', ['limit' => 100, 'default' => '', 'comment' => '文章标题'])
->addColumn('mark', 'string', ['limit' => 200, 'default' => '', 'comment' => '文章标签'])
->addColumn('cover', 'string', ['limit' => 500, 'default' => '', 'comment' => '文章封面'])
->addColumn('remark', 'string', ['limit' => 500, 'default' => '', 'comment' => '备注说明'])
->addColumn('content', 'text', ['default' => null, 'comment' => '文章内容'])
->addColumn('num_like', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '文章点赞数'])
->addColumn('num_read', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '文章阅读数'])
->addColumn('num_collect', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '文章收藏数'])
->addColumn('num_comment', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '文章评论数'])
->addColumn('sort', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '排序权重'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '文章状态(1使用,0禁用)'])
->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除状态(0未删,1已删)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
}
}

View File

@ -0,0 +1,270 @@
<?php
use think\migration\Migrator;
/**
* 商城数据
*/
class InstallShop extends Migrator
{
public function change()
{
$this->_goods();
$this->_goodsCate();
$this->_goodsMark();
$this->_goodsItems();
$this->_goodsStock();
$this->_order();
$this->_orderItem();
$this->_orderSend();
}
private function _goods()
{
// 当前操作
$table = "shop_goods";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-商品-主体',
])
->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'comment' => '商品编号'])
->addColumn('name', 'string', ['limit' => 500, 'default' => '', 'comment' => '商品名称'])
->addColumn('marks', 'string', ['limit' => 999, 'default' => '', 'comment' => '商品标签'])
->addColumn('cateids', 'string', ['limit' => 999, 'default' => '', 'comment' => '分类编号'])
->addColumn('cover', 'string', ['limit' => 999, 'default' => '', 'comment' => '商品封面'])
->addColumn('slider', 'text', ['default' => null, 'comment' => '轮播图片'])
->addColumn('remark', 'string', ['limit' => 999, 'default' => '', 'comment' => '商品描述'])
->addColumn('content', 'text', ['default' => null, 'comment' => '商品详情'])
->addColumn('payment', 'string', ['limit' => 999, 'default' => '', 'comment' => '支付方式'])
->addColumn('data_specs', 'text', ['default' => null, 'comment' => '商品规格(JSON)'])
->addColumn('data_items', 'text', ['default' => null, 'comment' => '商品规格(JSON)'])
->addColumn('stock_total', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '商品库存统计'])
->addColumn('stock_sales', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '商品销售统计'])
->addColumn('stock_virtual', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '商品虚拟销量'])
->addColumn('price_selling', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '最低销售价格'])
->addColumn('price_market', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '最低市场价格'])
->addColumn('discount_id', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '折扣方案编号'])
->addColumn('truck_code', 'string', ['limit' => 20, 'default' => '', 'comment' => '物流运费模板'])
->addColumn('truck_type', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '物流配送(0无需配送,1需要配送)'])
->addColumn('rebate_type', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '参与返利(0无需返利,1需要返利)'])
->addColumn('vip_entry', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '入会礼包(0非入会礼包,1是入会礼包)'])
->addColumn('vip_upgrade', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '购买升级等级(0不升级,其他升级)'])
->addColumn('limit_low_vip', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '限制最低等级(0不限制,其他限制)'])
->addColumn('limit_max_num', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '最大购买数量(0不限制,其他限制)'])
->addColumn('num_read', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '访问阅读统计'])
->addColumn('state_hot', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '设置热度标签'])
->addColumn('state_home', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '设置首页推荐'])
->addColumn('sort', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '列表排序权重'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '商品状态(1使用,0禁用)'])
->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除状态(0未删,1已删)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
}
private function _goodsCate()
{
// 当前操作
$table = "shop_goods_cate";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-商品-分类',
])
->addColumn('pid', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '上级分类'])
->addColumn('name', 'string', ['limit' => 255, 'default' => '', 'comment' => '分类名称'])
->addColumn('cover', 'string', ['limit' => 500, 'default' => '', 'comment' => '分类图标'])
->addColumn('remark', 'string', ['limit' => 999, 'default' => '', 'comment' => '分类描述'])
->addColumn('sort', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '排序权重'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '使用状态'])
->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除状态'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
}
private function _goodsItems()
{
// 当前操作
$table = "shop_goods_item";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-商品-规格',
])
->addColumn('goods_sku', 'string', ['limit' => 20, 'default' => '', 'comment' => '商品SKU'])
->addColumn('goods_code', 'string', ['limit' => 20, 'default' => '', 'comment' => '商品编号'])
->addColumn('goods_spec', 'string', ['limit' => 100, 'default' => '', 'comment' => '商品规格'])
->addColumn('stock_sales', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '销售数量'])
->addColumn('stock_total', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '商品库存'])
->addColumn('price_selling', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '销售价格'])
->addColumn('price_market', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '市场价格'])
->addColumn('number_virtual', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '虚拟销量'])
->addColumn('number_express', 'integer', ['limit' => 20, 'default' => 1, 'comment' => '配送计件'])
->addColumn('reward_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '奖励余额'])
->addColumn('reward_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '奖励积分'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '商品状态'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
}
private function _goodsMark()
{
// 当前操作
$table = "shop_goods_mark";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-商品-标签',
])
->addColumn('name', 'string', ['limit' => 100, 'default' => '', 'comment' => '标签名称'])
->addColumn('remark', 'string', ['limit' => 200, 'default' => '', 'comment' => '标签描述'])
->addColumn('sort', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '排序权重'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '标签状态(1使用,0禁用)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
}
private function _goodsStock()
{
// 当前操作
$table = "shop_goods_stock";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-商品-库存',
])
->addColumn('batch_no', 'string', ['limit' => 20, 'default' => '', 'comment' => '操作批量'])
->addColumn('goods_code', 'string', ['limit' => 20, 'default' => '', 'comment' => '商品编号'])
->addColumn('goods_spec', 'string', ['limit' => 100, 'default' => '', 'comment' => '商品规格'])
->addColumn('goods_stock', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '入库数量'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '数据状态(1使用,0禁用)'])
->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除状态(0未删,1已删)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
}
private function _order()
{
// 当前操作
$table = "shop_order";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-订单',
])
->addColumn('uuid', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '下单用户编号'])
->addColumn('puid1', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '推荐一层用户'])
->addColumn('puid2', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '推荐二层用户'])
->addColumn('order_no', 'string', ['limit' => 20, 'default' => '', 'comment' => '商品订单单号'])
->addColumn('amount_real', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '订单实际金额'])
->addColumn('amount_total', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '订单统计金额'])
->addColumn('amount_goods', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '商品统计金额'])
->addColumn('amount_reduct', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '随机减免金额'])
->addColumn('amount_express', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '快递费用金额'])
->addColumn('amount_discount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '折扣后的金额'])
->addColumn('payment_type', 'string', ['limit' => 20, 'default' => '', 'comment' => '实际支付平台'])
->addColumn('payment_code', 'string', ['limit' => 20, 'default' => '', 'comment' => '实际通道编号'])
->addColumn('payment_allow', 'string', ['limit' => 999, 'default' => '', 'comment' => '允许支付通道'])
->addColumn('payment_trade', 'string', ['limit' => 80, 'default' => '', 'comment' => '实际支付单号'])
->addColumn('payment_status', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '实际支付状态'])
->addColumn('payment_image', 'string', ['limit' => 999, 'default' => '', 'comment' => '支付凭证图片'])
->addColumn('payment_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '实际支付金额'])
->addColumn('payment_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '余额抵扣金额'])
->addColumn('payment_remark', 'string', ['limit' => 500, 'default' => '', 'comment' => '支付结果描述'])
->addColumn('payment_datetime', 'string', ['limit' => 20, 'default' => '', 'comment' => '支付到账时间'])
->addColumn('number_goods', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '订单商品数量'])
->addColumn('number_express', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '订单快递计数'])
->addColumn('truck_type', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '物流配送类型(0无需配送,1需要配送)'])
->addColumn('rebate_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '参与返利金额'])
->addColumn('reward_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '奖励账户余额'])
->addColumn('order_remark', 'string', ['limit' => 999, 'default' => '', 'comment' => '订单用户备注'])
->addColumn('cancel_status', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '订单取消状态'])
->addColumn('cancel_remark', 'string', ['limit' => 200, 'default' => '', 'comment' => '订单取消描述'])
->addColumn('cancel_datetime', 'string', ['limit' => 20, 'default' => '', 'comment' => '订单取消时间'])
->addColumn('deleted_status', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '订单删除状态(0未删,1已删)'])
->addColumn('deleted_remark', 'string', ['limit' => 255, 'default' => '', 'comment' => '订单删除描述'])
->addColumn('deleted_datetime', 'string', ['limit' => 20, 'default' => '', 'comment' => '订单删除时间'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '订单流程状态(0已取消,1预订单,2待支付,3支付中,4已支付,5已发货,6已完成)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '订单创建时间'])
->save();
}
private function _orderItem()
{
// 当前操作
$table = "shop_order_item";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-订单-商品',
])
->addColumn('uuid', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '商城用户编号'])
->addColumn('order_no', 'string', ['limit' => 20, 'default' => '', 'comment' => '商城订单单号'])
->addColumn('goods_sku', 'string', ['limit' => 20, 'default' => '', 'comment' => '商城商品SKU'])
->addColumn('goods_code', 'string', ['limit' => 20, 'default' => '', 'comment' => '商城商品编号'])
->addColumn('goods_spec', 'string', ['limit' => 100, 'default' => '', 'comment' => '商城商品规格'])
->addColumn('goods_name', 'string', ['limit' => 250, 'default' => '', 'comment' => '商城商品名称'])
->addColumn('goods_cover', 'string', ['limit' => 500, 'default' => '', 'comment' => '商品封面图片'])
->addColumn('goods_payment', 'string', ['limit' => 999, 'default' => '', 'comment' => '指定支付通道'])
->addColumn('price_market', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '商品市场单价'])
->addColumn('price_selling', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '商品销售单价'])
->addColumn('total_market', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '商品市场总价'])
->addColumn('total_selling', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '商品销售总价'])
->addColumn('reward_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '商品奖励余额'])
->addColumn('reward_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '商品奖励积分'])
->addColumn('stock_sales', 'integer', ['limit' => 20, 'default' => 1, 'comment' => '包含商品数量'])
->addColumn('vip_name', 'string', ['limit' => 30, 'default' => '', 'comment' => '用户等级名称'])
->addColumn('vip_code', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '用户等级序号'])
->addColumn('vip_entry', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '是否入会礼包(0非礼包,1是礼包)'])
->addColumn('vip_upgrade', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '升级用户等级'])
->addColumn('truck_type', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '物流配送类型(0虚物,1实物)'])
->addColumn('truck_code', 'string', ['limit' => 20, 'default' => '', 'comment' => '快递邮费模板'])
->addColumn('truck_number', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '快递计费基数'])
->addColumn('rebate_type', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '参与返利状态(0不返,1返利)'])
->addColumn('rebate_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '参与返利金额'])
->addColumn('discount_id', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '优惠方案编号'])
->addColumn('discount_rate', 'decimal', ['precision' => 20, 'scale' => 6, 'default' => '100.000000', 'comment' => '销售价格折扣'])
->addColumn('discount_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '商品优惠金额'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '商品状态(1使用,0禁用)'])
->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除状态(0未删,1已删)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '订单创建时间'])
->save();
}
private function _orderSend()
{
// 当前操作
$table = "shop_order_send";
// 创建数据表,存在则跳过
$this->hasTable($table) || $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-订单-发货',
])
->addColumn('uuid', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '商城用户编号'])
->addColumn('order_no', 'string', ['limit' => 20, 'default' => '', 'comment' => '商城订单单号'])
->addColumn('address_code', 'string', ['limit' => 20, 'default' => '', 'comment' => '配送地址编号'])
->addColumn('address_name', 'string', ['limit' => 50, 'default' => '', 'comment' => '配送收货人姓名'])
->addColumn('address_phone', 'string', ['limit' => 20, 'default' => '', 'comment' => '配送收货人手机'])
->addColumn('address_idcode', 'string', ['limit' => 100, 'default' => '', 'comment' => '配送收货人证件号码'])
->addColumn('address_idimg1', 'string', ['limit' => 500, 'default' => '', 'comment' => '配送收货人证件正面'])
->addColumn('address_idimg2', 'string', ['limit' => 500, 'default' => '', 'comment' => '配送收货人证件反面'])
->addColumn('address_province', 'string', ['limit' => 30, 'default' => '', 'comment' => '配送地址的省份'])
->addColumn('address_city', 'string', ['limit' => 30, 'default' => '', 'comment' => '配送地址的城市'])
->addColumn('address_area', 'string', ['limit' => 30, 'default' => '', 'comment' => '配送地址的区域'])
->addColumn('address_content', 'string', ['limit' => 255, 'default' => '', 'comment' => '配送的详细地址'])
->addColumn('address_datetime', 'string', ['limit' => 20, 'default' => '', 'comment' => '地址确认时间'])
->addColumn('template_code', 'string', ['limit' => 20, 'default' => '', 'comment' => '配送模板编号'])
->addColumn('template_count', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '快递计费基数'])
->addColumn('template_remark', 'string', ['limit' => 255, 'default' => '', 'comment' => '配送计算描述'])
->addColumn('template_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'comment' => '配送计算金额'])
->addColumn('company_code', 'string', ['limit' => 20, 'default' => '', 'comment' => '快递公司编码'])
->addColumn('company_name', 'string', ['limit' => 100, 'default' => '', 'comment' => '快递公司名称'])
->addColumn('send_number', 'string', ['limit' => 100, 'default' => '', 'comment' => '快递运送单号'])
->addColumn('send_remark', 'string', ['limit' => 255, 'default' => '', 'comment' => '快递发送备注'])
->addColumn('send_datetime', 'string', ['limit' => 20, 'default' => '', 'comment' => '快递发送时间'])
->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '发货商品状态(1使用,0禁用)'])
->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '发货删除状态(0未删,1已删)'])
->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
->save();
}
}

View File

@ -12,20 +12,36 @@ ThinkAdmin v6 基于`v1-v5`版本的积累,结合`ThinkPHP 6.0`的思维重新
另外项目安装及二次开发可以先阅读`ThinkPHP`官方文档,数据库 SQL 文件位于项目根目录下,若实在无法解决当下问题可以加入官方微信群获得帮助。
#### 注意事项
### 注意事项
* 项目测试需要自行搭建环境导入数据库 SQL 文件并修改配置( config/database.php )
* 若操作提示“演示系统禁止操作”等字样,需要删除演示路由配置( app/admin/route/demo.php )或清空路由文件;
* 当前版本使用 ThinkPHP 6.0.x对 PHP 版本标注不低于 PHP 7.1,具体请阅读 ThinkPHP 官方文档;
* 环境需开启 PATHINFO不再支持 ThinkPHP 的 URL 兼容模式运行(源于如何优雅地展示);
* 项目默认不带`composer`模块`vendor`目录,下载后需要自行`composer install`安装;
> * `ThinkAdmin`基于`ThinkPHP 6.0.x`开发,对`PHP`版本标注不低于`PHP 7.1`,请阅读`ThinkPHP`官方文档;
> * 运行环境需开启`PATHINFO`,不再支持`ThinkPHP``URL`兼容模式运行(源于如何优雅地展示);
> * `ThinkAdmin`默认不带`composer`组件`vendor`目录,下载后需要自行执行`composer install`安装;
> * 若操作提示 “演示系统禁止操作” 等字样,需要删除演示路由配置`app/admin/route/demo.php`或清空路由文件;
### 数据管理
> * 使用`phinx`管理数据库,在未配置数据库时默认使用`Sqlite`数据库作为测试与体验;
> * 在使用`Sqlite`存储数据时,仅可以用于测试与体验,不得用于线上生产环境,建议使用免费开源的`MySQL`数据库;
> * 使用`MySql`,`SqlServer`,`Postgres`等服务型数据库,需要先创建空数据库并配置到项目,再执行`composer install`即可自动安装;
### 体验环境
> * 无需配置数据库,默认使用`Sqlite`数据库;
> * 执行`composer install`安装项目所需依赖组件以及自动安装数据库;
> * 启动项目内置的`WEB`服务,执行`php think run`并浏览器访问`http://127.0.0.1:8000`
> * 使用系统默认的账号和密码登录后台,默认的账号和密码都是`admin`
### 开发环境
> * 安装数据库程序并创建数据库,将参数配置到`config/database.php`
> * 执行`composer install`安装项目所需依赖组件以及自动安装数据库;
> * 安装`Nginx``Apache``Web`服务,并按照`ThinkPHP`官方要求配置网站;
## 技术支持
开发前请认真阅读 ThinkPHP 官方文档会对您有帮助哦!
本地开发请使用`php think run`运行服务,访问`http://127.0.0.1:8000`即可进入项目。
官方地址及开发指南https://thinkadmin.top ,如果实在无法解决问题可以加入官方群免费交流。
**1.官方QQ交流群** 513350915