From 55d08ff770a01338842aac3112d4014a75fc7ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Wed, 16 Oct 2024 21:43:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=95=B0=E6=8D=AE=E5=BA=93=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20009999999994_install_system_table.php | 288 ---- .../20009999999995_install_wuma_table.php | 817 ----------- .../20009999999996_install_wemall_table.php | 1205 ---------------- .../20009999999997_install_payment_table.php | 231 --- .../20009999999998_install_account_table.php | 142 -- .../20009999999999_install_package.php | 298 ---- .../20230209000001_install_wechat_service.php | 81 -- .../20241016000007_install_wechat20241016.php | 70 + .../20221013045829_install_wechat.php | 416 ------ .../20221013045830_install_wechat_data.php | 54 - .../20221013045832_install_wechat20230628.php | 129 -- .../20241016000006_install_wechat20241016.php | 145 +- .../20230404000001_install_wemall.php | 1245 ----------------- .../20241016000002_install_wemall20241016.php | 9 + .../database/20230818000001_install_wuma.php | 1178 ---------------- .../20241016000007_install_wuma20241016.php | 881 ++++++++++++ 16 files changed, 1024 insertions(+), 6165 deletions(-) delete mode 100644 database/migrations/20009999999994_install_system_table.php delete mode 100644 database/migrations/20009999999995_install_wuma_table.php delete mode 100644 database/migrations/20009999999996_install_wemall_table.php delete mode 100644 database/migrations/20009999999997_install_payment_table.php delete mode 100644 database/migrations/20009999999998_install_account_table.php delete mode 100644 database/migrations/20009999999999_install_package.php delete mode 100644 plugin/think-plugs-wechat-service/stc/database/20230209000001_install_wechat_service.php create mode 100644 plugin/think-plugs-wechat-service/stc/database/20241016000007_install_wechat20241016.php delete mode 100644 plugin/think-plugs-wechat/stc/database/20221013045829_install_wechat.php delete mode 100644 plugin/think-plugs-wechat/stc/database/20221013045830_install_wechat_data.php delete mode 100644 plugin/think-plugs-wechat/stc/database/20221013045832_install_wechat20230628.php rename database/migrations/20009999999993_install_wechat_table.php => plugin/think-plugs-wechat/stc/database/20241016000006_install_wechat20241016.php (79%) delete mode 100644 plugin/think-plugs-wemall/stc/database/20230404000001_install_wemall.php delete mode 100644 plugin/think-plugs-wuma/stc/database/20230818000001_install_wuma.php create mode 100644 plugin/think-plugs-wuma/stc/database/20241016000007_install_wuma20241016.php diff --git a/database/migrations/20009999999994_install_system_table.php b/database/migrations/20009999999994_install_system_table.php deleted file mode 100644 index f20fe2c69..000000000 --- a/database/migrations/20009999999994_install_system_table.php +++ /dev/null @@ -1,288 +0,0 @@ -_create_system_auth(); - $this->_create_system_auth_node(); - $this->_create_system_base(); - $this->_create_system_config(); - $this->_create_system_data(); - $this->_create_system_file(); - $this->_create_system_menu(); - $this->_create_system_oplog(); - $this->_create_system_queue(); - $this->_create_system_user(); - } - - /** - * 创建数据对象 - * @class SystemAuth - * @table system_auth - * @return void - */ - private function _create_system_auth() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('system_auth', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-权限', - ]), [ - ['title', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '权限名称']], - ['utype', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '身份权限']], - ['desc', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '备注说明']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '权限状态(1使用,0禁用)']], - ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], - ], [ - 'sort', 'title', 'status', - ]); - } - - /** - * 创建数据对象 - * @class SystemAuthNode - * @table system_auth_node - * @return void - */ - private function _create_system_auth_node() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('system_auth_node', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-授权', - ]), [ - ['auth', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '角色']], - ['node', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '节点']], - ], [ - 'auth', 'node', - ]); - } - - /** - * 创建数据对象 - * @class SystemBase - * @table system_base - * @return void - */ - private function _create_system_base() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('system_base', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-字典', - ]), [ - ['type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '数据类型']], - ['code', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '数据代码']], - ['name', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '数据名称']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '数据内容']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '数据状态(0禁用,1启动)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0正常,1已删)']], - ['deleted_at', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '删除时间']], - ['deleted_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '删除用户']], - ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], - ], [ - 'type', 'code', 'name', 'sort', 'status', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class SystemConfig - * @table system_config - * @return void - */ - private function _create_system_config() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('system_config', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-配置', - ]), [ - ['type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '配置分类']], - ['name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '配置名称']], - ['value', 'string', ['limit' => 2048, 'default' => '', 'null' => true, 'comment' => '配置内容']], - ], [ - 'type', 'name', - ]); - } - - /** - * 创建数据对象 - * @class SystemData - * @table system_data - * @return void - */ - private function _create_system_data() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('system_data', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-数据', - ]), [ - ['name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '配置名']], - ['value', 'text', ['default' => NULL, 'null' => true, 'comment' => '配置值']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'name', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class SystemFile - * @table system_file - * @return void - */ - private function _create_system_file() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('system_file', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-文件', - ]), [ - ['type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '上传类型']], - ['hash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '文件哈希']], - ['tags', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '文件标签']], - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '文件名称']], - ['xext', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '文件后缀']], - ['xurl', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '访问链接']], - ['xkey', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '文件路径']], - ['mime', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '文件类型']], - ['size', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '文件大小']], - ['uuid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '会员编号']], - ['isfast', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '是否秒传']], - ['issafe', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '安全模式']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '上传状态(1悬空,2落地)']], - ['create_at', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_at', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'type', 'hash', 'uuid', 'xext', 'unid', 'tags', 'name', 'status', 'issafe', 'isfast', 'create_at', - ]); - } - - /** - * 创建数据对象 - * @class SystemMenu - * @table system_menu - * @return void - */ - private function _create_system_menu() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('system_menu', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-菜单', - ]), [ - ['pid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上级ID']], - ['title', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '菜单名称']], - ['icon', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '菜单图标']], - ['node', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '节点代码']], - ['url', 'string', ['limit' => 400, 'default' => '', 'null' => true, 'comment' => '链接节点']], - ['params', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '链接参数']], - ['target', 'string', ['limit' => 20, 'default' => '_self', 'null' => true, 'comment' => '打开方式']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '状态(0:禁用,1:启用)']], - ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], - ], [ - 'pid', 'sort', 'status', - ]); - } - - /** - * 创建数据对象 - * @class SystemOplog - * @table system_oplog - * @return void - */ - private function _create_system_oplog() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('system_oplog', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-日志', - ]), [ - ['node', 'string', ['limit' => 200, 'default' => '', 'null' => false, 'comment' => '当前操作节点']], - ['geoip', 'string', ['limit' => 15, 'default' => '', 'null' => false, 'comment' => '操作者IP地址']], - ['action', 'string', ['limit' => 200, 'default' => '', 'null' => false, 'comment' => '操作行为名称']], - ['content', 'string', ['limit' => 1024, 'default' => '', 'null' => false, 'comment' => '操作内容描述']], - ['username', 'string', ['limit' => 50, 'default' => '', 'null' => false, 'comment' => '操作人用户名']], - ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '创建时间']], - ], [ - 'create_at', - ]); - } - - /** - * 创建数据对象 - * @class SystemQueue - * @table system_queue - * @return void - */ - private function _create_system_queue() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('system_queue', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-任务', - ]), [ - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => false, 'comment' => '任务编号']], - ['title', 'string', ['limit' => 100, 'default' => '', 'null' => false, 'comment' => '任务名称']], - ['command', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '执行指令']], - ['exec_pid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '执行进程']], - ['exec_data', 'text', ['default' => NULL, 'null' => true, 'comment' => '执行参数']], - ['exec_time', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '执行时间']], - ['exec_desc', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '执行描述']], - ['enter_time', 'decimal', ['precision' => 20, 'scale' => 4, 'default' => '0.0000', 'null' => true, 'comment' => '开始时间']], - ['outer_time', 'decimal', ['precision' => 20, 'scale' => 4, 'default' => '0.0000', 'null' => true, 'comment' => '结束时间']], - ['loops_time', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '循环时间']], - ['attempts', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '执行次数']], - ['message', 'text', ['default' => NULL, 'null' => true, 'comment' => '最新消息']], - ['rscript', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '任务类型(0单例,1多例)']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '任务状态(1新任务,2处理中,3成功,4失败)']], - ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '创建时间']], - ], [ - 'code', 'title', 'status', 'rscript', 'create_at', 'exec_time', - ]); - } - - /** - * 创建数据对象 - * @class SystemUser - * @table system_user - * @return void - */ - private function _create_system_user() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('system_user', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-用户', - ]), [ - ['usertype', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '用户类型']], - ['username', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户账号']], - ['password', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '用户密码']], - ['nickname', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户昵称']], - ['headimg', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '头像地址']], - ['authorize', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '权限授权']], - ['contact_qq', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '联系QQ']], - ['contact_mail', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '联系邮箱']], - ['contact_phone', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '联系手机']], - ['login_ip', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '登录地址']], - ['login_at', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '登录时间']], - ['login_num', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '登录次数']], - ['describe', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '备注说明']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '状态(0禁用,1启用)']], - ['is_deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除(1删除,0未删)']], - ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], - ], [ - 'sort', 'status', 'username', 'is_deleted', - ]); - } - -} diff --git a/database/migrations/20009999999995_install_wuma_table.php b/database/migrations/20009999999995_install_wuma_table.php deleted file mode 100644 index d323e0a6b..000000000 --- a/database/migrations/20009999999995_install_wuma_table.php +++ /dev/null @@ -1,817 +0,0 @@ -_create_plugin_wuma_code_rule(); - $this->_create_plugin_wuma_code_rule_range(); - $this->_create_plugin_wuma_sales_order(); - $this->_create_plugin_wuma_sales_order_data(); - $this->_create_plugin_wuma_sales_order_data_mins(); - $this->_create_plugin_wuma_sales_order_data_nums(); - $this->_create_plugin_wuma_sales_user(); - $this->_create_plugin_wuma_sales_user_level(); - $this->_create_plugin_wuma_sales_user_stock(); - $this->_create_plugin_wuma_source_assign(); - $this->_create_plugin_wuma_source_assign_item(); - $this->_create_plugin_wuma_source_blockchain(); - $this->_create_plugin_wuma_source_certificate(); - $this->_create_plugin_wuma_source_produce(); - $this->_create_plugin_wuma_source_query(); - $this->_create_plugin_wuma_source_query_notify(); - $this->_create_plugin_wuma_source_query_verify(); - $this->_create_plugin_wuma_source_template(); - $this->_create_plugin_wuma_warehouse(); - $this->_create_plugin_wuma_warehouse_order(); - $this->_create_plugin_wuma_warehouse_order_data(); - $this->_create_plugin_wuma_warehouse_order_data_mins(); - $this->_create_plugin_wuma_warehouse_order_data_nums(); - $this->_create_plugin_wuma_warehouse_relation(); - $this->_create_plugin_wuma_warehouse_relation_data(); - $this->_create_plugin_wuma_warehouse_replace(); - $this->_create_plugin_wuma_warehouse_stock(); - $this->_create_plugin_wuma_warehouse_user(); - } - - /** - * 创建数据对象 - * @class PluginWumaCodeRule - * @table plugin_wuma_code_rule - * @return void - */ - private function _create_plugin_wuma_code_rule() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_code_rule', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-生码-规则', - ]), [ - ['type', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '批次类型(1前关联,2后关联)']], - ['batch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '批次编号']], - ['mid_min', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '中码与小码比值']], - ['max_mid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '大码与中码比值']], - ['sns_start', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '序号起始值']], - ['sns_after', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '序号结束值']], - ['sns_length', 'biginteger', ['limit' => 20, 'default' => 20, 'null' => true, 'comment' => '序号长度']], - ['max_length', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '大码长度']], - ['mid_length', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '中码长度']], - ['min_length', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '小码长度']], - ['hex_length', 'biginteger', ['limit' => 20, 'default' => 10, 'null' => true, 'comment' => '加密长度']], - ['ver_length', 'biginteger', ['limit' => 20, 'default' => 4, 'null' => true, 'comment' => '验证长度']], - ['max_number', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '大码数量']], - ['mid_number', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '中码数量']], - ['number', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '物码总数']], - ['template', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '导出模板']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '物码描述']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'type', 'batch', 'status', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaCodeRuleRange - * @table plugin_wuma_code_rule_range - * @return void - */ - private function _create_plugin_wuma_code_rule_range() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_code_rule_range', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-生码-范围', - ]), [ - ['type', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '物码类型']], - ['batch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物码批次号']], - ['code_type', 'string', ['limit' => 3, 'default' => '', 'null' => true, 'comment' => '数码类型(min小码,mid中码,max大码)']], - ['code_length', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '数码长度']], - ['range_start', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '起始数码']], - ['range_after', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '结束数码']], - ['range_number', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '数码数量']], - ], [ - 'type', 'code_type', 'code_length', 'range_start', 'range_after', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaSalesOrder - * @table plugin_wuma_sales_order - * @return void - */ - private function _create_plugin_wuma_sales_order() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_sales_order', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-订单', - ]), [ - ['auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '经销商编号']], - ['xuid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '来源经销商']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作单单号']], - ['mode', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '操作方式(1扫码,2虚拟)']], - ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品哈唏']], - ['vir_need', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟库统计']], - ['vir_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟库使用']], - ['num_need', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '累计出库数量']], - ['num_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '累计已经出库']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效,2完成)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'auid', 'xuid', 'code', 'mode', 'ghash', 'status', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaSalesOrderData - * @table plugin_wuma_sales_order_data - * @return void - */ - private function _create_plugin_wuma_sales_order_data() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_sales_order_data', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-数据', - ]), [ - ['auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '经销商编号']], - ['xuid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '来源经销商']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作单号']], - ['mode', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '操作方式(1扫码,2虚拟)']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']], - ['number', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '物码总数']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'auid', 'xuid', 'mode', 'code', 'status', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaSalesOrderDataMins - * @table plugin_wuma_sales_order_data_mins - * @return void - */ - private function _create_plugin_wuma_sales_order_data_mins() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_sales_order_data_mins', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-小码', - ]), [ - ['ddid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '数据编号']], - ['auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '代理编号']], - ['code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '物码数据']], - ['mode', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '操作类型(1扫码,2虚拟)']], - ['stock', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '库存有效']], - ['ghash', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品哈唏']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '数据状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0有效,1已删)']], - ['status_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '状态时间']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ], [ - 'ddid', 'auid', 'code', 'mode', 'stock', 'ghash', 'status', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaSalesOrderDataNums - * @table plugin_wuma_sales_order_data_nums - * @return void - */ - private function _create_plugin_wuma_sales_order_data_nums() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_sales_order_data_nums', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-箱码', - ]), [ - ['uuid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属品牌']], - ['ddid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '数据编号']], - ['count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '物码数量']], - ['type', 'string', ['limit' => 40, 'default' => '', 'null' => true, 'comment' => '物码类型']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物码数据']], - ], [ - 'type', 'uuid', 'ddid', 'code', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaSalesUser - * @table plugin_wuma_sales_user - * @return void - */ - private function _create_plugin_wuma_sales_user() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_sales_user', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-用户', - ]), [ - ['auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上级代理']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '授权编号']], - ['level', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '代理等级']], - ['master', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '总部账号']], - ['phone', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '用户手机']], - ['userid', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '身份证号']], - ['mobile', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '联系电话']], - ['headimg', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户头像']], - ['username', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户姓名']], - ['password', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '登录密码']], - ['date_start', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '开始时间']], - ['date_after', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '结束时间']], - ['super_auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '邀请上级用户']], - ['super_phone', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '邀请上级手机']], - ['business', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '营业执照']], - ['region_prov', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所属省份']], - ['region_city', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所属城市']], - ['region_area', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所属区域']], - ['region_address', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '详细地址']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户备注描述']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '用户状态(1正常,0已黑)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '注册时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'auid', 'code', 'level', 'status', 'deleted', 'super_auid', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaSalesUserLevel - * @table plugin_wuma_sales_user_level - * @return void - */ - private function _create_plugin_wuma_sales_user_level() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_sales_user_level', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-等级', - ]), [ - ['name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '代理级别名称']], - ['number', 'integer', ['limit' => 2, 'default' => 0, 'null' => true, 'comment' => '代理级别序号']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '代理级别描述']], - ['utime', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '等级更新时间']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '代理等级状态(1使用,0禁用)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '等级创建时间']], - ], [ - 'status', 'number', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaSalesUserStock - * @table plugin_wuma_sales_user_stock - * @return void - */ - private function _create_plugin_wuma_sales_user_stock() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_sales_user_stock', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-库存', - ]), [ - ['auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '经销编号']], - ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品哈唏']], - ['vir_total', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟库存']], - ['vir_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟出货']], - ['num_total', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '累计库存']], - ['num_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '累计出货']], - ], [ - 'auid', 'ghash', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaSourceAssign - * @table plugin_wuma_source_assign - * @return void - */ - private function _create_plugin_wuma_source_assign() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_source_assign', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-赋码批次', - ]), [ - ['type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '赋码类型(0区间,1关联)']], - ['batch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '赋码批次号']], - ['cbatch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物码批次号']], - ['outer_items', 'text', ['default' => NULL, 'null' => true, 'comment' => 'JSON出库']], - ['coder_items2', 'text', ['default' => NULL, 'null' => true, 'comment' => 'JSON赋码']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'type', 'batch', 'cbatch', 'status', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaSourceAssignItem - * @table plugin_wuma_source_assign_item - * @return void - */ - private function _create_plugin_wuma_source_assign_item() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_source_assign_item', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-赋码规则', - ]), [ - ['real', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '是否真锁定']], - ['lock', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '是否已锁定']], - ['batch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '赋码批次号']], - ['cbatch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物码批次号']], - ['pbatch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '生产批次号']], - ['range_start', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '开始物码区间']], - ['range_after', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '结束物码区间']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'lock', 'real', 'batch', 'cbatch', 'pbatch', 'range_start', 'range_after', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaSourceBlockchain - * @table plugin_wuma_source_blockchain - * @return void - */ - private function _create_plugin_wuma_source_blockchain() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_source_blockchain', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-区块链', - ]), [ - ['scid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '确权证书']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '流程编号']], - ['hash', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '流程HASH']], - ['name', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '流程名称']], - ['data', 'text', ['default' => NULL, 'null' => true, 'comment' => '流程环节']], - ['remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '流程备注']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删1已删)']], - ['hash_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '上链时间']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'scid', 'sort', 'status', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaSourceCertificate - * @table plugin_wuma_source_certificate - * @return void - */ - private function _create_plugin_wuma_source_certificate() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_source_certificate', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-确权证书', - ]), [ - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '模板编号']], - ['name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '模板名称']], - ['times', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '访问次数']], - ['image', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '证书底图']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '定制规则']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'status', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaSourceProduce - * @table plugin_wuma_source_produce - * @return void - */ - private function _create_plugin_wuma_source_produce() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_source_produce', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-生产批次', - ]), [ - ['batch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '生产批次']], - ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '产品编号']], - ['tcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '关联溯源模板']], - ['addr_prov', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '所在省份']], - ['addr_city', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '所在城市']], - ['addr_area', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '所在区域']], - ['remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '批次备注']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效1有效)']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'batch', 'status', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaSourceQuery - * @table plugin_wuma_source_query - * @return void - */ - private function _create_plugin_wuma_source_query() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_source_query', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-查询记录', - ]), [ - ['auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '代理用户']], - ['code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '小码数码']], - ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品哈希']], - ['times', 'biginteger', ['limit' => 20, 'default' => 1, 'null' => true, 'comment' => '查询次数']], - ['encode', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '物码编号']], - ['prov', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '所在省份']], - ['city', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '所在城市']], - ['area', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '所在区域']], - ['addr', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '详细地址']], - ['geoip', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '访问IP']], - ['gtype', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '定位类型']], - ['latlng', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '经纬度']], - ['notify', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '窜货状态']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'auid', 'prov', 'city', 'area', 'notify', 'encode', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaSourceQueryNotify - * @table plugin_wuma_source_query_notify - * @return void - */ - private function _create_plugin_wuma_source_query_notify() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_source_query_notify', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-窜货异常', - ]), [ - ['auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '代理用户']], - ['code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '小码数码']], - ['type', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '记录类型']], - ['times', 'biginteger', ['limit' => 20, 'default' => 1, 'null' => true, 'comment' => '查询次数']], - ['encode', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '物码编号']], - ['prov', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所在省份']], - ['city', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所在城市']], - ['area', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所在区域']], - ['addr', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '详细地址']], - ['gtype', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '定位类型']], - ['geoip', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '访问IP']], - ['latlng', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '经纬度']], - ['pcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品编号']], - ['pspec', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '商品规格']], - ['agent_prov', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '代理省份']], - ['agent_city', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '代理城市']], - ['agent_area', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '代理区域']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'auid', 'prov', 'city', 'area', 'code', 'encode', 'agent_prov', 'agent_city', 'agent_area', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaSourceQueryVerify - * @table plugin_wuma_source_query_verify - * @return void - */ - private function _create_plugin_wuma_source_query_verify() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_source_query_verify', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-查询记录', - ]), [ - ['auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '代理用户']], - ['code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '小码数码']], - ['times', 'biginteger', ['limit' => 20, 'default' => 1, 'null' => true, 'comment' => '查询次数']], - ['ghash', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品编号']], - ['encode', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '物码编号']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'auid', 'encode', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaSourceTemplate - * @table plugin_wuma_source_template - * @return void - */ - private function _create_plugin_wuma_source_template() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_source_template', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-页面模板', - ]), [ - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '模板编号']], - ['name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '模板名称']], - ['times', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '访问次数']], - ['styles', 'text', ['default' => NULL, 'null' => true, 'comment' => '主题样式']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '模板内容']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'status', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouse - * @table plugin_wuma_warehouse - * @return void - */ - private function _create_plugin_wuma_warehouse() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_warehouse', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库', - ]), [ - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '仓库编号']], - ['name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '仓库名称']], - ['person', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '负责人']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '物码描述']], - ['addr_prov', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所属省份']], - ['addr_city', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所属城市']], - ['addr_area', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所属区域']], - ['addr_text', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '详细地址']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'name', 'sort', 'status', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouseOrder - * @table plugin_wuma_warehouse_order - * @return void - */ - private function _create_plugin_wuma_warehouse_order() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_warehouse_order', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-订单', - ]), [ - ['type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '操作类型(1订单入库,2直接入库,3调货入库,4订单出库,5直接出库,6调货出库,7关联出库,8直接退货)']], - ['mode', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '操作方式(1扫码操作,2虚拟操作)']], - ['auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '出库代理']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作单号']], - ['wcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '仓库编号']], - ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '绑定产品']], - ['vir_need', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟总数']], - ['vir_used', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟完成']], - ['num_need', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '扫码总数']], - ['num_used', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '扫码完成']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效,2完成)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ['deleted_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '删除时间']], - ], [ - 'mode', 'auid', 'type', 'code', 'ghash', 'wcode', 'status', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouseOrderData - * @table plugin_wuma_warehouse_order_data - * @return void - */ - private function _create_plugin_wuma_warehouse_order_data() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_warehouse_order_data', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-数据', - ]), [ - ['type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '操作类型(1订单入库,2直接入库,3调货入库,4订单出库,5直接出库,6调货出库,7关联出库,8直接退货)']], - ['mode', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '操作方式(1扫码操作,2虚拟操作)']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作单号']], - ['number', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '标签总数']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ], [ - 'mode', 'type', 'code', 'status', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouseOrderDataMins - * @table plugin_wuma_warehouse_order_data_mins - * @return void - */ - private function _create_plugin_wuma_warehouse_order_data_mins() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_warehouse_order_data_mins', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-小码', - ]), [ - ['type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '操作类型(1订单入库,2直接入库,3调货入库,4订单出库,5直接出库,6调货出库,7关联出库,8直接退货)']], - ['mode', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '操作方式(1扫码操作,2虚拟操作)']], - ['ddid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '数据编号']], - ['code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '物码数据']], - ['stock', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '调货:库存有效(0已出,1暂存)']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '退货:记录状态(0无效,1有效)']], - ['status_time', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '状态时间']], - ], [ - 'type', 'mode', 'ddid', 'code', 'stock', 'status', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouseOrderDataNums - * @table plugin_wuma_warehouse_order_data_nums - * @return void - */ - private function _create_plugin_wuma_warehouse_order_data_nums() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_warehouse_order_data_nums', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-箱码', - ]), [ - ['ddid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '数据编号']], - ['type', 'string', ['limit' => 40, 'default' => '', 'null' => true, 'comment' => '物码类型']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物码数据']], - ['count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '物码数量']], - ], [ - 'ddid', 'code', 'type', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouseRelation - * @table plugin_wuma_warehouse_relation - * @return void - */ - private function _create_plugin_wuma_warehouse_relation() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_warehouse_relation', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-关联', - ]), [ - ['max', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '大码数值']], - ['mid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '中码数值']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上传用户']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ], [ - 'max', 'mid', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouseRelationData - * @table plugin_wuma_warehouse_relation_data - * @return void - */ - private function _create_plugin_wuma_warehouse_relation_data() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_warehouse_relation_data', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-关联', - ]), [ - ['rid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '批次数据']], - ['max', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '大码数值']], - ['mid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '中码数值']], - ['min', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '小码数值']], - ['number', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '防窜编码']], - ['encode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '防伪编码']], - ['lock', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '锁定状态']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上传用户']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ], [ - 'rid', 'max', 'mid', 'min', 'lock', 'status', 'encode', 'number', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouseReplace - * @table plugin_wuma_warehouse_replace - * @return void - */ - private function _create_plugin_wuma_warehouse_replace() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_warehouse_replace', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-替换', - ]), [ - ['type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物码类型']], - ['smin', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '原值小码']], - ['tmin', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '目标小码']], - ['source', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '原物码值']], - ['target', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '目标物码']], - ['lock', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '锁定状态']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上传用户']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ], [ - 'smin', 'tmin', 'lock', 'status', 'target', 'source', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouseStock - * @table plugin_wuma_warehouse_stock - * @return void - */ - private function _create_plugin_wuma_warehouse_stock() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_warehouse_stock', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-库存', - ]), [ - ['wcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '仓库编号']], - ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品规格']], - ['vir_total', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟总数']], - ['vir_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟完成']], - ['num_total', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '扫码总数']], - ['num_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '扫码完成']], - ], [ - 'wcode', 'ghash', - ]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouseUser - * @table plugin_wuma_warehouse_user - * @return void - */ - private function _create_plugin_wuma_warehouse_user() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wuma_warehouse_user', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-用户', - ]), [ - ['token', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '接口令牌']], - ['username', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '用户账号']], - ['nickname', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '用户昵称']], - ['password', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '登录密码']], - ['login_ip', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '登录地址']], - ['login_time', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '登录时间']], - ['login_num', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '登录测试']], - ['login_vars', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '登录参数']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '物码描述']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'sort', 'token', 'status', 'deleted', 'username', 'password', - ]); - } - -} diff --git a/database/migrations/20009999999996_install_wemall_table.php b/database/migrations/20009999999996_install_wemall_table.php deleted file mode 100644 index 03f38ceca..000000000 --- a/database/migrations/20009999999996_install_wemall_table.php +++ /dev/null @@ -1,1205 +0,0 @@ -_create_plugin_wemall_config_agent(); - $this->_create_plugin_wemall_config_coupon(); - $this->_create_plugin_wemall_config_discount(); - $this->_create_plugin_wemall_config_level(); - $this->_create_plugin_wemall_config_notify(); - $this->_create_plugin_wemall_config_poster(); - $this->_create_plugin_wemall_config_rebate(); - $this->_create_plugin_wemall_express_company(); - $this->_create_plugin_wemall_express_template(); - $this->_create_plugin_wemall_goods(); - $this->_create_plugin_wemall_goods_cate(); - $this->_create_plugin_wemall_goods_item(); - $this->_create_plugin_wemall_goods_mark(); - $this->_create_plugin_wemall_goods_stock(); - $this->_create_plugin_wemall_help_feedback(); - $this->_create_plugin_wemall_help_problem(); - $this->_create_plugin_wemall_help_question(); - $this->_create_plugin_wemall_help_question_x(); - $this->_create_plugin_wemall_order(); - $this->_create_plugin_wemall_order_cart(); - $this->_create_plugin_wemall_order_item(); - $this->_create_plugin_wemall_order_refund(); - $this->_create_plugin_wemall_order_send(); - $this->_create_plugin_wemall_order_sender(); - $this->_create_plugin_wemall_user_action_collect(); - $this->_create_plugin_wemall_user_action_comment(); - $this->_create_plugin_wemall_user_action_history(); - $this->_create_plugin_wemall_user_action_search(); - $this->_create_plugin_wemall_user_checkin(); - $this->_create_plugin_wemall_user_coupon(); - $this->_create_plugin_wemall_user_create(); - $this->_create_plugin_wemall_user_rebate(); - $this->_create_plugin_wemall_user_recharge(); - $this->_create_plugin_wemall_user_relation(); - $this->_create_plugin_wemall_user_transfer(); - } - - /** - * 创建数据对象 - * @class PluginWemallConfigAgent - * @table plugin_wemall_config_agent - * @return void - */ - private function _create_plugin_wemall_config_agent() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_config_agent', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-配置-等级', - ]), [ - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '级别名称']], - ['cover', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '等级图标']], - ['cardbg', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '等级卡片']], - ['number', 'integer', ['limit' => 2, 'default' => 0, 'null' => true, 'comment' => '级别序号']], - ['upgrade_type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '升级规则(0单个,1同时)']], - ['extra', 'text', ['default' => NULL, 'null' => true, 'comment' => '升级规则']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '级别描述']], - ['utime', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '更新时间']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '等级状态(1使用,0禁用)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'utime', 'status', 'number', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallConfigCoupon - * @table plugin_wemall_config_coupon - * @return void - */ - private function _create_plugin_wemall_config_coupon() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_config_coupon', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-配置-卡券', - ]), [ - ['type', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '类型(0通用券,1商品券)']], - ['name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '优惠名称']], - ['cover', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '封面图标']], - ['extra', 'text', ['default' => NULL, 'null' => true, 'comment' => '扩展数据']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '内容描述']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '系统备注']], - ['amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '抵扣金额']], - ['limit_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '金额门槛(0不限制)']], - ['limit_levels', 'string', ['limit' => 180, 'default' => '-', 'null' => true, 'comment' => '授权等级']], - ['limit_times', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '限领数量(0不限制)']], - ['expire_days', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '有效天数']], - ['total_stock', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '库存数量']], - ['total_sales', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '发放数量']], - ['total_used', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '使用数量']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '卡券状态(0禁用,1使用)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(1已删,0未删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'sort', 'type', 'status', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallConfigDiscount - * @table plugin_wemall_config_discount - * @return void - */ - private function _create_plugin_wemall_config_discount() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_config_discount', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-配置-折扣', - ]), [ - ['name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '方案名称']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '方案描述']], - ['items', 'text', ['default' => NULL, 'null' => true, 'comment' => '方案规则']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '方案状态(0禁用,1使用)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(1已删,0未删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'sort', 'status', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallConfigLevel - * @table plugin_wemall_config_level - * @return void - */ - private function _create_plugin_wemall_config_level() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_config_level', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-配置-等级', - ]), [ - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '级别名称']], - ['cover', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '等级图标']], - ['cardbg', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '等级卡片']], - ['number', 'integer', ['limit' => 2, 'default' => 0, 'null' => true, 'comment' => '级别序号']], - ['upgrade_type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '升级规则(0单个,1同时)']], - ['upgrade_team', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '团队人数统计(0不计,1累计)']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户级别描述']], - ['extra', 'text', ['default' => NULL, 'null' => true, 'comment' => '配置规则']], - ['utime', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '更新时间']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '等级状态(1使用,0禁用)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'utime', 'status', 'number', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallConfigNotify - * @table plugin_wemall_config_notify - * @return void - */ - private function _create_plugin_wemall_config_notify() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_config_notify', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-配置-通知', - ]), [ - ['code', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '通知编号']], - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '通知标题']], - ['cover', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '通知图片']], - ['levels', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户等级']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '通知内容']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '通知描述']], - ['num_read', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '阅读次数']], - ['tips', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => 'TIPS显示']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '激活状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(1已删,0未删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'sort', 'name', 'tips', 'status', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallConfigPoster - * @table plugin_wemall_config_poster - * @return void - */ - private function _create_plugin_wemall_config_poster() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_config_poster', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-配置-海报', - ]), [ - ['code', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '推广编号']], - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '推广标题']], - ['levels', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户等级']], - ['devices', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '接口通道']], - ['image', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '推广图片']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '二维位置']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '推广描述']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '激活状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(1已删,0未删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'sort', 'name', 'status', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallConfigRebate - * @table plugin_wemall_config_rebate - * @return void - */ - private function _create_plugin_wemall_config_rebate() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_config_rebate', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-配置-返利', - ]), [ - ['type', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '奖励类型']], - ['code', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '配置编号']], - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '配置名称']], - ['path', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '等级关系']], - ['stype', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '结算类型(0支付结算,1收货结算)']], - ['p0_level', 'biginteger', ['limit' => 20, 'default' => -1, 'null' => true, 'comment' => '会员等级']], - ['p1_level', 'biginteger', ['limit' => 20, 'default' => -1, 'null' => true, 'comment' => '上1级等级']], - ['p2_level', 'biginteger', ['limit' => 20, 'default' => -1, 'null' => true, 'comment' => '上2级等级']], - ['p3_level', 'biginteger', ['limit' => 20, 'default' => -1, 'null' => true, 'comment' => '上3级等级']], - ['p0_reward_type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '会员计算类型(0固定金额,1交易比例,2利润比例)']], - ['p0_reward_number', 'decimal', ['precision' => 20, 'scale' => 6, 'default' => '0.000000', 'null' => true, 'comment' => '会员计算系数']], - ['p1_reward_type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '上1级计算类型(0固定金额,1交易比例,2利润比例)']], - ['p1_reward_number', 'decimal', ['precision' => 20, 'scale' => 6, 'default' => '0.000000', 'null' => true, 'comment' => '上1级计算系数']], - ['p2_reward_type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '上2级计算类型(0固定金额,1交易比例,2利润比例)']], - ['p2_reward_number', 'decimal', ['precision' => 20, 'scale' => 6, 'default' => '0.000000', 'null' => true, 'comment' => '上2级计算系数']], - ['p3_reward_type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '上3级计算类型(0固定金额,1交易比例,2利润比例)']], - ['p3_reward_number', 'decimal', ['precision' => 20, 'scale' => 6, 'default' => '0.000000', 'null' => true, 'comment' => '上3级计算系数']], - ['remark', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '配置描述']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '激活状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(1已删,0未删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'sort', 'name', 'type', 'stype', 'status', 'deleted', 'p1_level', 'p2_level', 'p3_level', 'p0_level', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallExpressCompany - * @table plugin_wemall_express_company - * @return void - */ - private function _create_plugin_wemall_express_company() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_express_company', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-快递-公司', - ]), [ - ['code', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '公司代码']], - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '公司名称']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '公司描述']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '激活状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(1已删,0未删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'sort', 'name', 'status', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallExpressTemplate - * @table plugin_wemall_express_template - * @return void - */ - private function _create_plugin_wemall_express_template() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_express_template', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-快递-模板', - ]), [ - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '模板编号']], - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '模板名称']], - ['normal', 'text', ['default' => NULL, 'null' => true, 'comment' => '默认规则']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '模板规则']], - ['company', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '快递公司']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '激活状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(1已删,0未删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'sort', 'name', 'status', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallGoods - * @table plugin_wemall_goods - * @return void - */ - private function _create_plugin_wemall_goods() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_goods', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-商品-内容', - ]), [ - ['ssid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属商家']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品编号']], - ['name', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '商品名称']], - ['marks', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '商品标签']], - ['cates', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '分类编号']], - ['cover', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '商品封面']], - ['slider', 'text', ['default' => NULL, 'null' => true, 'comment' => '轮播图片']], - ['specs', 'text', ['default' => NULL, 'null' => true, 'comment' => '商品规格(JSON)']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '商品详情']], - ['remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '商品描述']], - ['stock_total', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '商品库存统计']], - ['stock_sales', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '商品销售统计']], - ['stock_virtual', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '商品虚拟销量']], - ['price_selling', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '最低销售价格']], - ['price_market', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '最低市场价格']], - ['allow_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '最大积分兑换']], - ['allow_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '最大余额支付']], - ['rebate_type', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '参与返利(0无需返利,1需要返利)']], - ['delivery_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物流运费模板']], - ['limit_lowvip', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '限制购买等级(0不限制,其他限制)']], - ['limit_maxnum', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '最大购买数量(0不限制,其他限制)']], - ['level_agent', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '推广权益(0无,1有)']], - ['level_upgrade', 'biginteger', ['limit' => 20, 'default' => -1, 'null' => true, 'comment' => '购买升级等级(-1非入会,0不升级,其他升级)']], - ['discount_id', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '折扣方案编号(0无折扣,其他折扣)']], - ['num_read', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '访问阅读统计']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '列表排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '商品状态(1使用,0禁用)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'sort', 'ssid', 'status', 'deleted', 'rebate_type', 'discount_id', 'create_time', 'level_agent', 'level_upgrade', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallGoodsCate - * @table plugin_wemall_goods_cate - * @return void - */ - private function _create_plugin_wemall_goods_cate() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_goods_cate', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-商品-分类', - ]), [ - ['pid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上级分类']], - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '分类名称']], - ['cover', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '分类图标']], - ['remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '分类描述']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '使用状态']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'pid', 'sort', 'status', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallGoodsItem - * @table plugin_wemall_goods_item - * @return void - */ - private function _create_plugin_wemall_goods_item() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_goods_item', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-商品-规格', - ]), [ - ['gsku', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品SKU']], - ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品哈希']], - ['gcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品编号']], - ['gspec', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '商品规格']], - ['gunit', 'string', ['limit' => 10, 'default' => '件', 'null' => true, 'comment' => '商品单位']], - ['gimage', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '商品图片']], - ['stock_sales', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '销售数量']], - ['stock_total', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '商品库存']], - ['price_cost', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '进货成本']], - ['price_selling', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '销售价格']], - ['price_market', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '市场价格']], - ['allow_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '兑换积分']], - ['allow_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '余额支付']], - ['reward_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '奖励余额']], - ['reward_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '奖励积分']], - ['number_virtual', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟销量']], - ['number_express', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '计件系数']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '商品状态']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'gcode', 'gspec', 'ghash', 'status', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallGoodsMark - * @table plugin_wemall_goods_mark - * @return void - */ - private function _create_plugin_wemall_goods_mark() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_goods_mark', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-商品-标签', - ]), [ - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '标签名称']], - ['remark', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '标签描述']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '标签状态(1使用,0禁用)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'sort', 'status', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallGoodsStock - * @table plugin_wemall_goods_stock - * @return void - */ - private function _create_plugin_wemall_goods_stock() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_goods_stock', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-商品-库存', - ]), [ - ['batch_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作批量']], - ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品哈希']], - ['gcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品编号']], - ['gspec', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '商品规格']], - ['gstock', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '入库数量']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '数据状态(1使用,0禁用)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'ghash', 'gcode', 'status', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallHelpFeedback - * @table plugin_wemall_help_feedback - * @return void - */ - private function _create_plugin_wemall_help_feedback() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_help_feedback', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-意见-反馈', - ]), [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '反馈用户']], - ['phone', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '联系电话']], - ['images', 'text', ['default' => NULL, 'null' => true, 'comment' => '反馈图片']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '反馈内容']], - ['reply', 'text', ['default' => NULL, 'null' => true, 'comment' => '回复内容']], - ['reply_st', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '回复状态']], - ['reply_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '回复用户']], - ['reply_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '回复时间']], - ['sync', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '同步至常见问题状态(1已同步,0未同步)']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '展示状态(1使用,0禁用)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'sort', 'unid', 'status', 'deleted', 'reply_st', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallHelpProblem - * @table plugin_wemall_help_problem - * @return void - */ - private function _create_plugin_wemall_help_problem() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_help_problem', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-常见-问题', - ]), [ - ['fid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => false, 'comment' => '来自反馈']], - ['name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '问题标题']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '问题内容']], - ['num_er', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '未解决数']], - ['num_ok', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '已解决数']], - ['num_read', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '阅读次数']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '展示状态(1使用,0禁用)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'sort', 'status', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallHelpQuestion - * @table plugin_wemall_help_question - * @return void - */ - private function _create_plugin_wemall_help_question() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_help_question', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-问答-内容', - ]), [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '提问用户']], - ['name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '工单标题']], - ['phone', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '联系电话']], - ['order_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '关联订单']], - ['images', 'text', ['default' => NULL, 'null' => true, 'comment' => '工单图片']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '工单描述']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '工单状态(0取消,1新工单,2后台回复,3前台回复,4已完结)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'sort', 'name', 'unid', 'phone', 'status', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallHelpQuestionX - * @table plugin_wemall_help_question_x - * @return void - */ - private function _create_plugin_wemall_help_question_x() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_help_question_x', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-问答-评论', - ]), [ - ['ccid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '目标编号']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '文本内容']], - ['images', 'text', ['default' => NULL, 'null' => true, 'comment' => '图片内容']], - ['reply_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '后台用户']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1待审核,2已审核)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'ccid', 'unid', 'status', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallOrder - * @table plugin_wemall_order - * @return void - */ - private function _create_plugin_wemall_order() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_order', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-订单-内容', - ]), [ - ['ssid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属商家']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['puid1', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上1级代理']], - ['puid2', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上2级代理']], - ['puid3', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上3级代理']], - ['order_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '订单单号']], - ['order_ps', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '订单备注']], - ['amount_cost', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品成本']], - ['amount_real', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '实际金额']], - ['amount_total', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '订单金额']], - ['amount_goods', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品金额']], - ['amount_profit', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '销售利润']], - ['amount_reduct', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '随机减免']], - ['amount_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '余额支付']], - ['amount_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '积分抵扣']], - ['amount_payment', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '金额支付']], - ['amount_express', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '快递费用']], - ['amount_discount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '折扣后金额']], - ['coupon_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '优惠券编号']], - ['coupon_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '优惠券金额']], - ['allow_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '最大余额支付']], - ['allow_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '最大积分抵扣']], - ['ratio_integral', 'decimal', ['precision' => 20, 'scale' => 6, 'default' => '0.000000', 'null' => true, 'comment' => '积分兑换比例']], - ['number_goods', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '商品数量']], - ['number_express', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '快递计数']], - ['level_agent', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '升级代理等级']], - ['level_member', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '升级会员等级']], - ['rebate_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '返利金额']], - ['reward_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '奖励余额']], - ['reward_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '奖励积分']], - ['payment_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '支付时间']], - ['payment_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '支付状态(0未支付,1有支付)']], - ['payment_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '实际支付']], - ['delivery_type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '物流类型(0无配送,1需配送)']], - ['cancel_time', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '取消时间']], - ['cancel_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '取消状态']], - ['cancel_remark', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '取消描述']], - ['deleted_time', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '删除时间']], - ['deleted_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['deleted_remark', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '删除描述']], - ['confirm_time', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '签收时间']], - ['confirm_remark', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '签收描述']], - ['refund_code', 'string', ['limit' => 20, 'default' => NULL, 'null' => true, 'comment' => '售后单号']], - ['refund_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '售后状态(0未售后,1预订单,2待审核,3待退货,4已退货,5待退款,6已退款,7已完成)']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '流程状态(0已取消,1预订单,2待支付,3待审核,4待发货,5已发货,6已收货,7已评论)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'ssid', 'puid1', 'puid2', 'puid3', 'status', 'order_no', 'create_time', 'refund_code', 'coupon_code', 'delivery_type', 'cancel_status', 'refund_status', 'deleted_status', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallOrderCart - * @table plugin_wemall_order_cart - * @return void - */ - private function _create_plugin_wemall_order_cart() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_order_cart', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-订单-购物车', - ]), [ - ['ssid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属商家']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '规格哈希']], - ['gcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品编号']], - ['gspec', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '商品规格']], - ['number', 'biginteger', ['limit' => 20, 'default' => 1, 'null' => true, 'comment' => '商品数量']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'ssid', 'gcode', 'gspec', 'ghash', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallOrderItem - * @table plugin_wemall_order_item - * @return void - */ - private function _create_plugin_wemall_order_item() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_order_item', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-订单-商品', - ]), [ - ['ssid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属商家']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['gsku', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品SKU']], - ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品哈希']], - ['gcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品编号']], - ['gspec', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '商品规格']], - ['gunit', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '商品单凭']], - ['gname', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '商品名称']], - ['gcover', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '商品封面']], - ['order_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '订单单号']], - ['stock_sales', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '包含商品数量']], - ['amount_cost', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品成本单价']], - ['price_market', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品市场单价']], - ['price_selling', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品销售单价']], - ['total_price_cost', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品成本总价']], - ['total_price_market', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品市场总价']], - ['total_price_selling', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品销售总价']], - ['total_allow_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '最大余额支付']], - ['total_allow_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '最大兑换总分']], - ['total_reward_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品奖励余额']], - ['total_reward_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品奖励积分']], - ['level_code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户等级序号']], - ['level_name', 'string', ['limit' => 30, 'default' => '', 'null' => true, 'comment' => '用户等级名称']], - ['level_agent', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '推广权益(0无,1有)']], - ['level_upgrade', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '购买升级等级(-1非入会,0不升级,其他升级)']], - ['rebate_type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '参与返利状态(0不返,1返利)']], - ['rebate_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '参与返利金额']], - ['delivery_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '快递邮费模板']], - ['delivery_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '快递计费基数']], - ['discount_id', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '优惠方案编号']], - ['discount_rate', 'decimal', ['precision' => 20, 'scale' => 6, 'default' => '100.000000', 'null' => true, 'comment' => '销售价格折扣']], - ['discount_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品优惠金额']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '商品状态(1使用,0禁用)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'gsku', 'ssid', 'gcode', 'gspec', 'ghash', 'status', 'deleted', 'order_no', 'rebate_type', 'discount_id', 'level_agent', 'delivery_code', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallOrderRefund - * @table plugin_wemall_order_refund - * @return void - */ - private function _create_plugin_wemall_order_refund() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_order_refund', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-订单-售后', - ]), [ - ['ssid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属商家']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['type', 'biginteger', ['limit' => 20, 'default' => 1, 'null' => true, 'comment' => '申请类型(1退货退款,2仅退款)']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '售后单号']], - ['order_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '订单单号']], - ['reason', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '退款原因']], - ['number', 'biginteger', ['limit' => 20, 'default' => 1, 'null' => true, 'comment' => '退货数量']], - ['amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '申请金额']], - ['payment_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退款支付']], - ['balance_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退款余额']], - ['integral_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退款积分']], - ['payment_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '退款单号']], - ['balance_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '退回单号']], - ['integral_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '退回单号']], - ['phone', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '联系电话']], - ['images', 'text', ['default' => NULL, 'null' => true, 'comment' => '申请图片']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '申请说明']], - ['remark', 'string', ['limit' => 180, 'default' => NULL, 'null' => true, 'comment' => '操作描述']], - ['express_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '快递单号']], - ['express_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '快递公司']], - ['express_name', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '快递名称']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '流程状态(0已取消,1预订单,2待审核,3待退货,4已退货,5待退款,6已退款,7已完成)']], - ['status_at', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '状态变更时间']], - ['status_ds', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '状态变更描述']], - ['admin_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '后台用户']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'type', 'code', 'ssid', 'status', 'order_no', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallOrderSend - * @table plugin_wemall_order_send - * @return void - */ - private function _create_plugin_wemall_order_send() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_order_send', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-订单-配送', - ]), [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '商城用户编号']], - ['order_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商城订单单号']], - ['address_id', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '配送地址编号']], - ['user_idcode', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '收货人证件号码']], - ['user_idimg1', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '收货人证件正面']], - ['user_idimg2', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '收货人证件反面']], - ['user_name', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '收货人联系名称']], - ['user_phone', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '收货人联系手机']], - ['region_prov', 'string', ['limit' => 30, 'default' => '', 'null' => true, 'comment' => '配送地址的省份']], - ['region_city', 'string', ['limit' => 30, 'default' => '', 'null' => true, 'comment' => '配送地址的城市']], - ['region_area', 'string', ['limit' => 30, 'default' => '', 'null' => true, 'comment' => '配送地址的区域']], - ['region_addr', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '配送的详细地址']], - ['delivery_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '配送模板编号']], - ['delivery_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '快递计费基数']], - ['delivery_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '配送计算金额']], - ['delivery_remark', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '配送计算描述']], - ['express_time', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '快递发送时间']], - ['express_code', 'string', ['limit' => 80, 'default' => '', 'null' => true, 'comment' => '快递运送单号']], - ['express_remark', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '快递发送备注']], - ['company_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '快递公司编码']], - ['company_name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '快递公司名称']], - ['extra', 'text', ['default' => NULL, 'null' => true, 'comment' => '原始数据']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '发货状态(1待发货,2已发货,3已收货)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'status', 'deleted', 'order_no', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallOrderSender - * @table plugin_wemall_order_sender - * @return void - */ - private function _create_plugin_wemall_order_sender() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_order_sender', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-订单-配送', - ]), [ - ['ssid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属商家']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '商城用户编号']], - ['order_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商城订单单号']], - ['address_id', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '配送地址编号']], - ['user_idcode', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '收货人证件号码']], - ['user_idimg1', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '收货人证件正面']], - ['user_idimg2', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '收货人证件反面']], - ['user_name', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '收货人联系名称']], - ['user_phone', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '收货人联系手机']], - ['region_prov', 'string', ['limit' => 30, 'default' => '', 'null' => true, 'comment' => '配送地址的省份']], - ['region_city', 'string', ['limit' => 30, 'default' => '', 'null' => true, 'comment' => '配送地址的城市']], - ['region_area', 'string', ['limit' => 30, 'default' => '', 'null' => true, 'comment' => '配送地址的区域']], - ['region_addr', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '配送的详细地址']], - ['delivery_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '配送模板编号']], - ['delivery_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '快递计费基数']], - ['delivery_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '配送计算金额']], - ['delivery_remark', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '配送计算描述']], - ['express_time', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '快递发送时间']], - ['express_code', 'string', ['limit' => 80, 'default' => '', 'null' => true, 'comment' => '快递运送单号']], - ['express_remark', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '快递发送备注']], - ['company_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '快递公司编码']], - ['company_name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '快递公司名称']], - ['extra', 'text', ['default' => NULL, 'null' => true, 'comment' => '原始数据']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '发货状态(1待发货,2已发货,3已收货)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'ssid', 'status', 'deleted', 'order_no', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserActionCollect - * @table plugin_wemall_user_action_collect - * @return void - */ - private function _create_plugin_wemall_user_action_collect() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_user_action_collect', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-收藏', - ]), [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['gcode', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品编号']], - ['times', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '记录次数']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'sort', 'gcode', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserActionComment - * @table plugin_wemall_user_action_comment - * @return void - */ - private function _create_plugin_wemall_user_action_comment() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_user_action_comment', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-评论', - ]), [ - ['ssid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属商家']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['code', 'string', ['limit' => 32, 'default' => NULL, 'null' => true, 'comment' => '评论编号']], - ['gcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品编号']], - ['ghash', 'string', ['limit' => 32, 'default' => NULL, 'null' => true, 'comment' => '商品哈希']], - ['order_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '订单单号']], - ['rate', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '5.00', 'null' => true, 'comment' => '评论分数']], - ['content', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '评论内容']], - ['images', 'text', ['default' => NULL, 'null' => true, 'comment' => '评论图片']], - ['status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '评论状态(0隐藏,1显示)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'code', 'ssid', 'ghash', 'gcode', 'status', 'deleted', 'order_no', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserActionHistory - * @table plugin_wemall_user_action_history - * @return void - */ - private function _create_plugin_wemall_user_action_history() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_user_action_history', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-足迹', - ]), [ - ['ssid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属商家']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['gcode', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品编号']], - ['times', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '记录次数']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'sort', 'ssid', 'gcode', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserActionSearch - * @table plugin_wemall_user_action_search - * @return void - */ - private function _create_plugin_wemall_user_action_search() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_user_action_search', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-搜索', - ]), [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['keys', 'string', ['limit' => 99, 'default' => '', 'null' => true, 'comment' => '关键词']], - ['times', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '搜索次数']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'keys', 'unid', 'sort', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserCheckin - * @table plugin_wemall_user_checkin - * @return void - */ - private function _create_plugin_wemall_user_checkin() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_user_checkin', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '业务-活动-签到', - ]), [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户UNID']], - ['times', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '连续天数']], - ['timed', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '奖励天数']], - ['date', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '签到日期']], - ['balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '赠送余额']], - ['integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '赠送积分']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '生效状态(0未生效,1已生效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删除,1已删除)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'date', 'status', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserCoupon - * @table plugin_wemall_user_coupon - * @return void - */ - private function _create_plugin_wemall_user_coupon() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_user_coupon', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-卡券', - ]), [ - ['type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '卡券类型']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户UNID']], - ['coid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '配置编号']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '卡券编号']], - ['used', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '使用状态']], - ['used_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '使用时间']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '生效状态(0未生效,1待使用,2已使用,3已过期)']], - ['status_desc', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '状态描述']], - ['status_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '修改时间']], - ['expire', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '有效时间']], - ['expire_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '有效日期']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删除,1已删除)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ['confirm_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '到账时间']], - ], [ - 'code', 'unid', 'coid', 'used', 'status', 'expire', 'deleted', 'create_time', 'confirm_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserCreate - * @table plugin_wemall_user_create - * @return void - */ - private function _create_plugin_wemall_user_create() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_user_create', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-创建', - ]), [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => false, 'comment' => '关联用户']], - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '用户姓名']], - ['phone', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '手机号码']], - ['headimg', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户头像']], - ['password', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '初始密码']], - ['rebate_total', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '累计返利']], - ['rebate_total_code', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '记录编号']], - ['rebate_total_desc', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '记录描述']], - ['rebate_usable', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '可提返利']], - ['rebate_usable_code', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '记录编号']], - ['rebate_usable_desc', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '记录描述']], - ['agent_entry', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '代理权限']], - ['agent_phone', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '上级手机']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'name', 'unid', 'phone', 'status', 'deleted', 'create_time', 'agent_entry', 'agent_phone', 'rebate_total', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserRebate - * @table plugin_wemall_user_rebate - * @return void - */ - private function _create_plugin_wemall_user_rebate() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_user_rebate', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-返利', - ]), [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户UNID']], - ['layer', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上级层级']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '奖励编号']], - ['hash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '维一编号']], - ['date', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '奖励日期']], - ['type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '奖励类型']], - ['name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '奖励名称']], - ['amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '奖励数量']], - ['order_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '订单单号']], - ['order_unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '订单用户']], - ['order_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '订单金额']], - ['remark', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '奖励描述']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '生效状态(0未生效,1已生效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删除,1已删除)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ['confirm_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '到账时间']], - ], [ - 'type', 'date', 'code', 'name', 'unid', 'hash', 'status', 'deleted', 'order_no', 'order_unid', 'create_time', 'confirm_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserRecharge - * @table plugin_wemall_user_recharge - * @return void - */ - private function _create_plugin_wemall_user_recharge() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_user_recharge', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-充值', - ]), [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '账号编号']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作编号']], - ['name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '操作名称']], - ['remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '操作备注']], - ['amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '操作金额']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删除,1已删除)']], - ['create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '系统用户']], - ['deleted_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '系统用户']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['deleted_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '删除时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'code', 'deleted', 'create_time', 'deleted_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserRelation - * @table plugin_wemall_user_relation - * @return void - */ - private function _create_plugin_wemall_user_relation() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_user_relation', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-关系', - ]), [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '当前用户']], - ['puids', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '绑定状态']], - ['puid1', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上1级代理']], - ['puid2', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上2级代理']], - ['puid3', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上3级代理']], - ['layer', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属层级']], - ['path', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '关系路径']], - ['extra', 'text', ['default' => NULL, 'null' => true, 'comment' => '扩展数据']], - ['entry_agent', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '推广权益(0无,1有)']], - ['entry_member', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '入会礼包(0无,1有)']], - ['level_code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '会员等级']], - ['level_name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '会员名称']], - ['agent_uuid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '绑定用户']], - ['agent_state', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '绑定状态']], - ['agent_level_code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '代理等级']], - ['agent_level_name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '代理名称']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'path', 'puid1', 'puid2', 'puid3', 'level_code', 'agent_uuid', 'create_time', 'entry_agent', 'entry_member', 'agent_level_code', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserTransfer - * @table plugin_wemall_user_transfer - * @return void - */ - private function _create_plugin_wemall_user_transfer() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_wemall_user_transfer', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-提现', - ]), [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户UNID']], - ['type', 'string', ['limit' => 30, 'default' => '', 'null' => true, 'comment' => '提现方式']], - ['date', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '提现日期']], - ['code', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '提现单号']], - ['appid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号APPID']], - ['openid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号OPENID']], - ['username', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号真实姓名']], - ['charge_rate', 'decimal', ['precision' => 20, 'scale' => 4, 'default' => '0.0000', 'null' => true, 'comment' => '提现手续费比例']], - ['charge_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '提现手续费金额']], - ['amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '提现转账金额']], - ['qrcode', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '收款码图片地址']], - ['bank_wseq', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '微信银行编号']], - ['bank_name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '开户银行名称']], - ['bank_bran', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '开户分行名称']], - ['bank_user', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '开户账号姓名']], - ['bank_code', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '开户银行卡号']], - ['alipay_user', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '支付宝姓名']], - ['alipay_code', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '支付宝账号']], - ['remark', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '提现描述']], - ['trade_no', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '交易单号']], - ['trade_time', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '打款时间']], - ['change_time', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '处理时间']], - ['change_desc', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '处理描述']], - ['audit_time', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '审核时间']], - ['audit_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '审核状态']], - ['audit_remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '审核描述']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '提现状态(0失败,1待审核,2已审核,3打款中,4已打款,5已收款)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'unid', 'date', 'type', 'appid', 'openid', 'status', 'create_time', 'audit_status', - ]); - } - -} diff --git a/database/migrations/20009999999997_install_payment_table.php b/database/migrations/20009999999997_install_payment_table.php deleted file mode 100644 index 2b1a16dc8..000000000 --- a/database/migrations/20009999999997_install_payment_table.php +++ /dev/null @@ -1,231 +0,0 @@ -_create_plugin_payment_address(); - $this->_create_plugin_payment_balance(); - $this->_create_plugin_payment_config(); - $this->_create_plugin_payment_integral(); - $this->_create_plugin_payment_record(); - $this->_create_plugin_payment_refund(); - } - - /** - * 创建数据对象 - * @class PluginPaymentAddress - * @table plugin_payment_address - * @return void - */ - private function _create_plugin_payment_address() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_payment_address', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-支付-地址', - ]), [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '主账号ID']], - ['type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '默认状态(0普通,1默认)']], - ['idcode', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '身体证证号']], - ['idimg1', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '身份证正面']], - ['idimg2', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '身份证反面']], - ['user_name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '收货人姓名']], - ['user_phone', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '收货人手机']], - ['region_prov', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '地址-省份']], - ['region_city', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '地址-城市']], - ['region_area', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '地址-区域']], - ['region_addr', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '地址-详情']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(1已删,0未删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'type', 'unid', 'deleted', 'user_phone', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginPaymentBalance - * @table plugin_payment_balance - * @return void - */ - private function _create_plugin_payment_balance() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_payment_balance', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-支付-余额', - ]), [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '账号编号']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作编号']], - ['name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '操作名称']], - ['remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '操作备注']], - ['amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '操作金额']], - ['amount_prev', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '操作前金额']], - ['amount_next', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '操作后金额']], - ['cancel', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '作废状态(0未作废,1已作废)']], - ['unlock', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '解锁状态(0锁定中,1已生效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删除,1已删除)']], - ['create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '系统用户']], - ['cancel_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '作废时间']], - ['unlock_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '解锁时间']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['deleted_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '删除时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'code', 'cancel', 'unlock', 'deleted', 'create_time', 'deleted_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginPaymentConfig - * @table plugin_payment_config - * @return void - */ - private function _create_plugin_payment_config() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_payment_config', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-支付-配置', - ]), [ - ['type', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '支付类型']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '通道编号']], - ['name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '支付名称']], - ['cover', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '支付图标']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '支付说明']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '支付参数']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '支付状态(1使用,0禁用)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'type', 'code', 'sort', 'status', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginPaymentIntegral - * @table plugin_payment_integral - * @return void - */ - private function _create_plugin_payment_integral() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_payment_integral', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-支付-积分', - ]), [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '账号编号']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作编号']], - ['name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '操作名称']], - ['remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '操作备注']], - ['amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '操作金额']], - ['amount_prev', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '操作前金额']], - ['amount_next', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '操作后金额']], - ['cancel', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '作废状态(0未作废,1已作废)']], - ['unlock', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '解锁状态(0锁定中,1已生效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删除,1已删除)']], - ['create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '系统用户']], - ['cancel_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '作废时间']], - ['unlock_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '解锁时间']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['deleted_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '删除时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'code', 'cancel', 'unlock', 'deleted', 'create_time', 'deleted_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginPaymentRecord - * @table plugin_payment_record - * @return void - */ - private function _create_plugin_payment_record() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_payment_record', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-支付-行为', - ]), [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '主账号编号']], - ['usid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '子账号编号']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '发起支付号']], - ['order_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '原订单编号']], - ['order_name', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '原订单标题']], - ['order_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '原订单金额']], - ['channel_type', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '支付通道类型']], - ['channel_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '支付通道编号']], - ['payment_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '支付生效时间']], - ['payment_trade', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '平台交易编号']], - ['payment_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '支付状态(0未付,1已付,2取消)']], - ['payment_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '实际支付金额']], - ['payment_coupon', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '平台优惠券金额']], - ['payment_images', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '凭证支付图片']], - ['payment_remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '支付状态备注']], - ['payment_notify', 'text', ['default' => NULL, 'null' => true, 'comment' => '支付通知内容']], - ['audit_user', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '审核用户(系统用户ID)']], - ['audit_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '审核时间']], - ['audit_status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '审核状态(0已拒,1待审,2已审)']], - ['audit_remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '审核描述']], - ['refund_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '退款状态(0未退,1已退)']], - ['refund_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '累计退款']], - ['refund_payment', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退回金额']], - ['refund_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退回余额']], - ['refund_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退回积分']], - ['used_payment', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '支付金额']], - ['used_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '扣除余额']], - ['used_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '扣除积分']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'usid', 'code', 'order_no', 'create_time', 'audit_status', 'channel_type', 'channel_code', 'payment_trade', 'refund_status', 'payment_status', - ]); - } - - /** - * 创建数据对象 - * @class PluginPaymentRefund - * @table plugin_payment_refund - * @return void - */ - private function _create_plugin_payment_refund() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_payment_refund', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-支付-退款', - ]), [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '主账号编号']], - ['usid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '子账号编号']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '发起支付号']], - ['record_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '子支付编号']], - ['refund_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '完成时间']], - ['refund_trade', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '交易编号']], - ['refund_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '支付状态(0未付,1已付,2取消)']], - ['refund_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退款金额']], - ['refund_account', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '退回账号']], - ['refund_scode', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '状态编码']], - ['refund_remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '退款备注']], - ['refund_notify', 'text', ['default' => NULL, 'null' => true, 'comment' => '通知内容']], - ['used_payment', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退回金额']], - ['used_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退回余额']], - ['used_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退回积分']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'usid', 'code', 'record_code', 'create_time', 'refund_trade', 'refund_status', 'refund_account', - ]); - } - -} diff --git a/database/migrations/20009999999998_install_account_table.php b/database/migrations/20009999999998_install_account_table.php deleted file mode 100644 index b03964f1d..000000000 --- a/database/migrations/20009999999998_install_account_table.php +++ /dev/null @@ -1,142 +0,0 @@ -_create_plugin_account_auth(); - $this->_create_plugin_account_bind(); - $this->_create_plugin_account_msms(); - $this->_create_plugin_account_user(); - } - - /** - * 创建数据对象 - * @class PluginAccountAuth - * @table plugin_account_auth - * @return void - */ - private function _create_plugin_account_auth() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_account_auth', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-账号-授权', - ]), [ - ['usid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '终端账号']], - ['time', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '有效时间']], - ['type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '授权类型']], - ['token', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '授权令牌']], - ['tokenv', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '授权验证']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'usid', 'type', 'time', 'token', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginAccountBind - * @table plugin_account_bind - * @return void - */ - private function _create_plugin_account_bind() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_account_bind', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-账号-终端', - ]), [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '会员编号']], - ['type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '终端类型']], - ['phone', 'string', ['limit' => 30, 'default' => '', 'null' => true, 'comment' => '绑定手机']], - ['appid', 'string', ['limit' => 30, 'default' => '', 'null' => true, 'comment' => 'APPID']], - ['openid', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => 'OPENID']], - ['unionid', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => 'UnionID']], - ['headimg', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户头像']], - ['nickname', 'string', ['limit' => 99, 'default' => '', 'null' => true, 'comment' => '用户昵称']], - ['password', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '登录密码']], - ['extra', 'text', ['default' => NULL, 'null' => true, 'comment' => '扩展数据']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '账号状态']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '注册时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'type', 'unid', 'sort', 'phone', 'appid', 'status', 'openid', 'unionid', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginAccountMsms - * @table plugin_account_msms - * @return void - */ - private function _create_plugin_account_msms() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_account_msms', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-账号-短信', - ]), [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => false, 'comment' => '账号编号']], - ['usid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => false, 'comment' => '终端编号']], - ['type', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '短信类型']], - ['scene', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '业务场景']], - ['smsid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '消息编号']], - ['phone', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '目标手机']], - ['result', 'string', ['limit' => 512, 'default' => '', 'null' => true, 'comment' => '返回结果']], - ['params', 'string', ['limit' => 512, 'default' => '', 'null' => true, 'comment' => '短信内容']], - ['status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '短信状态(0失败,1成功)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'type', 'usid', 'unid', 'phone', 'smsid', 'scene', 'status', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginAccountUser - * @table plugin_account_user - * @return void - */ - private function _create_plugin_account_user() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('plugin_account_user', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-账号-资料', - ]), [ - ['code', 'string', ['limit' => 16, 'default' => '', 'null' => true, 'comment' => '用户编号']], - ['phone', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '用户手机']], - ['email', 'string', ['limit' => 99, 'default' => '', 'null' => true, 'comment' => '用户邮箱']], - ['unionid', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => 'UnionID']], - ['username', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户姓名']], - ['nickname', 'string', ['limit' => 99, 'default' => '', 'null' => true, 'comment' => '用户昵称']], - ['password', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '认证密码']], - ['headimg', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户头像']], - ['region_prov', 'string', ['limit' => 99, 'default' => '', 'null' => true, 'comment' => '所在省份']], - ['region_city', 'string', ['limit' => 99, 'default' => '', 'null' => true, 'comment' => '所在城市']], - ['region_area', 'string', ['limit' => 99, 'default' => '', 'null' => true, 'comment' => '所在区域']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '备注(内部使用)']], - ['extra', 'text', ['default' => NULL, 'null' => true, 'comment' => '扩展数据']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '用户状态(0拉黑,1正常)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '注册时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'sort', 'phone', 'email', 'status', 'unionid', 'deleted', 'username', 'nickname', 'region_prov', 'region_city', 'region_area', 'create_time', - ]); - } - -} diff --git a/database/migrations/20009999999999_install_package.php b/database/migrations/20009999999999_install_package.php deleted file mode 100644 index f1f947f4b..000000000 --- a/database/migrations/20009999999999_install_package.php +++ /dev/null @@ -1,298 +0,0 @@ -inserData(); - $this->insertConf(); - $this->insertUser(); - $this->insertMenu(); - } - - /** - * 安装扩展数据 - * @return void - */ - private function inserData() - { - // 待解析处理数据 - $json = '[]'; - // 解析并写入扩展数据 - if (is_array($tables = json_decode($json, true)) && count($tables) > 0) { - foreach ($tables as $table => $path) if (($model = m($table))->count() < 1) { - $name = Str::studly($table); - ProcessService::message(" -- Starting write {$table} table ..." . PHP_EOL); - [$ls, $rs, $fp] = [0, [], fopen(__DIR__ . DIRECTORY_SEPARATOR . $path, 'r+')]; - while (!feof($fp)) { - if (empty($text = trim(fgets($fp)))) continue; else $ls++; - if (is_array($rw = json_decode($text, true))) $rs[] = $rw; - if (count($rs) > 100) [, $rs] = [$model->strict(false)->insertAll($rs), []]; - ProcessService::message(" -- -- {$name}:{$ls}", 1); - } - count($rs) > 0 && $model->strict(false)->insertAll($rs); - ProcessService::message(" -- Finished write {$table} table, Total {$ls} rows.", 2); - } - } - } - - /** - * 初始化配置参数 - * @return void - */ - private function insertConf() - { - $modal = SystemConfig::mk()->whereRaw('1=1')->findOrEmpty(); - $modal->isEmpty() && $modal->insertAll([ - ['type' => 'base', 'name' => 'app_name', 'value' => 'ThinkAdmin'], - ['type' => 'base', 'name' => 'app_version', 'value' => 'v6'], - ['type' => 'base', 'name' => 'editor', 'value' => 'ckeditor5'], - ['type' => 'base', 'name' => 'login_name', 'value' => '系统管理'], - ['type' => 'base', 'name' => 'site_copy', 'value' => '©版权所有 2014-' . date('Y') . ' ThinkAdmin'], - ['type' => 'base', 'name' => 'site_icon', 'value' => 'https://thinkadmin.top/static/img/logo.png'], - ['type' => 'base', 'name' => 'site_name', 'value' => 'ThinkAdmin'], - ['type' => 'base', 'name' => 'site_theme', 'value' => 'default'], - ['type' => 'wechat', 'name' => 'type', 'value' => 'api'], - ['type' => 'storage', 'name' => 'type', 'value' => 'local'], - ['type' => 'storage', 'name' => 'allow_exts', 'value' => 'doc,gif,ico,jpg,mp3,mp4,p12,pem,png,zip,rar,xls,xlsx'], - ]); - } - - /** - * 初始化用户数据 - * @return void - */ - private function insertUser() - { - $modal = SystemUser::mk()->whereRaw('1=1')->findOrEmpty(); - $modal->isEmpty() && $modal->insert([ - 'id' => '10000', - 'username' => 'admin', - 'nickname' => '超级管理员', - 'password' => '21232f297a57a5a743894a0e4a801fc3', - 'headimg' => 'https://thinkadmin.top/static/img/head.png', - ]); - } - - /** - * 初始化系统菜单 - * @return void - */ - private function insertMenu() - { - if (SystemMenu::mk()->whereRaw('1=1')->findOrEmpty()->isEmpty()) { - // 解析并初始化菜单数据 - $json = '[ - { - "name": "插件中心", - "icon": "", - "url": "plugin-center/index/index", - "node": "plugin-center/index/index", - "params": "" - }, - { - "name": "微信管理", - "icon": "", - "url": "#", - "node": "", - "params": "", - "subs": [ - { - "name": "微信管理", - "icon": "", - "url": "#", - "node": "", - "params": "", - "subs": [ - { - "name": "微信接口配置", - "url": "wechat/config/options", - "node": "wechat/config/options", - "icon": "layui-icon layui-icon-set", - "params": "" - }, - { - "name": "微信支付配置", - "url": "wechat/config/payment", - "node": "wechat/config/payment", - "icon": "layui-icon layui-icon-rmb", - "params": "" - } - ] - }, - { - "name": "微信定制", - "icon": "", - "url": "#", - "node": "", - "params": "", - "subs": [ - { - "name": "微信粉丝管理", - "url": "wechat/fans/index", - "node": "wechat/fans/index", - "icon": "layui-icon layui-icon-username", - "params": "" - }, - { - "name": "微信图文管理", - "url": "wechat/news/index", - "node": "wechat/news/index", - "icon": "layui-icon layui-icon-template-1", - "params": "" - }, - { - "name": "微信菜单配置", - "url": "wechat/menu/index", - "node": "wechat/menu/index", - "icon": "layui-icon layui-icon-cellphone", - "params": "" - }, - { - "name": "回复规则管理", - "url": "wechat/keys/index", - "node": "wechat/keys/index", - "icon": "layui-icon layui-icon-engine", - "params": "" - }, - { - "name": "关注自动回复", - "url": "wechat/auto/index", - "node": "wechat/auto/index", - "icon": "layui-icon layui-icon-release", - "params": "" - } - ] - }, - { - "name": "微信支付", - "icon": "", - "url": "#", - "node": "", - "params": "", - "subs": [ - { - "name": "支付行为管理", - "url": "wechat/payment.record/index", - "node": "wechat/payment.record/index", - "icon": "layui-icon layui-icon-rmb", - "params": "" - }, - { - "name": "支付退款管理", - "url": "wechat/payment.refund/index", - "node": "wechat/payment.refund/index", - "icon": "layui-icon layui-icon-engine", - "params": "" - } - ] - } - ] - }, - { - "name": "系统管理", - "icon": "", - "url": "#", - "node": "", - "params": "", - "subs": [ - { - "name": "系统配置", - "icon": "", - "url": "#", - "node": "", - "params": "", - "subs": [ - { - "name": "系统参数配置", - "url": "admin/config/index", - "node": "admin/config/index", - "icon": "layui-icon layui-icon-set", - "params": "" - }, - { - "name": "系统任务管理", - "url": "admin/queue/index", - "node": "admin/queue/index", - "icon": "layui-icon layui-icon-log", - "params": "" - }, - { - "name": "系统日志管理", - "url": "admin/oplog/index", - "node": "admin/oplog/index", - "icon": "layui-icon layui-icon-form", - "params": "" - }, - { - "name": "数据字典管理", - "url": "admin/base/index", - "node": "admin/base/index", - "icon": "layui-icon layui-icon-code-circle", - "params": "" - }, - { - "name": "系统文件管理", - "url": "admin/file/index", - "node": "admin/file/index", - "icon": "layui-icon layui-icon-carousel", - "params": "" - }, - { - "name": "系统菜单管理", - "url": "admin/menu/index", - "node": "admin/menu/index", - "icon": "layui-icon layui-icon-layouts", - "params": "" - } - ] - }, - { - "name": "权限管理", - "icon": "", - "url": "#", - "node": "", - "params": "", - "subs": [ - { - "name": "访问权限管理", - "url": "admin/auth/index", - "node": "admin/auth/index", - "icon": "layui-icon layui-icon-vercode", - "params": "" - }, - { - "name": "系统用户管理", - "url": "admin/user/index", - "node": "admin/user/index", - "icon": "layui-icon layui-icon-username", - "params": "" - } - ] - } - ] - } -]'; - PhinxExtend::write2menu(json_decode($json, true) ?: []); - } - } -} \ No newline at end of file diff --git a/plugin/think-plugs-wechat-service/stc/database/20230209000001_install_wechat_service.php b/plugin/think-plugs-wechat-service/stc/database/20230209000001_install_wechat_service.php deleted file mode 100644 index c5fea56f5..000000000 --- a/plugin/think-plugs-wechat-service/stc/database/20230209000001_install_wechat_service.php +++ /dev/null @@ -1,81 +0,0 @@ - -// +---------------------------------------------------------------------- -// | 官方网站: https://thinkadmin.top -// +---------------------------------------------------------------------- -// | 免责声明 ( https://thinkadmin.top/disclaimer ) -// | 会员免费 ( https://thinkadmin.top/vip-introduce ) -// +---------------------------------------------------------------------- -// | gitee 代码仓库:https://gitee.com/zoujingli/think-plugs-wechat-service -// | github 代码仓库:https://github.com/zoujingli/think-plugs-wechat-service -// +---------------------------------------------------------------------- - -use think\migration\Migrator; - -class InstallWechatService extends Migrator -{ - - /** - * 创建数据库 - */ - public function change() - { - set_time_limit(0); - @ini_set('memory_limit', -1); - $this->_create_wechat_auth(); - } - - /** - * 创建数据对象 - * @class WechatAuth - * @table wechat_auth - * @return void - */ - private function _create_wechat_auth() - { - // 当前数据表 - $table = 'wechat_auth'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-授权', - ]) - ->addColumn('authorizer_appid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '微信APPID']) - ->addColumn('authorizer_access_token', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '授权Token']) - ->addColumn('authorizer_refresh_token', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '刷新Token']) - ->addColumn('expires_in', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => 'Token时限']) - ->addColumn('user_alias', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号别名']) - ->addColumn('user_name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '众众号原账号']) - ->addColumn('user_nickname', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号昵称']) - ->addColumn('user_headimg', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '公众号头像']) - ->addColumn('user_signature', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '公众号描述']) - ->addColumn('user_company', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '公众号公司']) - ->addColumn('func_info', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号集权']) - ->addColumn('service_type', 'string', ['limit' => 10, 'default' => '', 'null' => true, 'comment' => '公众号类型']) - ->addColumn('service_verify', 'string', ['limit' => 10, 'default' => '', 'null' => true, 'comment' => '公众号认证']) - ->addColumn('qrcode_url', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '公众号二维码']) - ->addColumn('businessinfo', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '业务序列内容']) - ->addColumn('miniprograminfo', 'text', ['default' => NULL, 'null' => true, 'comment' => '小程序序列内容']) - ->addColumn('total', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '统计调用次数']) - ->addColumn('appkey', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '应用接口KEY']) - ->addColumn('appuri', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '应用接口URI']) - ->addColumn('status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '授权状态(0已取消,1已授权)']) - ->addColumn('deleted', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删除,1已删除)']) - ->addColumn('auth_time', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '授权时间']) - ->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']) - ->addIndex('status', ['name' => 'ia87695d1d_status']) - ->addIndex('deleted', ['name' => 'ia87695d1d_deleted']) - ->addIndex('authorizer_appid', ['name' => 'ia87695d1d_authorizer_appid']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } -} diff --git a/plugin/think-plugs-wechat-service/stc/database/20241016000007_install_wechat20241016.php b/plugin/think-plugs-wechat-service/stc/database/20241016000007_install_wechat20241016.php new file mode 100644 index 000000000..7f2ab727e --- /dev/null +++ b/plugin/think-plugs-wechat-service/stc/database/20241016000007_install_wechat20241016.php @@ -0,0 +1,70 @@ +_create_wechat_auth(); + } + + /** + * 创建数据对象 + * @class WechatAuth + * @table wechat_auth + * @return void + */ + private function _create_wechat_auth() + { + // 创建数据表对象 + $table = $this->table('wechat_auth', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-授权', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['authorizer_appid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '微信APPID']], + ['authorizer_access_token', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '授权Token']], + ['authorizer_refresh_token', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '刷新Token']], + ['expires_in', 'integer', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => 'Token时限']], + ['user_alias', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号别名']], + ['user_name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '众众号原账号']], + ['user_nickname', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号昵称']], + ['user_headimg', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '公众号头像']], + ['user_signature', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '公众号描述']], + ['user_company', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '公众号公司']], + ['func_info', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号集权']], + ['service_type', 'string', ['limit' => 10, 'default' => '', 'null' => true, 'comment' => '公众号类型']], + ['service_verify', 'string', ['limit' => 10, 'default' => '', 'null' => true, 'comment' => '公众号认证']], + ['qrcode_url', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '公众号二维码']], + ['businessinfo', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '业务序列内容']], + ['miniprograminfo', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '小程序序列内容']], + ['total', 'integer', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '统计调用次数']], + ['appkey', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '应用接口KEY']], + ['appuri', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '应用接口URI']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '授权状态(0已取消,1已授权)']], + ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删除,1已删除)']], + ['auth_time', 'integer', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '授权时间']], + ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], + ], [ + 'status', 'deleted', 'authorizer_appid', + ], true); + } +} diff --git a/plugin/think-plugs-wechat/stc/database/20221013045829_install_wechat.php b/plugin/think-plugs-wechat/stc/database/20221013045829_install_wechat.php deleted file mode 100644 index f4dfd5749..000000000 --- a/plugin/think-plugs-wechat/stc/database/20221013045829_install_wechat.php +++ /dev/null @@ -1,416 +0,0 @@ - -// +---------------------------------------------------------------------- -// | 官方网站: https://thinkadmin.top -// +---------------------------------------------------------------------- -// | 开源协议 ( https://mit-license.org ) -// | 免责声明 ( https://thinkadmin.top/disclaimer ) -// +---------------------------------------------------------------------- -// | gitee 代码仓库:https://gitee.com/zoujingli/think-plugs-wechat -// | github 代码仓库:https://github.com/zoujingli/think-plugs-wechat -// +---------------------------------------------------------------------- - -use think\migration\Migrator; - -@set_time_limit(0); -@ini_set('memory_limit', -1); - -/** - * 微信模块数据表 - */ -class InstallWechat extends Migrator -{ - - /** - * 创建数据库 - */ - public function change() - { - $this->_create_wechat_auto(); - $this->_create_wechat_fans(); - $this->_create_wechat_fans_tags(); - $this->_create_wechat_keys(); - $this->_create_wechat_media(); - $this->_create_wechat_news(); - $this->_create_wechat_news_article(); - $this->_create_wechat_payment_record(); - $this->_create_wechat_payment_refund(); - } - - /** - * 创建数据对象 - * @class WechatAuto - * @table wechat_auto - * @return void - */ - private function _create_wechat_auto() - { - - // 当前数据表 - $table = 'wechat_auto'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-回复', - ]) - ->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '类型(text,image,news)']) - ->addColumn('time', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '延迟时间']) - ->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '消息编号']) - ->addColumn('appid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号APPID']) - ->addColumn('content', 'text', ['default' => NULL, 'null' => true, 'comment' => '文本内容']) - ->addColumn('image_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '图片链接']) - ->addColumn('voice_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '语音链接']) - ->addColumn('music_title', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '音乐标题']) - ->addColumn('music_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '音乐链接']) - ->addColumn('music_image', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '缩略图片']) - ->addColumn('music_desc', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '音乐描述']) - ->addColumn('video_title', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '视频标题']) - ->addColumn('video_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '视频URL']) - ->addColumn('video_desc', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '视频描述']) - ->addColumn('news_id', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '图文ID']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '状态(0禁用,1启用)']) - ->addColumn('create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '创建人']) - ->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']) - ->addIndex('code', ['name' => 'i15cee0aa7_code']) - ->addIndex('type', ['name' => 'i15cee0aa7_type']) - ->addIndex('time', ['name' => 'i15cee0aa7_time']) - ->addIndex('appid', ['name' => 'i15cee0aa7_appid']) - ->addIndex('status', ['name' => 'i15cee0aa7_status']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class WechatFans - * @table wechat_fans - * @return void - */ - private function _create_wechat_fans() - { - - // 当前数据表 - $table = 'wechat_fans'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-粉丝', - ]) - ->addColumn('appid', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '公众号APPID']) - ->addColumn('unionid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '粉丝unionid']) - ->addColumn('openid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '粉丝openid']) - ->addColumn('tagid_list', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '粉丝标签id']) - ->addColumn('is_black', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '是否为黑名单状态']) - ->addColumn('subscribe', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '关注状态(0未关注,1已关注)']) - ->addColumn('nickname', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '用户昵称']) - ->addColumn('sex', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '用户性别(1男性,2女性,0未知)']) - ->addColumn('country', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户所在国家']) - ->addColumn('province', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户所在省份']) - ->addColumn('city', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户所在城市']) - ->addColumn('language', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户的语言(zh_CN)']) - ->addColumn('headimgurl', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户头像']) - ->addColumn('subscribe_time', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '关注时间']) - ->addColumn('subscribe_at', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '关注时间']) - ->addColumn('remark', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '备注']) - ->addColumn('subscribe_scene', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '扫码关注场景']) - ->addColumn('qr_scene', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '二维码场景值']) - ->addColumn('qr_scene_str', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '二维码场景内容']) - ->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']) - ->addIndex('appid', ['name' => 'ic99bc7baf_appid']) - ->addIndex('openid', ['name' => 'ic99bc7baf_openid']) - ->addIndex('unionid', ['name' => 'ic99bc7baf_unionid']) - ->addIndex('is_black', ['name' => 'ic99bc7baf_is_black']) - ->addIndex('subscribe', ['name' => 'ic99bc7baf_subscribe']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class WechatFansTags - * @table wechat_fans_tags - * @return void - */ - private function _create_wechat_fans_tags() - { - - // 当前数据表 - $table = 'wechat_fans_tags'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-标签', - ]) - ->addColumn('appid', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '公众号APPID']) - ->addColumn('name', 'string', ['limit' => 35, 'default' => '', 'null' => true, 'comment' => '标签名称']) - ->addColumn('count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '粉丝总数']) - ->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建日期']) - ->addIndex('id', ['name' => 'i1e2a8a9a3_id']) - ->addIndex('appid', ['name' => 'i1e2a8a9a3_appid']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class WechatKeys - * @table wechat_keys - * @return void - */ - private function _create_wechat_keys() - { - - // 当前数据表 - $table = 'wechat_keys'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-规则', - ]) - ->addColumn('appid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号APPID']) - ->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '类型(text,image,news)']) - ->addColumn('keys', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '关键字']) - ->addColumn('content', 'text', ['default' => NULL, 'null' => true, 'comment' => '文本内容']) - ->addColumn('image_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '图片链接']) - ->addColumn('voice_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '语音链接']) - ->addColumn('music_title', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '音乐标题']) - ->addColumn('music_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '音乐链接']) - ->addColumn('music_image', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '缩略图片']) - ->addColumn('music_desc', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '音乐描述']) - ->addColumn('video_title', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '视频标题']) - ->addColumn('video_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '视频URL']) - ->addColumn('video_desc', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '视频描述']) - ->addColumn('news_id', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '图文ID']) - ->addColumn('sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序字段']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '状态(0禁用,1启用)']) - ->addColumn('create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '创建人']) - ->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']) - ->addIndex('type', ['name' => 'i23d2c7f47_type']) - ->addIndex('keys', ['name' => 'i23d2c7f47_keys']) - ->addIndex('sort', ['name' => 'i23d2c7f47_sort']) - ->addIndex('appid', ['name' => 'i23d2c7f47_appid']) - ->addIndex('status', ['name' => 'i23d2c7f47_status']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class WechatMedia - * @table wechat_media - * @return void - */ - private function _create_wechat_media() - { - - // 当前数据表 - $table = 'wechat_media'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-素材', - ]) - ->addColumn('md5', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '文件哈希']) - ->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '媒体类型']) - ->addColumn('appid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号ID']) - ->addColumn('media_id', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '永久素材MediaID']) - ->addColumn('local_url', 'string', ['limit' => 300, 'default' => '', 'null' => true, 'comment' => '本地文件链接']) - ->addColumn('media_url', 'string', ['limit' => 300, 'default' => '', 'null' => true, 'comment' => '远程图片链接']) - ->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']) - ->addIndex('md5', ['name' => 'i7f6418618_md5']) - ->addIndex('type', ['name' => 'i7f6418618_type']) - ->addIndex('appid', ['name' => 'i7f6418618_appid']) - ->addIndex('media_id', ['name' => 'i7f6418618_media_id']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class WechatNews - * @table wechat_news - * @return void - */ - private function _create_wechat_news() - { - - // 当前数据表 - $table = 'wechat_news'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-图文', - ]) - ->addColumn('media_id', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '永久素材MediaID']) - ->addColumn('local_url', 'string', ['limit' => 300, 'default' => '', 'null' => true, 'comment' => '永久素材外网URL']) - ->addColumn('article_id', 'string', ['limit' => 60, 'default' => '', 'null' => true, 'comment' => '关联图文ID(用英文逗号做分割)']) - ->addColumn('is_deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删除,1已删除)']) - ->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']) - ->addColumn('create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '创建人']) - ->addIndex('media_id', ['name' => 'ib3c69027e_media_id']) - ->addIndex('article_id', ['name' => 'ib3c69027e_article_id']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class WechatNewsArticle - * @table wechat_news_article - * @return void - */ - private function _create_wechat_news_article() - { - - // 当前数据表 - $table = 'wechat_news_article'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-文章', - ]) - ->addColumn('title', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '素材标题']) - ->addColumn('local_url', 'string', ['limit' => 300, 'default' => '', 'null' => true, 'comment' => '永久素材URL']) - ->addColumn('show_cover_pic', 'integer', ['limit' => 4, 'default' => 0, 'null' => true, 'comment' => '显示封面(0不显示,1显示)']) - ->addColumn('author', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '文章作者']) - ->addColumn('digest', 'string', ['limit' => 300, 'default' => '', 'null' => true, 'comment' => '摘要内容']) - ->addColumn('content', 'text', ['default' => NULL, 'null' => true, 'comment' => '图文内容']) - ->addColumn('content_source_url', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '原文地址']) - ->addColumn('read_num', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '阅读数量']) - ->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class WechatPaymentRecord - * @table wechat_payment_record - * @return void - */ - private function _create_wechat_payment_record() - { - - // 当前数据表 - $table = 'wechat_payment_record'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-支付-行为', - ]) - ->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '交易方式']) - ->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '发起支付号']) - ->addColumn('appid', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '发起APPID']) - ->addColumn('openid', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户OPENID']) - ->addColumn('order_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '原订单编号']) - ->addColumn('order_name', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '原订单标题']) - ->addColumn('order_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '原订单金额']) - ->addColumn('payment_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '支付完成时间']) - ->addColumn('payment_trade', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '平台交易编号']) - ->addColumn('payment_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '支付状态(0未付,1已付,2取消)']) - ->addColumn('payment_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '实际到账金额']) - ->addColumn('payment_bank', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '支付银行类型']) - ->addColumn('payment_notify', 'text', ['default' => NULL, 'null' => true, 'comment' => '支付结果通知']) - ->addColumn('payment_remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '支付状态备注']) - ->addColumn('refund_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '退款状态(0未退,1已退)']) - ->addColumn('refund_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退款金额']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('type', ['name' => 'i43926536a_type']) - ->addIndex('code', ['name' => 'i43926536a_code']) - ->addIndex('appid', ['name' => 'i43926536a_appid']) - ->addIndex('openid', ['name' => 'i43926536a_openid']) - ->addIndex('order_code', ['name' => 'i43926536a_order_code']) - ->addIndex('create_time', ['name' => 'i43926536a_create_time']) - ->addIndex('payment_trade', ['name' => 'i43926536a_payment_trade']) - ->addIndex('payment_status', ['name' => 'i43926536a_payment_status']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class WechatPaymentRefund - * @table wechat_payment_refund - * @return void - */ - private function _create_wechat_payment_refund() - { - - // 当前数据表 - $table = 'wechat_payment_refund'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-支付-退款', - ]) - ->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '发起支付号']) - ->addColumn('record_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '子支付编号']) - ->addColumn('refund_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '支付完成时间']) - ->addColumn('refund_trade', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '平台交易编号']) - ->addColumn('refund_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '支付状态(0未付,1已付,2取消)']) - ->addColumn('refund_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '实际到账金额']) - ->addColumn('refund_account', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '退款目标账号']) - ->addColumn('refund_scode', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '退款状态码']) - ->addColumn('refund_remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '支付状态备注']) - ->addColumn('refund_notify', 'text', ['default' => NULL, 'null' => true, 'comment' => '退款交易通知']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('code', ['name' => 'i5a815074f_code']) - ->addIndex('record_code', ['name' => 'i5a815074f_record_code']) - ->addIndex('create_time', ['name' => 'i5a815074f_create_time']) - ->addIndex('refund_trade', ['name' => 'i5a815074f_refund_trade']) - ->addIndex('refund_status', ['name' => 'i5a815074f_refund_status']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } -} \ No newline at end of file diff --git a/plugin/think-plugs-wechat/stc/database/20221013045830_install_wechat_data.php b/plugin/think-plugs-wechat/stc/database/20221013045830_install_wechat_data.php deleted file mode 100644 index 43c999b0b..000000000 --- a/plugin/think-plugs-wechat/stc/database/20221013045830_install_wechat_data.php +++ /dev/null @@ -1,54 +0,0 @@ - -// +---------------------------------------------------------------------- -// | 官方网站: https://thinkadmin.top -// +---------------------------------------------------------------------- -// | 开源协议 ( https://mit-license.org ) -// | 免责声明 ( https://thinkadmin.top/disclaimer ) -// +---------------------------------------------------------------------- -// | gitee 代码仓库:https://gitee.com/zoujingli/think-plugs-wechat -// | github 代码仓库:https://github.com/zoujingli/think-plugs-wechat -// +---------------------------------------------------------------------- - -use app\wechat\Service; -use think\admin\extend\PhinxExtend; -use think\migration\Migrator; - -@set_time_limit(0); -@ini_set('memory_limit', -1); - -/** - * 微信初始化 - */ -class InstallWechatData extends Migrator -{ - /** - * 初始化数据 - * @return void - */ - public function change() - { - $this->insertMenu(); - } - - /** - * 初始化菜单 - */ - private function insertMenu() - { - // 写入微信菜单 - PhinxExtend::write2menu([ - [ - 'name' => '微信管理', - 'sort' => '200', - 'subs' => Service::menu(), - ], - ], [ - 'url|node' => 'wechat/config/options' - ]); - } -} diff --git a/plugin/think-plugs-wechat/stc/database/20221013045832_install_wechat20230628.php b/plugin/think-plugs-wechat/stc/database/20221013045832_install_wechat20230628.php deleted file mode 100644 index 97f38a962..000000000 --- a/plugin/think-plugs-wechat/stc/database/20221013045832_install_wechat20230628.php +++ /dev/null @@ -1,129 +0,0 @@ - -// +---------------------------------------------------------------------- -// | 官方网站: https://thinkadmin.top -// +---------------------------------------------------------------------- -// | 开源协议 ( https://mit-license.org ) -// | 免责声明 ( https://thinkadmin.top/disclaimer ) -// +---------------------------------------------------------------------- -// | gitee 代码仓库:https://gitee.com/zoujingli/think-plugs-wechat -// | github 代码仓库:https://github.com/zoujingli/think-plugs-wechat -// +---------------------------------------------------------------------- - -use think\migration\Migrator; - -@set_time_limit(0); -@ini_set('memory_limit', -1); - -/** - * 微信模块数据表 - */ -class InstallWechat20230628 extends Migrator -{ - - /** - * 创建数据库 - */ - public function change() - { - $this->_create_wechat_payment_record(); - $this->_create_wechat_payment_refund(); - } - - /** - * 创建数据对象 - * @class WechatPaymentRecord - * @table wechat_payment_record - * @return void - */ - private function _create_wechat_payment_record() - { - - // 当前数据表 - $table = 'wechat_payment_record'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-支付-行为', - ]) - ->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '交易方式']) - ->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '发起支付号']) - ->addColumn('appid', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '发起APPID']) - ->addColumn('openid', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户OPENID']) - ->addColumn('order_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '原订单编号']) - ->addColumn('order_name', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '原订单标题']) - ->addColumn('order_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '原订单金额']) - ->addColumn('payment_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '支付完成时间']) - ->addColumn('payment_trade', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '平台交易编号']) - ->addColumn('payment_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '支付状态(0未付,1已付,2取消)']) - ->addColumn('payment_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '实际到账金额']) - ->addColumn('payment_bank', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '支付银行类型']) - ->addColumn('payment_notify', 'text', ['default' => NULL, 'null' => true, 'comment' => '支付结果通知']) - ->addColumn('payment_remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '支付状态备注']) - ->addColumn('refund_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '退款状态(0未退,1已退)']) - ->addColumn('refund_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退款金额']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('type', ['name' => 'i43926536a_type']) - ->addIndex('code', ['name' => 'i43926536a_code']) - ->addIndex('appid', ['name' => 'i43926536a_appid']) - ->addIndex('openid', ['name' => 'i43926536a_openid']) - ->addIndex('order_code', ['name' => 'i43926536a_order_code']) - ->addIndex('create_time', ['name' => 'i43926536a_create_time']) - ->addIndex('payment_trade', ['name' => 'i43926536a_payment_trade']) - ->addIndex('payment_status', ['name' => 'i43926536a_payment_status']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class WechatPaymentRefund - * @table wechat_payment_refund - * @return void - */ - private function _create_wechat_payment_refund() - { - - // 当前数据表 - $table = 'wechat_payment_refund'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-支付-退款', - ]) - ->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '发起支付号']) - ->addColumn('record_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '子支付编号']) - ->addColumn('refund_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '支付完成时间']) - ->addColumn('refund_trade', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '平台交易编号']) - ->addColumn('refund_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '支付状态(0未付,1已付,2取消)']) - ->addColumn('refund_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '实际到账金额']) - ->addColumn('refund_account', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '退款目标账号']) - ->addColumn('refund_scode', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '退款状态码']) - ->addColumn('refund_remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '支付状态备注']) - ->addColumn('refund_notify', 'text', ['default' => NULL, 'null' => true, 'comment' => '退款交易通知']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('code', ['name' => 'i5a815074f_code']) - ->addIndex('record_code', ['name' => 'i5a815074f_record_code']) - ->addIndex('create_time', ['name' => 'i5a815074f_create_time']) - ->addIndex('refund_trade', ['name' => 'i5a815074f_refund_trade']) - ->addIndex('refund_status', ['name' => 'i5a815074f_refund_status']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } -} \ No newline at end of file diff --git a/database/migrations/20009999999993_install_wechat_table.php b/plugin/think-plugs-wechat/stc/database/20241016000006_install_wechat20241016.php similarity index 79% rename from database/migrations/20009999999993_install_wechat_table.php rename to plugin/think-plugs-wechat/stc/database/20241016000006_install_wechat20241016.php index 56de0c59c..66cbf2409 100644 --- a/database/migrations/20009999999993_install_wechat_table.php +++ b/plugin/think-plugs-wechat/stc/database/20241016000006_install_wechat20241016.php @@ -6,15 +6,23 @@ use think\migration\Migrator; @set_time_limit(0); @ini_set('memory_limit', -1); -class InstallWechatTable extends Migrator +class InstallWechat20241016 extends Migrator { + /** + * 获取脚本名称 + * @return string + */ + public function getName(): string + { + return 'WechatPlugin'; + } + /** * 创建数据库 */ public function change() { - $this->_create_wechat_auth(); $this->_create_wechat_auto(); $this->_create_wechat_fans(); $this->_create_wechat_fans_tags(); @@ -26,46 +34,6 @@ class InstallWechatTable extends Migrator $this->_create_wechat_payment_refund(); } - /** - * 创建数据对象 - * @class WechatAuth - * @table wechat_auth - * @return void - */ - private function _create_wechat_auth() - { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('wechat_auth', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-授权', - ]), [ - ['authorizer_appid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '微信APPID']], - ['authorizer_access_token', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '授权Token']], - ['authorizer_refresh_token', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '刷新Token']], - ['expires_in', 'integer', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => 'Token时限']], - ['user_alias', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号别名']], - ['user_name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '众众号原账号']], - ['user_nickname', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号昵称']], - ['user_headimg', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '公众号头像']], - ['user_signature', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '公众号描述']], - ['user_company', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '公众号公司']], - ['func_info', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号集权']], - ['service_type', 'string', ['limit' => 10, 'default' => '', 'null' => true, 'comment' => '公众号类型']], - ['service_verify', 'string', ['limit' => 10, 'default' => '', 'null' => true, 'comment' => '公众号认证']], - ['qrcode_url', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '公众号二维码']], - ['businessinfo', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '业务序列内容']], - ['miniprograminfo', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '小程序序列内容']], - ['total', 'integer', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '统计调用次数']], - ['appkey', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '应用接口KEY']], - ['appuri', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '应用接口URI']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '授权状态(0已取消,1已授权)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删除,1已删除)']], - ['auth_time', 'integer', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '授权时间']], - ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], - ], [ - 'status', 'deleted', 'authorizer_appid', - ]); - } - /** * 创建数据对象 * @class WechatAuto @@ -74,10 +42,12 @@ class InstallWechatTable extends Migrator */ private function _create_wechat_auto() { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('wechat_auto', [ + // 创建数据表对象 + $table = $this->table('wechat_auto', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-回复', - ]), [ + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ ['type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '类型(text,image,news)']], ['time', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '延迟时间']], ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '消息编号']], @@ -98,7 +68,7 @@ class InstallWechatTable extends Migrator ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], ], [ 'code', 'type', 'time', 'appid', 'status', - ]); + ], true); } /** @@ -109,10 +79,12 @@ class InstallWechatTable extends Migrator */ private function _create_wechat_fans() { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('wechat_fans', [ + // 创建数据表对象 + $table = $this->table('wechat_fans', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-粉丝', - ]), [ + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ ['appid', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '公众号APPID']], ['unionid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '粉丝unionid']], ['openid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '粉丝openid']], @@ -135,7 +107,7 @@ class InstallWechatTable extends Migrator ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], ], [ 'appid', 'openid', 'unionid', 'is_black', 'subscribe', - ]); + ], true); } /** @@ -146,17 +118,19 @@ class InstallWechatTable extends Migrator */ private function _create_wechat_fans_tags() { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('wechat_fans_tags', [ + // 创建数据表对象 + $table = $this->table('wechat_fans_tags', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-标签', - ]), [ + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ ['appid', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '公众号APPID']], ['name', 'string', ['limit' => 35, 'default' => '', 'null' => true, 'comment' => '标签名称']], ['count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '粉丝总数']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建日期']], ], [ 'id', 'appid', - ]); + ], true); } /** @@ -167,10 +141,12 @@ class InstallWechatTable extends Migrator */ private function _create_wechat_keys() { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('wechat_keys', [ + // 创建数据表对象 + $table = $this->table('wechat_keys', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-规则', - ]), [ + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ ['appid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号APPID']], ['type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '类型(text,image,news)']], ['keys', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '关键字']], @@ -191,7 +167,7 @@ class InstallWechatTable extends Migrator ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], ], [ 'type', 'keys', 'sort', 'appid', 'status', - ]); + ], true); } /** @@ -202,10 +178,12 @@ class InstallWechatTable extends Migrator */ private function _create_wechat_media() { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('wechat_media', [ + // 创建数据表对象 + $table = $this->table('wechat_media', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-素材', - ]), [ + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ ['md5', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '文件哈希']], ['type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '媒体类型']], ['appid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号ID']], @@ -215,7 +193,7 @@ class InstallWechatTable extends Migrator ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], ], [ 'md5', 'type', 'appid', 'media_id', - ]); + ], true); } /** @@ -226,10 +204,12 @@ class InstallWechatTable extends Migrator */ private function _create_wechat_news() { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('wechat_news', [ + // 创建数据表对象 + $table = $this->table('wechat_news', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-图文', - ]), [ + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ ['media_id', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '永久素材MediaID']], ['local_url', 'string', ['limit' => 300, 'default' => '', 'null' => true, 'comment' => '永久素材外网URL']], ['article_id', 'string', ['limit' => 60, 'default' => '', 'null' => true, 'comment' => '关联图文ID(用英文逗号做分割)']], @@ -238,7 +218,7 @@ class InstallWechatTable extends Migrator ['create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '创建人']], ], [ 'media_id', 'article_id', - ]); + ], true); } /** @@ -249,10 +229,12 @@ class InstallWechatTable extends Migrator */ private function _create_wechat_news_article() { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('wechat_news_article', [ + // 创建数据表对象 + $table = $this->table('wechat_news_article', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-文章', - ]), [ + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ ['title', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '素材标题']], ['local_url', 'string', ['limit' => 300, 'default' => '', 'null' => true, 'comment' => '永久素材URL']], ['show_cover_pic', 'integer', ['limit' => 4, 'default' => 0, 'null' => true, 'comment' => '显示封面(0不显示,1显示)']], @@ -262,9 +244,7 @@ class InstallWechatTable extends Migrator ['content_source_url', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '原文地址']], ['read_num', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '阅读数量']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], - ], [ - - ]); + ], [], true); } /** @@ -275,10 +255,12 @@ class InstallWechatTable extends Migrator */ private function _create_wechat_payment_record() { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('wechat_payment_record', [ + // 创建数据表对象 + $table = $this->table('wechat_payment_record', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-支付-行为', - ]), [ + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ ['type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '交易方式']], ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '发起支付号']], ['appid', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '发起APPID']], @@ -299,7 +281,7 @@ class InstallWechatTable extends Migrator ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], ], [ 'type', 'code', 'appid', 'openid', 'order_code', 'create_time', 'payment_trade', 'payment_status', - ]); + ], true); } /** @@ -310,10 +292,12 @@ class InstallWechatTable extends Migrator */ private function _create_wechat_payment_refund() { - // 创建更新数据表 - PhinxExtend::upgrade($this->table('wechat_payment_refund', [ + // 创建数据表对象 + $table = $this->table('wechat_payment_refund', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-支付-退款', - ]), [ + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '发起支付号']], ['record_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '子支付编号']], ['refund_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '支付完成时间']], @@ -328,7 +312,6 @@ class InstallWechatTable extends Migrator ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], ], [ 'code', 'record_code', 'create_time', 'refund_trade', 'refund_status', - ]); + ], true); } - } diff --git a/plugin/think-plugs-wemall/stc/database/20230404000001_install_wemall.php b/plugin/think-plugs-wemall/stc/database/20230404000001_install_wemall.php deleted file mode 100644 index 280b9571c..000000000 --- a/plugin/think-plugs-wemall/stc/database/20230404000001_install_wemall.php +++ /dev/null @@ -1,1245 +0,0 @@ -_create_plugin_wemall_config_agent(); - $this->_create_plugin_wemall_config_coupon(); - $this->_create_plugin_wemall_config_discount(); - $this->_create_plugin_wemall_config_level(); - $this->_create_plugin_wemall_config_notify(); - $this->_create_plugin_wemall_config_poster(); - $this->_create_plugin_wemall_config_rebate(); - $this->_create_plugin_wemall_express_company(); - $this->_create_plugin_wemall_express_template(); - $this->_create_plugin_wemall_goods(); - $this->_create_plugin_wemall_goods_cate(); - $this->_create_plugin_wemall_goods_item(); - $this->_create_plugin_wemall_goods_mark(); - $this->_create_plugin_wemall_goods_stock(); - $this->_create_plugin_wemall_help_feedback(); - $this->_create_plugin_wemall_help_problem(); - $this->_create_plugin_wemall_help_question(); - $this->_create_plugin_wemall_help_question_x(); - $this->_create_plugin_wemall_order(); - $this->_create_plugin_wemall_order_cart(); - $this->_create_plugin_wemall_order_item(); - $this->_create_plugin_wemall_order_refund(); - $this->_create_plugin_wemall_order_sender(); - $this->_create_plugin_wemall_user_action_collect(); - $this->_create_plugin_wemall_user_action_comment(); - $this->_create_plugin_wemall_user_action_history(); - $this->_create_plugin_wemall_user_action_search(); - $this->_create_plugin_wemall_user_checkin(); - $this->_create_plugin_wemall_user_coupon(); - $this->_create_plugin_wemall_user_create(); - $this->_create_plugin_wemall_user_rebate(); - $this->_create_plugin_wemall_user_recharge(); - $this->_create_plugin_wemall_user_relation(); - $this->_create_plugin_wemall_user_transfer(); - } - - /** - * 创建数据对象 - * @class PluginWemallConfigAgent - * @table plugin_wemall_config_agent - * @return void - */ - private function _create_plugin_wemall_config_agent() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_config_agent', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-配置-等级', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '级别名称']], - ['cover', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '等级图标']], - ['cardbg', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '等级卡片']], - ['number', 'integer', ['limit' => 2, 'default' => 0, 'null' => true, 'comment' => '级别序号']], - ['upgrade_type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '升级规则(0单个,1同时)']], - ['extra', 'text', ['default' => NULL, 'null' => true, 'comment' => '升级规则']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '级别描述']], - ['utime', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '更新时间']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '等级状态(1使用,0禁用)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'utime', 'status', 'number', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallConfigCoupon - * @table plugin_wemall_config_coupon - * @return void - */ - private function _create_plugin_wemall_config_coupon() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_config_coupon', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-配置-卡券', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['type', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '类型(0通用券,1商品券)']], - ['name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '优惠名称']], - ['cover', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '封面图标']], - ['extra', 'text', ['default' => NULL, 'null' => true, 'comment' => '扩展数据']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '内容描述']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '系统备注']], - ['amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '抵扣金额']], - ['limit_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '金额门槛(0不限制)']], - ['limit_levels', 'string', ['limit' => 180, 'default' => '-', 'null' => true, 'comment' => '授权等级']], - ['limit_times', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '限领数量(0不限制)']], - ['expire_days', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '有效天数']], - ['total_stock', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '库存数量']], - ['total_sales', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '发放数量']], - ['total_used', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '使用数量']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '卡券状态(0禁用,1使用)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(1已删,0未删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'sort', 'type', 'status', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallConfigDiscount - * @table plugin_wemall_config_discount - * @return void - */ - private function _create_plugin_wemall_config_discount() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_config_discount', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-配置-折扣', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '方案名称']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '方案描述']], - ['items', 'text', ['default' => NULL, 'null' => true, 'comment' => '方案规则']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '方案状态(0禁用,1使用)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(1已删,0未删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'sort', 'status', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallConfigLevel - * @table plugin_wemall_config_level - * @return void - */ - private function _create_plugin_wemall_config_level() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_config_level', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-配置-等级', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '级别名称']], - ['cover', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '等级图标']], - ['cardbg', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '等级卡片']], - ['number', 'integer', ['limit' => 2, 'default' => 0, 'null' => true, 'comment' => '级别序号']], - ['upgrade_type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '升级规则(0单个,1同时)']], - ['upgrade_team', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '团队人数统计(0不计,1累计)']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户级别描述']], - ['extra', 'text', ['default' => NULL, 'null' => true, 'comment' => '配置规则']], - ['utime', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '更新时间']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '等级状态(1使用,0禁用)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'utime', 'status', 'number', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallConfigNotify - * @table plugin_wemall_config_notify - * @return void - */ - private function _create_plugin_wemall_config_notify() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_config_notify', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-配置-通知', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['code', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '通知编号']], - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '通知标题']], - ['cover', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '通知图片']], - ['levels', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户等级']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '通知内容']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '通知描述']], - ['num_read', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '阅读次数']], - ['tips', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => 'TIPS显示']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '激活状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(1已删,0未删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'sort', 'name', 'tips', 'status', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallConfigPoster - * @table plugin_wemall_config_poster - * @return void - */ - private function _create_plugin_wemall_config_poster() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_config_poster', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-配置-海报', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['code', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '推广编号']], - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '推广标题']], - ['levels', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户等级']], - ['devices', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '接口通道']], - ['image', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '推广图片']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '二维位置']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '推广描述']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '激活状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(1已删,0未删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'sort', 'name', 'status', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallConfigRebate - * @table plugin_wemall_config_rebate - * @return void - */ - private function _create_plugin_wemall_config_rebate() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_config_rebate', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-配置-返利', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['type', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '奖励类型']], - ['code', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '配置编号']], - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '配置名称']], - ['path', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '等级关系']], - ['stype', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '结算类型(0支付结算,1收货结算)']], - ['p0_level', 'biginteger', ['limit' => 20, 'default' => -1, 'null' => true, 'comment' => '会员等级']], - ['p1_level', 'biginteger', ['limit' => 20, 'default' => -1, 'null' => true, 'comment' => '上1级等级']], - ['p2_level', 'biginteger', ['limit' => 20, 'default' => -1, 'null' => true, 'comment' => '上2级等级']], - ['p3_level', 'biginteger', ['limit' => 20, 'default' => -1, 'null' => true, 'comment' => '上3级等级']], - ['p0_reward_type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '会员计算类型(0固定金额,1交易比例,2利润比例)']], - ['p0_reward_number', 'decimal', ['precision' => 20, 'scale' => 6, 'default' => '0.000000', 'null' => true, 'comment' => '会员计算系数']], - ['p1_reward_type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '上1级计算类型(0固定金额,1交易比例,2利润比例)']], - ['p1_reward_number', 'decimal', ['precision' => 20, 'scale' => 6, 'default' => '0.000000', 'null' => true, 'comment' => '上1级计算系数']], - ['p2_reward_type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '上2级计算类型(0固定金额,1交易比例,2利润比例)']], - ['p2_reward_number', 'decimal', ['precision' => 20, 'scale' => 6, 'default' => '0.000000', 'null' => true, 'comment' => '上2级计算系数']], - ['p3_reward_type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '上3级计算类型(0固定金额,1交易比例,2利润比例)']], - ['p3_reward_number', 'decimal', ['precision' => 20, 'scale' => 6, 'default' => '0.000000', 'null' => true, 'comment' => '上3级计算系数']], - ['remark', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '配置描述']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '激活状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(1已删,0未删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'sort', 'name', 'type', 'stype', 'status', 'deleted', 'p1_level', 'p2_level', 'p3_level', 'p0_level', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallExpressCompany - * @table plugin_wemall_express_company - * @return void - */ - private function _create_plugin_wemall_express_company() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_express_company', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-快递-公司', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['code', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '公司代码']], - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '公司名称']], - ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '公司描述']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '激活状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(1已删,0未删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'sort', 'name', 'status', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallExpressTemplate - * @table plugin_wemall_express_template - * @return void - */ - private function _create_plugin_wemall_express_template() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_express_template', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-快递-模板', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '模板编号']], - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '模板名称']], - ['normal', 'text', ['default' => NULL, 'null' => true, 'comment' => '默认规则']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '模板规则']], - ['company', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '快递公司']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '激活状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(1已删,0未删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'sort', 'name', 'status', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallGoods - * @table plugin_wemall_goods - * @return void - */ - private function _create_plugin_wemall_goods() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_goods', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-商品-内容', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['ssid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属商家']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品编号']], - ['name', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '商品名称']], - ['marks', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '商品标签']], - ['cates', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '分类编号']], - ['cover', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '商品封面']], - ['slider', 'text', ['default' => NULL, 'null' => true, 'comment' => '轮播图片']], - ['specs', 'text', ['default' => NULL, 'null' => true, 'comment' => '商品规格(JSON)']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '商品详情']], - ['remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '商品描述']], - ['stock_total', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '商品库存统计']], - ['stock_sales', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '商品销售统计']], - ['stock_virtual', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '商品虚拟销量']], - ['price_selling', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '最低销售价格']], - ['price_market', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '最低市场价格']], - ['allow_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '最大积分兑换']], - ['allow_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '最大余额支付']], - ['rebate_type', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '参与返利(0无需返利,1需要返利)']], - ['delivery_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物流运费模板']], - ['limit_lowvip', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '限制购买等级(0不限制,其他限制)']], - ['limit_maxnum', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '最大购买数量(0不限制,其他限制)']], - ['level_agent', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '推广权益(0无,1有)']], - ['level_upgrade', 'biginteger', ['limit' => 20, 'default' => -1, 'null' => true, 'comment' => '购买升级等级(-1非入会,0不升级,其他升级)']], - ['discount_id', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '折扣方案编号(0无折扣,其他折扣)']], - ['num_read', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '访问阅读统计']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '列表排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '商品状态(1使用,0禁用)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'sort', 'ssid', 'status', 'deleted', 'rebate_type', 'discount_id', 'create_time', 'level_agent', 'level_upgrade', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallGoodsCate - * @table plugin_wemall_goods_cate - * @return void - */ - private function _create_plugin_wemall_goods_cate() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_goods_cate', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-商品-分类', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['pid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上级分类']], - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '分类名称']], - ['cover', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '分类图标']], - ['remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '分类描述']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '使用状态']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'pid', 'sort', 'status', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallGoodsItem - * @table plugin_wemall_goods_item - * @return void - */ - private function _create_plugin_wemall_goods_item() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_goods_item', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-商品-规格', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['gsku', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品SKU']], - ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品哈希']], - ['gcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品编号']], - ['gspec', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '商品规格']], - ['gunit', 'string', ['limit' => 10, 'default' => '件', 'null' => true, 'comment' => '商品单位']], - ['gimage', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '商品图片']], - ['stock_sales', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '销售数量']], - ['stock_total', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '商品库存']], - ['price_cost', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '进货成本']], - ['price_selling', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '销售价格']], - ['price_market', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '市场价格']], - ['allow_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '兑换积分']], - ['allow_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '余额支付']], - ['reward_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '奖励余额']], - ['reward_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '奖励积分']], - ['number_virtual', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟销量']], - ['number_express', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '计件系数']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '商品状态']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'gcode', 'gspec', 'ghash', 'status', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallGoodsMark - * @table plugin_wemall_goods_mark - * @return void - */ - private function _create_plugin_wemall_goods_mark() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_goods_mark', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-商品-标签', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '标签名称']], - ['remark', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '标签描述']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '标签状态(1使用,0禁用)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'sort', 'status', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallGoodsStock - * @table plugin_wemall_goods_stock - * @return void - */ - private function _create_plugin_wemall_goods_stock() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_goods_stock', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-商品-库存', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['batch_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作批量']], - ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品哈希']], - ['gcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品编号']], - ['gspec', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '商品规格']], - ['gstock', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '入库数量']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '数据状态(1使用,0禁用)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'ghash', 'gcode', 'status', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallHelpFeedback - * @table plugin_wemall_help_feedback - * @return void - */ - private function _create_plugin_wemall_help_feedback() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_help_feedback', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-意见-反馈', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '反馈用户']], - ['phone', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '联系电话']], - ['images', 'text', ['default' => NULL, 'null' => true, 'comment' => '反馈图片']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '反馈内容']], - ['reply', 'text', ['default' => NULL, 'null' => true, 'comment' => '回复内容']], - ['reply_st', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '回复状态']], - ['reply_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '回复用户']], - ['reply_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '回复时间']], - ['sync', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '同步至常见问题状态(1已同步,0未同步)']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '展示状态(1使用,0禁用)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'sort', 'unid', 'status', 'deleted', 'reply_st', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallHelpProblem - * @table plugin_wemall_help_problem - * @return void - */ - private function _create_plugin_wemall_help_problem() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_help_problem', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-常见-问题', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['fid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => false, 'comment' => '来自反馈']], - ['name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '问题标题']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '问题内容']], - ['num_er', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '未解决数']], - ['num_ok', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '已解决数']], - ['num_read', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '阅读次数']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '展示状态(1使用,0禁用)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'sort', 'status', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallHelpQuestion - * @table plugin_wemall_help_question - * @return void - */ - private function _create_plugin_wemall_help_question() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_help_question', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-问答-内容', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '提问用户']], - ['name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '工单标题']], - ['phone', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '联系电话']], - ['order_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '关联订单']], - ['images', 'text', ['default' => NULL, 'null' => true, 'comment' => '工单图片']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '工单描述']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '工单状态(0取消,1新工单,2后台回复,3前台回复,4已完结)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'sort', 'name', 'unid', 'phone', 'status', 'deleted', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallHelpQuestionX - * @table plugin_wemall_help_question_x - * @return void - */ - private function _create_plugin_wemall_help_question_x() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_help_question_x', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-问答-评论', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['ccid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '目标编号']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '文本内容']], - ['images', 'text', ['default' => NULL, 'null' => true, 'comment' => '图片内容']], - ['reply_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '后台用户']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1待审核,2已审核)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'ccid', 'unid', 'status', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallOrder - * @table plugin_wemall_order - * @return void - */ - private function _create_plugin_wemall_order() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_order', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-订单-内容', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['ssid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属商家']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['puid1', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上1级代理']], - ['puid2', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上2级代理']], - ['puid3', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上3级代理']], - ['order_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '订单单号']], - ['order_ps', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '订单备注']], - ['amount_cost', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品成本']], - ['amount_real', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '实际金额']], - ['amount_total', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '订单金额']], - ['amount_goods', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品金额']], - ['amount_profit', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '销售利润']], - ['amount_reduct', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '随机减免']], - ['amount_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '余额支付']], - ['amount_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '积分抵扣']], - ['amount_payment', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '金额支付']], - ['amount_express', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '快递费用']], - ['amount_discount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '折扣后金额']], - ['coupon_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '优惠券编号']], - ['coupon_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '优惠券金额']], - ['allow_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '最大余额支付']], - ['allow_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '最大积分抵扣']], - ['ratio_integral', 'decimal', ['precision' => 20, 'scale' => 6, 'default' => '0.000000', 'null' => true, 'comment' => '积分兑换比例']], - ['number_goods', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '商品数量']], - ['number_express', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '快递计数']], - ['level_agent', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '升级代理等级']], - ['level_member', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '升级会员等级']], - ['rebate_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '返利金额']], - ['reward_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '奖励余额']], - ['reward_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '奖励积分']], - ['payment_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '支付时间']], - ['payment_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '支付状态(0未支付,1有支付)']], - ['payment_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '实际支付']], - ['delivery_type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '物流类型(0无配送,1需配送)']], - ['cancel_time', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '取消时间']], - ['cancel_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '取消状态']], - ['cancel_remark', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '取消描述']], - ['deleted_time', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '删除时间']], - ['deleted_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['deleted_remark', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '删除描述']], - ['confirm_time', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '签收时间']], - ['confirm_remark', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '签收描述']], - ['refund_code', 'string', ['limit' => 20, 'default' => NULL, 'null' => true, 'comment' => '售后单号']], - ['refund_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '售后状态(0未售后,1预订单,2待审核,3待退货,4已退货,5待退款,6已退款,7已完成)']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '流程状态(0已取消,1预订单,2待支付,3待审核,4待发货,5已发货,6已收货,7已评论)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'ssid', 'puid1', 'puid2', 'puid3', 'status', 'order_no', 'create_time', 'refund_code', 'coupon_code', 'delivery_type', 'cancel_status', 'refund_status', 'deleted_status', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallOrderCart - * @table plugin_wemall_order_cart - * @return void - */ - private function _create_plugin_wemall_order_cart() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_order_cart', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-订单-购物车', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['ssid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属商家']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '规格哈希']], - ['gcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品编号']], - ['gspec', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '商品规格']], - ['number', 'biginteger', ['limit' => 20, 'default' => 1, 'null' => true, 'comment' => '商品数量']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'ssid', 'gcode', 'gspec', 'ghash', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallOrderItem - * @table plugin_wemall_order_item - * @return void - */ - private function _create_plugin_wemall_order_item() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_order_item', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-订单-商品', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['ssid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属商家']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['gsku', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品SKU']], - ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品哈希']], - ['gcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品编号']], - ['gspec', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '商品规格']], - ['gunit', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '商品单凭']], - ['gname', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '商品名称']], - ['gcover', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '商品封面']], - ['order_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '订单单号']], - ['stock_sales', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '包含商品数量']], - ['amount_cost', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品成本单价']], - ['price_market', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品市场单价']], - ['price_selling', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品销售单价']], - ['total_price_cost', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品成本总价']], - ['total_price_market', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品市场总价']], - ['total_price_selling', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品销售总价']], - ['total_allow_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '最大余额支付']], - ['total_allow_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '最大兑换总分']], - ['total_reward_balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品奖励余额']], - ['total_reward_integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品奖励积分']], - ['level_code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户等级序号']], - ['level_name', 'string', ['limit' => 30, 'default' => '', 'null' => true, 'comment' => '用户等级名称']], - ['level_agent', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '推广权益(0无,1有)']], - ['level_upgrade', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '购买升级等级(-1非入会,0不升级,其他升级)']], - ['rebate_type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '参与返利状态(0不返,1返利)']], - ['rebate_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '参与返利金额']], - ['delivery_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '快递邮费模板']], - ['delivery_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '快递计费基数']], - ['discount_id', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '优惠方案编号']], - ['discount_rate', 'decimal', ['precision' => 20, 'scale' => 6, 'default' => '100.000000', 'null' => true, 'comment' => '销售价格折扣']], - ['discount_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '商品优惠金额']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '商品状态(1使用,0禁用)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'gsku', 'ssid', 'gcode', 'gspec', 'ghash', 'status', 'deleted', 'order_no', 'rebate_type', 'discount_id', 'level_agent', 'delivery_code', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallOrderRefund - * @table plugin_wemall_order_refund - * @return void - */ - private function _create_plugin_wemall_order_refund() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_order_refund', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-订单-售后', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['ssid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属商家']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['type', 'biginteger', ['limit' => 20, 'default' => 1, 'null' => true, 'comment' => '申请类型(1退货退款,2仅退款)']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '售后单号']], - ['order_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '订单单号']], - ['reason', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '退款原因']], - ['number', 'biginteger', ['limit' => 20, 'default' => 1, 'null' => true, 'comment' => '退货数量']], - ['amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '申请金额']], - ['payment_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退款支付']], - ['balance_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退款余额']], - ['integral_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退款积分']], - ['payment_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '退款单号']], - ['balance_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '退回单号']], - ['integral_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '退回单号']], - ['phone', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '联系电话']], - ['images', 'text', ['default' => NULL, 'null' => true, 'comment' => '申请图片']], - ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '申请说明']], - ['remark', 'string', ['limit' => 180, 'default' => NULL, 'null' => true, 'comment' => '操作描述']], - ['express_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '快递单号']], - ['express_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '快递公司']], - ['express_name', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '快递名称']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '流程状态(0已取消,1预订单,2待审核,3待退货,4已退货,5待退款,6已退款,7已完成)']], - ['status_at', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '状态变更时间']], - ['status_ds', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '状态变更描述']], - ['admin_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '后台用户']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'type', 'code', 'ssid', 'status', 'order_no', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallOrderSender - * @table plugin_wemall_order_sender - * @return void - */ - private function _create_plugin_wemall_order_sender() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_order_sender', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-订单-配送', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['ssid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属商家']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '商城用户编号']], - ['order_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商城订单单号']], - ['address_id', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '配送地址编号']], - ['user_idcode', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '收货人证件号码']], - ['user_idimg1', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '收货人证件正面']], - ['user_idimg2', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '收货人证件反面']], - ['user_name', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '收货人联系名称']], - ['user_phone', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '收货人联系手机']], - ['region_prov', 'string', ['limit' => 30, 'default' => '', 'null' => true, 'comment' => '配送地址的省份']], - ['region_city', 'string', ['limit' => 30, 'default' => '', 'null' => true, 'comment' => '配送地址的城市']], - ['region_area', 'string', ['limit' => 30, 'default' => '', 'null' => true, 'comment' => '配送地址的区域']], - ['region_addr', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '配送的详细地址']], - ['delivery_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '配送模板编号']], - ['delivery_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '快递计费基数']], - ['delivery_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '配送计算金额']], - ['delivery_remark', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '配送计算描述']], - ['express_time', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '快递发送时间']], - ['express_code', 'string', ['limit' => 80, 'default' => '', 'null' => true, 'comment' => '快递运送单号']], - ['express_remark', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '快递发送备注']], - ['company_code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '快递公司编码']], - ['company_name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '快递公司名称']], - ['extra', 'text', ['default' => NULL, 'null' => true, 'comment' => '原始数据']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '发货状态(1待发货,2已发货,3已收货)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'ssid', 'status', 'deleted', 'order_no', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserActionCollect - * @table plugin_wemall_user_action_collect - * @return void - */ - private function _create_plugin_wemall_user_action_collect() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_user_action_collect', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-收藏', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['gcode', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品编号']], - ['times', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '记录次数']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'sort', 'gcode', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserActionComment - * @table plugin_wemall_user_action_comment - * @return void - */ - private function _create_plugin_wemall_user_action_comment() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_user_action_comment', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-评论', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['ssid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属商家']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['code', 'string', ['limit' => 32, 'default' => NULL, 'null' => true, 'comment' => '评论编号']], - ['gcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品编号']], - ['ghash', 'string', ['limit' => 32, 'default' => NULL, 'null' => true, 'comment' => '商品哈希']], - ['order_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '订单单号']], - ['rate', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '5.00', 'null' => true, 'comment' => '评论分数']], - ['content', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '评论内容']], - ['images', 'text', ['default' => NULL, 'null' => true, 'comment' => '评论图片']], - ['status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '评论状态(0隐藏,1显示)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'code', 'ssid', 'ghash', 'gcode', 'status', 'deleted', 'order_no', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserActionHistory - * @table plugin_wemall_user_action_history - * @return void - */ - private function _create_plugin_wemall_user_action_history() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_user_action_history', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-足迹', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['ssid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属商家']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['gcode', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品编号']], - ['times', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '记录次数']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'sort', 'ssid', 'gcode', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserActionSearch - * @table plugin_wemall_user_action_search - * @return void - */ - private function _create_plugin_wemall_user_action_search() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_user_action_search', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-搜索', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号']], - ['keys', 'string', ['limit' => 99, 'default' => '', 'null' => true, 'comment' => '关键词']], - ['times', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '搜索次数']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'keys', 'unid', 'sort', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserCheckin - * @table plugin_wemall_user_checkin - * @return void - */ - private function _create_plugin_wemall_user_checkin() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_user_checkin', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '业务-活动-签到', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户UNID']], - ['times', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '连续天数']], - ['timed', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '奖励天数']], - ['date', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '签到日期']], - ['balance', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '赠送余额']], - ['integral', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '赠送积分']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '生效状态(0未生效,1已生效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删除,1已删除)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'date', 'status', 'deleted', 'create_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserCoupon - * @table plugin_wemall_user_coupon - * @return void - */ - private function _create_plugin_wemall_user_coupon() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_user_coupon', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-卡券', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '卡券类型']], - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户UNID']], - ['coid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '配置编号']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '卡券编号']], - ['used', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '使用状态']], - ['used_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '使用时间']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '生效状态(0未生效,1待使用,2已使用,3已过期)']], - ['status_desc', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '状态描述']], - ['status_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '修改时间']], - ['expire', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '有效时间']], - ['expire_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '有效日期']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删除,1已删除)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ['confirm_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '到账时间']], - ], [ - 'code', 'unid', 'coid', 'used', 'status', 'expire', 'deleted', 'create_time', 'confirm_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserCreate - * @table plugin_wemall_user_create - * @return void - */ - private function _create_plugin_wemall_user_create() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_user_create', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-创建', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => false, 'comment' => '关联用户']], - ['name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '用户姓名']], - ['phone', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '手机号码']], - ['headimg', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户头像']], - ['password', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '初始密码']], - ['rebate_total', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '累计返利']], - ['rebate_total_code', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '记录编号']], - ['rebate_total_desc', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '记录描述']], - ['rebate_usable', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '可提返利']], - ['rebate_usable_code', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '记录编号']], - ['rebate_usable_desc', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '记录描述']], - ['agent_entry', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '代理权限']], - ['agent_phone', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '上级手机']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'name', 'unid', 'phone', 'status', 'deleted', 'create_time', 'agent_entry', 'agent_phone', 'rebate_total', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserRebate - * @table plugin_wemall_user_rebate - * @return void - */ - private function _create_plugin_wemall_user_rebate() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_user_rebate', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-返利', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户UNID']], - ['layer', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上级层级']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '奖励编号']], - ['hash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '维一编号']], - ['date', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '奖励日期']], - ['type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '奖励类型']], - ['name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '奖励名称']], - ['amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '奖励数量']], - ['order_no', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '订单单号']], - ['order_unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '订单用户']], - ['order_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '订单金额']], - ['remark', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '奖励描述']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '生效状态(0未生效,1已生效)']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删除,1已删除)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ['confirm_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '到账时间']], - ], [ - 'type', 'date', 'code', 'name', 'unid', 'hash', 'status', 'deleted', 'order_no', 'order_unid', 'create_time', 'confirm_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserRecharge - * @table plugin_wemall_user_recharge - * @return void - */ - private function _create_plugin_wemall_user_recharge() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_user_recharge', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-充值', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '账号编号']], - ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作编号']], - ['name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '操作名称']], - ['remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '操作备注']], - ['amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '操作金额']], - ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删除,1已删除)']], - ['create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '系统用户']], - ['deleted_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '系统用户']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['deleted_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '删除时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'code', 'deleted', 'create_time', 'deleted_time', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserRelation - * @table plugin_wemall_user_relation - * @return void - */ - private function _create_plugin_wemall_user_relation() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_user_relation', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-关系', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '当前用户']], - ['puids', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '绑定状态']], - ['puid1', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上1级代理']], - ['puid2', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上2级代理']], - ['puid3', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上3级代理']], - ['layer', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属层级']], - ['path', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '关系路径']], - ['extra', 'text', ['default' => NULL, 'null' => true, 'comment' => '扩展数据']], - ['entry_agent', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '推广权益(0无,1有)']], - ['entry_member', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '入会礼包(0无,1有)']], - ['level_code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '会员等级']], - ['level_name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '会员名称']], - ['agent_uuid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '绑定用户']], - ['agent_state', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '绑定状态']], - ['agent_level_code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '代理等级']], - ['agent_level_name', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '代理名称']], - ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'unid', 'path', 'puid1', 'puid2', 'puid3', 'level_code', 'agent_uuid', 'create_time', 'entry_agent', 'entry_member', 'agent_level_code', - ]); - } - - /** - * 创建数据对象 - * @class PluginWemallUserTransfer - * @table plugin_wemall_user_transfer - * @return void - */ - private function _create_plugin_wemall_user_transfer() - { - // 创建数据表对象 - $table = $this->table('plugin_wemall_user_transfer', [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商城-用户-提现', - ]); - // 创建或更新数据表 - PhinxExtend::upgrade($table, [ - ['unid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户UNID']], - ['type', 'string', ['limit' => 30, 'default' => '', 'null' => true, 'comment' => '提现方式']], - ['date', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '提现日期']], - ['code', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '提现单号']], - ['appid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号APPID']], - ['openid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号OPENID']], - ['username', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号真实姓名']], - ['charge_rate', 'decimal', ['precision' => 20, 'scale' => 4, 'default' => '0.0000', 'null' => true, 'comment' => '提现手续费比例']], - ['charge_amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '提现手续费金额']], - ['amount', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '提现转账金额']], - ['qrcode', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '收款码图片地址']], - ['bank_wseq', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '微信银行编号']], - ['bank_name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '开户银行名称']], - ['bank_bran', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '开户分行名称']], - ['bank_user', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '开户账号姓名']], - ['bank_code', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '开户银行卡号']], - ['alipay_user', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '支付宝姓名']], - ['alipay_code', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '支付宝账号']], - ['remark', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '提现描述']], - ['trade_no', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '交易单号']], - ['trade_time', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '打款时间']], - ['change_time', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '处理时间']], - ['change_desc', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '处理描述']], - ['audit_time', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '审核时间']], - ['audit_status', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '审核状态']], - ['audit_remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '审核描述']], - ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '提现状态(0失败,1待审核,2已审核,3打款中,4已打款,5已收款)']], - ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], - ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], - ], [ - 'code', 'unid', 'date', 'type', 'appid', 'openid', 'status', 'create_time', 'audit_status', - ]); - } -} diff --git a/plugin/think-plugs-wemall/stc/database/20241016000002_install_wemall20241016.php b/plugin/think-plugs-wemall/stc/database/20241016000002_install_wemall20241016.php index 609589414..726f76e0b 100644 --- a/plugin/think-plugs-wemall/stc/database/20241016000002_install_wemall20241016.php +++ b/plugin/think-plugs-wemall/stc/database/20241016000002_install_wemall20241016.php @@ -9,6 +9,15 @@ use think\migration\Migrator; class InstallWemall20241016 extends Migrator { + /** + * 获取脚本名称 + * @return string + */ + public function getName(): string + { + return 'WemallPlugin'; + } + /** * 创建数据库 */ diff --git a/plugin/think-plugs-wuma/stc/database/20230818000001_install_wuma.php b/plugin/think-plugs-wuma/stc/database/20230818000001_install_wuma.php deleted file mode 100644 index 3540c24e8..000000000 --- a/plugin/think-plugs-wuma/stc/database/20230818000001_install_wuma.php +++ /dev/null @@ -1,1178 +0,0 @@ -_create_plugin_wuma_code_rule(); - $this->_create_plugin_wuma_code_rule_range(); - $this->_create_plugin_wuma_sales_order(); - $this->_create_plugin_wuma_sales_order_data(); - $this->_create_plugin_wuma_sales_order_data_mins(); - $this->_create_plugin_wuma_sales_order_data_nums(); - $this->_create_plugin_wuma_sales_user(); - $this->_create_plugin_wuma_sales_user_level(); - $this->_create_plugin_wuma_sales_user_stock(); - $this->_create_plugin_wuma_source_assign(); - $this->_create_plugin_wuma_source_assign_item(); - $this->_create_plugin_wuma_source_blockchain(); - $this->_create_plugin_wuma_source_certificate(); - $this->_create_plugin_wuma_source_produce(); - $this->_create_plugin_wuma_source_query(); - $this->_create_plugin_wuma_source_query_notify(); - $this->_create_plugin_wuma_source_query_verify(); - $this->_create_plugin_wuma_source_template(); - $this->_create_plugin_wuma_warehouse(); - $this->_create_plugin_wuma_warehouse_order(); - $this->_create_plugin_wuma_warehouse_order_data(); - $this->_create_plugin_wuma_warehouse_order_data_mins(); - $this->_create_plugin_wuma_warehouse_order_data_nums(); - $this->_create_plugin_wuma_warehouse_relation(); - $this->_create_plugin_wuma_warehouse_relation_data(); - $this->_create_plugin_wuma_warehouse_replace(); - $this->_create_plugin_wuma_warehouse_stock(); - $this->_create_plugin_wuma_warehouse_user(); - } - - /** - * 创建数据对象 - * @class PluginWumaCodeRule - * @table plugin_wuma_code_rule - * @return void - */ - private function _create_plugin_wuma_code_rule() - { - - // 当前数据表 - $table = 'plugin_wuma_code_rule'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-生码-规则', - ]) - ->addColumn('type', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '批次类型(1前关联,2后关联)']) - ->addColumn('batch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '批次编号']) - ->addColumn('mid_min', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '中码与小码比值']) - ->addColumn('max_mid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '大码与中码比值']) - ->addColumn('sns_start', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '序号起始值']) - ->addColumn('sns_after', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '序号结束值']) - ->addColumn('sns_length', 'biginteger', ['limit' => 20, 'default' => 20, 'null' => true, 'comment' => '序号长度']) - ->addColumn('max_length', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '大码长度']) - ->addColumn('mid_length', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '中码长度']) - ->addColumn('min_length', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '小码长度']) - ->addColumn('hex_length', 'biginteger', ['limit' => 20, 'default' => 10, 'null' => true, 'comment' => '加密长度']) - ->addColumn('ver_length', 'biginteger', ['limit' => 20, 'default' => 4, 'null' => true, 'comment' => '验证长度']) - ->addColumn('max_number', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '大码数量']) - ->addColumn('mid_number', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '中码数量']) - ->addColumn('number', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '物码总数']) - ->addColumn('template', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '导出模板']) - ->addColumn('remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '物码描述']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']) - ->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('type', ['name' => 'idx_plugin_wuma_code_rule_type']) - ->addIndex('batch', ['name' => 'idx_plugin_wuma_code_rule_batch']) - ->addIndex('status', ['name' => 'idx_plugin_wuma_code_rule_status']) - ->addIndex('deleted', ['name' => 'idx_plugin_wuma_code_rule_deleted']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaCodeRuleRange - * @table plugin_wuma_code_rule_range - * @return void - */ - private function _create_plugin_wuma_code_rule_range() - { - - // 当前数据表 - $table = 'plugin_wuma_code_rule_range'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-生码-范围', - ]) - ->addColumn('type', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '物码类型']) - ->addColumn('batch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物码批次号']) - ->addColumn('code_type', 'string', ['limit' => 3, 'default' => '', 'null' => true, 'comment' => '数码类型(min小码,mid中码,max大码)']) - ->addColumn('code_length', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '数码长度']) - ->addColumn('range_start', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '起始数码']) - ->addColumn('range_after', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '结束数码']) - ->addColumn('range_number', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '数码数量']) - ->addIndex('type', ['name' => 'idx_plugin_wuma_code_rule_range_type']) - ->addIndex('code_type', ['name' => 'idx_plugin_wuma_code_rule_range_code_type']) - ->addIndex('code_length', ['name' => 'idx_plugin_wuma_code_rule_range_code_length']) - ->addIndex('range_start', ['name' => 'idx_plugin_wuma_code_rule_range_range_start']) - ->addIndex('range_after', ['name' => 'idx_plugin_wuma_code_rule_range_range_after']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaSalesOrder - * @table plugin_wuma_sales_order - * @return void - */ - private function _create_plugin_wuma_sales_order() - { - - // 当前数据表 - $table = 'plugin_wuma_sales_order'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-订单', - ]) - ->addColumn('auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '经销商编号']) - ->addColumn('xuid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '来源经销商']) - ->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作单单号']) - ->addColumn('mode', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '操作方式(1扫码,2虚拟)']) - ->addColumn('ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品哈唏']) - ->addColumn('vir_need', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟库统计']) - ->addColumn('vir_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟库使用']) - ->addColumn('num_need', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '累计出库数量']) - ->addColumn('num_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '累计已经出库']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效,2完成)']) - ->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('auid', ['name' => 'idx_plugin_wuma_sales_order_auid']) - ->addIndex('xuid', ['name' => 'idx_plugin_wuma_sales_order_xuid']) - ->addIndex('code', ['name' => 'idx_plugin_wuma_sales_order_code']) - ->addIndex('mode', ['name' => 'idx_plugin_wuma_sales_order_mode']) - ->addIndex('ghash', ['name' => 'idx_plugin_wuma_sales_order_ghash']) - ->addIndex('status', ['name' => 'idx_plugin_wuma_sales_order_status']) - ->addIndex('deleted', ['name' => 'idx_plugin_wuma_sales_order_deleted']) - ->addIndex('create_time', ['name' => 'idx_plugin_wuma_sales_order_create_time']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaSalesOrderData - * @table plugin_wuma_sales_order_data - * @return void - */ - private function _create_plugin_wuma_sales_order_data() - { - - // 当前数据表 - $table = 'plugin_wuma_sales_order_data'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-数据', - ]) - ->addColumn('auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '经销商编号']) - ->addColumn('xuid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '来源经销商']) - ->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作单号']) - ->addColumn('mode', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '操作方式(1扫码,2虚拟)']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']) - ->addColumn('number', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '物码总数']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('auid', ['name' => 'idx_plugin_wuma_sales_order_data_auid']) - ->addIndex('xuid', ['name' => 'idx_plugin_wuma_sales_order_data_xuid']) - ->addIndex('mode', ['name' => 'idx_plugin_wuma_sales_order_data_mode']) - ->addIndex('code', ['name' => 'idx_plugin_wuma_sales_order_data_code']) - ->addIndex('status', ['name' => 'idx_plugin_wuma_sales_order_data_status']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaSalesOrderDataMins - * @table plugin_wuma_sales_order_data_mins - * @return void - */ - private function _create_plugin_wuma_sales_order_data_mins() - { - - // 当前数据表 - $table = 'plugin_wuma_sales_order_data_mins'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-小码', - ]) - ->addColumn('ddid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '数据编号']) - ->addColumn('auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '代理编号']) - ->addColumn('code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '物码数据']) - ->addColumn('mode', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '操作类型(1扫码,2虚拟)']) - ->addColumn('stock', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '库存有效']) - ->addColumn('ghash', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品哈唏']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '数据状态(0无效,1有效)']) - ->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0有效,1已删)']) - ->addColumn('status_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '状态时间']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addIndex('ddid', ['name' => 'idx_plugin_wuma_sales_order_data_mins_ddid']) - ->addIndex('auid', ['name' => 'idx_plugin_wuma_sales_order_data_mins_auid']) - ->addIndex('code', ['name' => 'idx_plugin_wuma_sales_order_data_mins_code']) - ->addIndex('mode', ['name' => 'idx_plugin_wuma_sales_order_data_mins_mode']) - ->addIndex('stock', ['name' => 'idx_plugin_wuma_sales_order_data_mins_stock']) - ->addIndex('ghash', ['name' => 'idx_plugin_wuma_sales_order_data_mins_ghash']) - ->addIndex('status', ['name' => 'idx_plugin_wuma_sales_order_data_mins_status']) - ->addIndex('deleted', ['name' => 'idx_plugin_wuma_sales_order_data_mins_deleted']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaSalesOrderDataNums - * @table plugin_wuma_sales_order_data_nums - * @return void - */ - private function _create_plugin_wuma_sales_order_data_nums() - { - - // 当前数据表 - $table = 'plugin_wuma_sales_order_data_nums'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-箱码', - ]) - ->addColumn('uuid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属品牌']) - ->addColumn('ddid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '数据编号']) - ->addColumn('count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '物码数量']) - ->addColumn('type', 'string', ['limit' => 40, 'default' => '', 'null' => true, 'comment' => '物码类型']) - ->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物码数据']) - ->addIndex('type', ['name' => 'idx_plugin_wuma_sales_order_data_nums_type']) - ->addIndex('uuid', ['name' => 'idx_plugin_wuma_sales_order_data_nums_uuid']) - ->addIndex('ddid', ['name' => 'idx_plugin_wuma_sales_order_data_nums_ddid']) - ->addIndex('code', ['name' => 'idx_plugin_wuma_sales_order_data_nums_code']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaSalesUser - * @table plugin_wuma_sales_user - * @return void - */ - private function _create_plugin_wuma_sales_user() - { - - // 当前数据表 - $table = 'plugin_wuma_sales_user'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-用户', - ]) - ->addColumn('auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上级代理']) - ->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '授权编号']) - ->addColumn('level', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '代理等级']) - ->addColumn('master', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '总部账号']) - ->addColumn('phone', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '用户手机']) - ->addColumn('userid', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '身份证号']) - ->addColumn('mobile', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '联系电话']) - ->addColumn('headimg', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户头像']) - ->addColumn('username', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户姓名']) - ->addColumn('password', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '登录密码']) - ->addColumn('date_start', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '开始时间']) - ->addColumn('date_after', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '结束时间']) - ->addColumn('super_auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '邀请上级用户']) - ->addColumn('super_phone', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '邀请上级手机']) - ->addColumn('business', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '营业执照']) - ->addColumn('region_prov', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所属省份']) - ->addColumn('region_city', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所属城市']) - ->addColumn('region_area', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所属区域']) - ->addColumn('region_address', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '详细地址']) - ->addColumn('remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户备注描述']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '用户状态(1正常,0已黑)']) - ->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '注册时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('auid', ['name' => 'idx_plugin_wuma_sales_user_auid']) - ->addIndex('code', ['name' => 'idx_plugin_wuma_sales_user_code']) - ->addIndex('level', ['name' => 'idx_plugin_wuma_sales_user_level']) - ->addIndex('status', ['name' => 'idx_plugin_wuma_sales_user_status']) - ->addIndex('deleted', ['name' => 'idx_plugin_wuma_sales_user_deleted']) - ->addIndex('super_auid', ['name' => 'idx_plugin_wuma_sales_user_super_auid']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaSalesUserLevel - * @table plugin_wuma_sales_user_level - * @return void - */ - private function _create_plugin_wuma_sales_user_level() - { - - // 当前数据表 - $table = 'plugin_wuma_sales_user_level'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-等级', - ]) - ->addColumn('name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '代理级别名称']) - ->addColumn('number', 'integer', ['limit' => 2, 'default' => 0, 'null' => true, 'comment' => '代理级别序号']) - ->addColumn('remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '代理级别描述']) - ->addColumn('utime', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '等级更新时间']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '代理等级状态(1使用,0禁用)']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '等级创建时间']) - ->addIndex('status', ['name' => 'idx_plugin_wuma_sales_user_level_status']) - ->addIndex('number', ['name' => 'idx_plugin_wuma_sales_user_level_number']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaSalesUserStock - * @table plugin_wuma_sales_user_stock - * @return void - */ - private function _create_plugin_wuma_sales_user_stock() - { - - // 当前数据表 - $table = 'plugin_wuma_sales_user_stock'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-库存', - ]) - ->addColumn('auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '经销编号']) - ->addColumn('ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品哈唏']) - ->addColumn('vir_total', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟库存']) - ->addColumn('vir_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟出货']) - ->addColumn('num_total', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '累计库存']) - ->addColumn('num_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '累计出货']) - ->addIndex('auid', ['name' => 'idx_plugin_wuma_sales_user_stock_auid']) - ->addIndex('ghash', ['name' => 'idx_plugin_wuma_sales_user_stock_ghash']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaSourceAssign - * @table plugin_wuma_source_assign - * @return void - */ - private function _create_plugin_wuma_source_assign() - { - - // 当前数据表 - $table = 'plugin_wuma_source_assign'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-赋码批次', - ]) - ->addColumn('batch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '赋码批次号']) - ->addColumn('cbatch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物码批次号']) - ->addColumn('outer_items', 'text', ['default' => NULL, 'null' => true, 'comment' => 'JSON出库']) - ->addColumn('items', 'text', ['default' => NULL, 'null' => true, 'comment' => 'JSON赋码']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']) - ->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('batch', ['name' => 'idx_plugin_wuma_source_assign_batch']) - ->addIndex('cbatch', ['name' => 'idx_plugin_wuma_source_assign_cbatch']) - ->addIndex('status', ['name' => 'idx_plugin_wuma_source_assign_status']) - ->addIndex('deleted', ['name' => 'idx_plugin_wuma_source_assign_deleted']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaSourceAssignItem - * @table plugin_wuma_source_assign_item - * @return void - */ - private function _create_plugin_wuma_source_assign_item() - { - - // 当前数据表 - $table = 'plugin_wuma_source_assign_item'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-赋码规则', - ]) - ->addColumn('lock', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '是否已锁定']) - ->addColumn('batch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '赋码批次号']) - ->addColumn('pbatch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '生产批次号']) - ->addColumn('cbatch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物码批次号']) - ->addColumn('range_start', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '开始物码区间']) - ->addColumn('range_after', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '结束物码区间']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('batch', ['name' => 'idx_plugin_wuma_source_assign_item_batch']) - ->addIndex('cbatch', ['name' => 'idx_plugin_wuma_source_assign_item_cbatch']) - ->addIndex('pbatch', ['name' => 'idx_plugin_wuma_source_assign_item_pbatch']) - ->addIndex('range_start', ['name' => 'idx_plugin_wuma_source_assign_item_range_start']) - ->addIndex('range_after', ['name' => 'idx_plugin_wuma_source_assign_item_range_after']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaSourceBlockchain - * @table plugin_wuma_source_blockchain - * @return void - */ - private function _create_plugin_wuma_source_blockchain() - { - - // 当前数据表 - $table = 'plugin_wuma_source_blockchain'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-区块链', - ]) - ->addColumn('scid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '确权证书']) - ->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '流程编号']) - ->addColumn('hash', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '流程HASH']) - ->addColumn('name', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '流程名称']) - ->addColumn('data', 'text', ['default' => NULL, 'null' => true, 'comment' => '流程环节']) - ->addColumn('remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '流程备注']) - ->addColumn('sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效1有效)']) - ->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删1已删)']) - ->addColumn('hash_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '上链时间']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('code', ['name' => 'idx_plugin_wuma_source_blockchain_code']) - ->addIndex('scid', ['name' => 'idx_plugin_wuma_source_blockchain_scid']) - ->addIndex('sort', ['name' => 'idx_plugin_wuma_source_blockchain_sort']) - ->addIndex('status', ['name' => 'idx_plugin_wuma_source_blockchain_status']) - ->addIndex('deleted', ['name' => 'idx_plugin_wuma_source_blockchain_deleted']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaSourceCertificate - * @table plugin_wuma_source_certificate - * @return void - */ - private function _create_plugin_wuma_source_certificate() - { - - // 当前数据表 - $table = 'plugin_wuma_source_certificate'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-确权证书', - ]) - ->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '模板编号']) - ->addColumn('name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '模板名称']) - ->addColumn('times', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '访问次数']) - ->addColumn('image', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '证书底图']) - ->addColumn('content', 'text', ['default' => NULL, 'null' => true, 'comment' => '定制规则']) - ->addColumn('sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效1有效)']) - ->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删1已删)']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('code', ['name' => 'idx_plugin_wuma_source_certificate_code']) - ->addIndex('status', ['name' => 'idx_plugin_wuma_source_certificate_status']) - ->addIndex('deleted', ['name' => 'idx_plugin_wuma_source_certificate_deleted']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaSourceProduce - * @table plugin_wuma_source_produce - * @return void - */ - private function _create_plugin_wuma_source_produce() - { - - // 当前数据表 - $table = 'plugin_wuma_source_produce'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-生产批次', - ]) - ->addColumn('batch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '生产批次']) - ->addColumn('ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '产品编号']) - ->addColumn('tcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '关联溯源模板']) - ->addColumn('addr_prov', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '所在省份']) - ->addColumn('addr_city', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '所在城市']) - ->addColumn('addr_area', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '所在区域']) - ->addColumn('remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '批次备注']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效1有效)']) - ->addColumn('sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']) - ->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删1已删)']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('batch', ['name' => 'idx_plugin_wuma_source_produce_batch']) - ->addIndex('status', ['name' => 'idx_plugin_wuma_source_produce_status']) - ->addIndex('deleted', ['name' => 'idx_plugin_wuma_source_produce_deleted']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaSourceQuery - * @table plugin_wuma_source_query - * @return void - */ - private function _create_plugin_wuma_source_query() - { - - // 当前数据表 - $table = 'plugin_wuma_source_query'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-查询记录', - ]) - ->addColumn('auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '代理用户']) - ->addColumn('code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '小码数码']) - ->addColumn('ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品哈希']) - ->addColumn('times', 'biginteger', ['limit' => 20, 'default' => 1, 'null' => true, 'comment' => '查询次数']) - ->addColumn('encode', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '物码编号']) - ->addColumn('prov', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '所在省份']) - ->addColumn('city', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '所在城市']) - ->addColumn('area', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '所在区域']) - ->addColumn('addr', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '详细地址']) - ->addColumn('geoip', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '访问IP']) - ->addColumn('gtype', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '定位类型']) - ->addColumn('latlng', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '经纬度']) - ->addColumn('notify', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '窜货状态']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('code', ['name' => 'idx_plugin_wuma_source_query_code']) - ->addIndex('auid', ['name' => 'idx_plugin_wuma_source_query_auid']) - ->addIndex('prov', ['name' => 'idx_plugin_wuma_source_query_prov']) - ->addIndex('city', ['name' => 'idx_plugin_wuma_source_query_city']) - ->addIndex('area', ['name' => 'idx_plugin_wuma_source_query_area']) - ->addIndex('notify', ['name' => 'idx_plugin_wuma_source_query_notify']) - ->addIndex('encode', ['name' => 'idx_plugin_wuma_source_query_encode']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaSourceQueryNotify - * @table plugin_wuma_source_query_notify - * @return void - */ - private function _create_plugin_wuma_source_query_notify() - { - - // 当前数据表 - $table = 'plugin_wuma_source_query_notify'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-窜货异常', - ]) - ->addColumn('auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '代理用户']) - ->addColumn('code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '小码数码']) - ->addColumn('type', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '记录类型']) - ->addColumn('times', 'biginteger', ['limit' => 20, 'default' => 1, 'null' => true, 'comment' => '查询次数']) - ->addColumn('encode', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '物码编号']) - ->addColumn('prov', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所在省份']) - ->addColumn('city', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所在城市']) - ->addColumn('area', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所在区域']) - ->addColumn('addr', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '详细地址']) - ->addColumn('gtype', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '定位类型']) - ->addColumn('geoip', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '访问IP']) - ->addColumn('latlng', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '经纬度']) - ->addColumn('pcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品编号']) - ->addColumn('pspec', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '商品规格']) - ->addColumn('agent_prov', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '代理省份']) - ->addColumn('agent_city', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '代理城市']) - ->addColumn('agent_area', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '代理区域']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('auid', ['name' => 'idx_plugin_wuma_source_query_notify_auid']) - ->addIndex('prov', ['name' => 'idx_plugin_wuma_source_query_notify_prov']) - ->addIndex('city', ['name' => 'idx_plugin_wuma_source_query_notify_city']) - ->addIndex('area', ['name' => 'idx_plugin_wuma_source_query_notify_area']) - ->addIndex('code', ['name' => 'idx_plugin_wuma_source_query_notify_code']) - ->addIndex('encode', ['name' => 'idx_plugin_wuma_source_query_notify_encode']) - ->addIndex('agent_prov', ['name' => 'idx_plugin_wuma_source_query_notify_agent_prov']) - ->addIndex('agent_city', ['name' => 'idx_plugin_wuma_source_query_notify_agent_city']) - ->addIndex('agent_area', ['name' => 'idx_plugin_wuma_source_query_notify_agent_area']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaSourceQueryVerify - * @table plugin_wuma_source_query_verify - * @return void - */ - private function _create_plugin_wuma_source_query_verify() - { - - // 当前数据表 - $table = 'plugin_wuma_source_query_verify'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-查询记录', - ]) - ->addColumn('auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '代理用户']) - ->addColumn('code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '小码数码']) - ->addColumn('times', 'biginteger', ['limit' => 20, 'default' => 1, 'null' => true, 'comment' => '查询次数']) - ->addColumn('ghash', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品编号']) - ->addColumn('encode', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '物码编号']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('code', ['name' => 'idx_plugin_wuma_source_query_verify_code']) - ->addIndex('auid', ['name' => 'idx_plugin_wuma_source_query_verify_auid']) - ->addIndex('encode', ['name' => 'idx_plugin_wuma_source_query_verify_encode']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaSourceTemplate - * @table plugin_wuma_source_template - * @return void - */ - private function _create_plugin_wuma_source_template() - { - - // 当前数据表 - $table = 'plugin_wuma_source_template'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-页面模板', - ]) - ->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '模板编号']) - ->addColumn('name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '模板名称']) - ->addColumn('times', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '访问次数']) - ->addColumn('styles', 'text', ['default' => NULL, 'null' => true, 'comment' => '主题样式']) - ->addColumn('content', 'text', ['default' => NULL, 'null' => true, 'comment' => '模板内容']) - ->addColumn('sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']) - ->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('code', ['name' => 'idx_plugin_wuma_source_template_code']) - ->addIndex('status', ['name' => 'idx_plugin_wuma_source_template_status']) - ->addIndex('deleted', ['name' => 'idx_plugin_wuma_source_template_deleted']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouse - * @table plugin_wuma_warehouse - * @return void - */ - private function _create_plugin_wuma_warehouse() - { - - // 当前数据表 - $table = 'plugin_wuma_warehouse'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库', - ]) - ->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '仓库编号']) - ->addColumn('name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '仓库名称']) - ->addColumn('person', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '负责人']) - ->addColumn('remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '物码描述']) - ->addColumn('addr_prov', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所属省份']) - ->addColumn('addr_city', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所属城市']) - ->addColumn('addr_area', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所属区域']) - ->addColumn('addr_text', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '详细地址']) - ->addColumn('sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效1有效)']) - ->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删1已删)']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('code', ['name' => 'idx_plugin_wuma_warehouse_code']) - ->addIndex('name', ['name' => 'idx_plugin_wuma_warehouse_name']) - ->addIndex('sort', ['name' => 'idx_plugin_wuma_warehouse_sort']) - ->addIndex('status', ['name' => 'idx_plugin_wuma_warehouse_status']) - ->addIndex('deleted', ['name' => 'idx_plugin_wuma_warehouse_deleted']) - ->addIndex('create_time', ['name' => 'idx_plugin_wuma_warehouse_create_time']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouseOrder - * @table plugin_wuma_warehouse_order - * @return void - */ - private function _create_plugin_wuma_warehouse_order() - { - - // 当前数据表 - $table = 'plugin_wuma_warehouse_order'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-订单', - ]) - ->addColumn('type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '操作类型(1订单入库,2直接入库,3调货入库,4订单出库,5直接出库,6调货出库,7关联出库,8直接退货)']) - ->addColumn('mode', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '操作方式(1扫码操作,2虚拟操作)']) - ->addColumn('auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '出库代理']) - ->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作单号']) - ->addColumn('wcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '仓库编号']) - ->addColumn('ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '绑定产品']) - ->addColumn('vir_need', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟总数']) - ->addColumn('vir_used', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟完成']) - ->addColumn('num_need', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '扫码总数']) - ->addColumn('num_used', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '扫码完成']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效,2完成)']) - ->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addColumn('deleted_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '删除时间']) - ->addIndex('mode', ['name' => 'idx_plugin_wuma_warehouse_order_mode']) - ->addIndex('auid', ['name' => 'idx_plugin_wuma_warehouse_order_auid']) - ->addIndex('type', ['name' => 'idx_plugin_wuma_warehouse_order_type']) - ->addIndex('code', ['name' => 'idx_plugin_wuma_warehouse_order_code']) - ->addIndex('ghash', ['name' => 'idx_plugin_wuma_warehouse_order_ghash']) - ->addIndex('wcode', ['name' => 'idx_plugin_wuma_warehouse_order_wcode']) - ->addIndex('status', ['name' => 'idx_plugin_wuma_warehouse_order_status']) - ->addIndex('deleted', ['name' => 'idx_plugin_wuma_warehouse_order_deleted']) - ->addIndex('create_time', ['name' => 'idx_plugin_wuma_warehouse_order_create_time']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouseOrderData - * @table plugin_wuma_warehouse_order_data - * @return void - */ - private function _create_plugin_wuma_warehouse_order_data() - { - - // 当前数据表 - $table = 'plugin_wuma_warehouse_order_data'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-数据', - ]) - ->addColumn('type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '操作类型(1订单入库,2直接入库,3调货入库,4订单出库,5直接出库,6调货出库,7关联出库,8直接退货)']) - ->addColumn('mode', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '操作方式(1扫码操作,2虚拟操作)']) - ->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作单号']) - ->addColumn('number', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '标签总数']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addIndex('mode', ['name' => 'idx_plugin_wuma_warehouse_order_data_mode']) - ->addIndex('type', ['name' => 'idx_plugin_wuma_warehouse_order_data_type']) - ->addIndex('code', ['name' => 'idx_plugin_wuma_warehouse_order_data_code']) - ->addIndex('status', ['name' => 'idx_plugin_wuma_warehouse_order_data_status']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouseOrderDataMins - * @table plugin_wuma_warehouse_order_data_mins - * @return void - */ - private function _create_plugin_wuma_warehouse_order_data_mins() - { - - // 当前数据表 - $table = 'plugin_wuma_warehouse_order_data_mins'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-小码', - ]) - ->addColumn('type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '操作类型(1订单入库,2直接入库,3调货入库,4订单出库,5直接出库,6调货出库,7关联出库,8直接退货)']) - ->addColumn('mode', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '操作方式(1扫码操作,2虚拟操作)']) - ->addColumn('ddid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '数据编号']) - ->addColumn('code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '物码数据']) - ->addColumn('stock', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '调货:库存有效(0已出,1暂存)']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '退货:记录状态(0无效,1有效)']) - ->addColumn('status_time', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '状态时间']) - ->addIndex('type', ['name' => 'idx_plugin_wuma_warehouse_order_data_mins_type']) - ->addIndex('mode', ['name' => 'idx_plugin_wuma_warehouse_order_data_mins_mode']) - ->addIndex('ddid', ['name' => 'idx_plugin_wuma_warehouse_order_data_mins_ddid']) - ->addIndex('code', ['name' => 'idx_plugin_wuma_warehouse_order_data_mins_code']) - ->addIndex('stock', ['name' => 'idx_plugin_wuma_warehouse_order_data_mins_stock']) - ->addIndex('status', ['name' => 'idx_plugin_wuma_warehouse_order_data_mins_status']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouseOrderDataNums - * @table plugin_wuma_warehouse_order_data_nums - * @return void - */ - private function _create_plugin_wuma_warehouse_order_data_nums() - { - - // 当前数据表 - $table = 'plugin_wuma_warehouse_order_data_nums'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-箱码', - ]) - ->addColumn('ddid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '数据编号']) - ->addColumn('type', 'string', ['limit' => 40, 'default' => '', 'null' => true, 'comment' => '物码类型']) - ->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物码数据']) - ->addColumn('count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '物码数量']) - ->addIndex('ddid', ['name' => 'idx_plugin_wuma_warehouse_order_data_nums_ddid']) - ->addIndex('code', ['name' => 'idx_plugin_wuma_warehouse_order_data_nums_code']) - ->addIndex('type', ['name' => 'idx_plugin_wuma_warehouse_order_data_nums_type']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouseRelation - * @table plugin_wuma_warehouse_relation - * @return void - */ - private function _create_plugin_wuma_warehouse_relation() - { - - // 当前数据表 - $table = 'plugin_wuma_warehouse_relation'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-关联', - ]) - ->addColumn('max', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '大码数值']) - ->addColumn('mid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '中码数值']) - ->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']) - ->addColumn('create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上传用户']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addIndex('max', ['name' => 'idx_plugin_wuma_warehouse_relation_max']) - ->addIndex('mid', ['name' => 'idx_plugin_wuma_warehouse_relation_mid']) - ->addIndex('deleted', ['name' => 'idx_plugin_wuma_warehouse_relation_deleted']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouseRelationData - * @table plugin_wuma_warehouse_relation_data - * @return void - */ - private function _create_plugin_wuma_warehouse_relation_data() - { - - // 当前数据表 - $table = 'plugin_wuma_warehouse_relation_data'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-关联', - ]) - ->addColumn('rid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '批次数据']) - ->addColumn('max', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '大码数值']) - ->addColumn('mid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '中码数值']) - ->addColumn('min', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '小码数值']) - ->addColumn('number', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '防窜编码']) - ->addColumn('encode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '防伪编码']) - ->addColumn('lock', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '锁定状态']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']) - ->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']) - ->addColumn('create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上传用户']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addIndex('rid', ['name' => 'idx_plugin_wuma_warehouse_relation_data_rid']) - ->addIndex('max', ['name' => 'idx_plugin_wuma_warehouse_relation_data_max']) - ->addIndex('mid', ['name' => 'idx_plugin_wuma_warehouse_relation_data_mid']) - ->addIndex('min', ['name' => 'idx_plugin_wuma_warehouse_relation_data_min']) - ->addIndex('lock', ['name' => 'idx_plugin_wuma_warehouse_relation_data_lock']) - ->addIndex('status', ['name' => 'idx_plugin_wuma_warehouse_relation_data_status']) - ->addIndex('encode', ['name' => 'idx_plugin_wuma_warehouse_relation_data_encode']) - ->addIndex('number', ['name' => 'idx_plugin_wuma_warehouse_relation_data_number']) - ->addIndex('deleted', ['name' => 'idx_plugin_wuma_warehouse_relation_data_deleted']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouseReplace - * @table plugin_wuma_warehouse_replace - * @return void - */ - private function _create_plugin_wuma_warehouse_replace() - { - - // 当前数据表 - $table = 'plugin_wuma_warehouse_replace'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-替换', - ]) - ->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物码类型']) - ->addColumn('smin', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '原值小码']) - ->addColumn('tmin', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '目标小码']) - ->addColumn('source', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '原物码值']) - ->addColumn('target', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '目标物码']) - ->addColumn('lock', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '锁定状态']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']) - ->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']) - ->addColumn('create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上传用户']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addIndex('smin', ['name' => 'idx_plugin_wuma_warehouse_replace_smin']) - ->addIndex('tmin', ['name' => 'idx_plugin_wuma_warehouse_replace_tmin']) - ->addIndex('lock', ['name' => 'idx_plugin_wuma_warehouse_replace_lock']) - ->addIndex('status', ['name' => 'idx_plugin_wuma_warehouse_replace_status']) - ->addIndex('target', ['name' => 'idx_plugin_wuma_warehouse_replace_target']) - ->addIndex('source', ['name' => 'idx_plugin_wuma_warehouse_replace_source']) - ->addIndex('deleted', ['name' => 'idx_plugin_wuma_warehouse_replace_deleted']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouseStock - * @table plugin_wuma_warehouse_stock - * @return void - */ - private function _create_plugin_wuma_warehouse_stock() - { - - // 当前数据表 - $table = 'plugin_wuma_warehouse_stock'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-库存', - ]) - ->addColumn('wcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '仓库编号']) - ->addColumn('ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品规格']) - ->addColumn('vir_total', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟总数']) - ->addColumn('vir_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟完成']) - ->addColumn('num_total', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '扫码总数']) - ->addColumn('num_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '扫码完成']) - ->addIndex('wcode', ['name' => 'idx_plugin_wuma_warehouse_stock_wcode']) - ->addIndex('ghash', ['name' => 'idx_plugin_wuma_warehouse_stock_ghash']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } - - /** - * 创建数据对象 - * @class PluginWumaWarehouseUser - * @table plugin_wuma_warehouse_user - * @return void - */ - private function _create_plugin_wuma_warehouse_user() - { - - // 当前数据表 - $table = 'plugin_wuma_warehouse_user'; - - // 存在则跳过 - if ($this->hasTable($table)) return; - - // 创建数据表 - $this->table($table, [ - 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-用户', - ]) - ->addColumn('token', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '接口令牌']) - ->addColumn('username', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '用户账号']) - ->addColumn('nickname', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '用户昵称']) - ->addColumn('password', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '登录密码']) - ->addColumn('login_ip', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '登录地址']) - ->addColumn('login_time', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '登录时间']) - ->addColumn('login_num', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '登录测试']) - ->addColumn('login_vars', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '登录参数']) - ->addColumn('remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '物码描述']) - ->addColumn('sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']) - ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']) - ->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']) - ->addColumn('create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']) - ->addColumn('update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']) - ->addIndex('token', ['name' => 'idx_plugin_wuma_warehouse_user_token']) - ->addIndex('username', ['name' => 'idx_plugin_wuma_warehouse_user_username']) - ->addIndex('password', ['name' => 'idx_plugin_wuma_warehouse_user_password']) - ->addIndex('sort', ['name' => 'idx_plugin_wuma_warehouse_user_sort']) - ->addIndex('status', ['name' => 'idx_plugin_wuma_warehouse_user_status']) - ->addIndex('deleted', ['name' => 'idx_plugin_wuma_warehouse_user_deleted']) - ->create(); - - // 修改主键长度 - $this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]); - } -} diff --git a/plugin/think-plugs-wuma/stc/database/20241016000007_install_wuma20241016.php b/plugin/think-plugs-wuma/stc/database/20241016000007_install_wuma20241016.php new file mode 100644 index 000000000..2b6849436 --- /dev/null +++ b/plugin/think-plugs-wuma/stc/database/20241016000007_install_wuma20241016.php @@ -0,0 +1,881 @@ +_create_plugin_wuma_code_rule(); + $this->_create_plugin_wuma_code_rule_range(); + $this->_create_plugin_wuma_sales_order(); + $this->_create_plugin_wuma_sales_order_data(); + $this->_create_plugin_wuma_sales_order_data_mins(); + $this->_create_plugin_wuma_sales_order_data_nums(); + $this->_create_plugin_wuma_sales_user(); + $this->_create_plugin_wuma_sales_user_level(); + $this->_create_plugin_wuma_sales_user_stock(); + $this->_create_plugin_wuma_source_assign(); + $this->_create_plugin_wuma_source_assign_item(); + $this->_create_plugin_wuma_source_blockchain(); + $this->_create_plugin_wuma_source_certificate(); + $this->_create_plugin_wuma_source_produce(); + $this->_create_plugin_wuma_source_query(); + $this->_create_plugin_wuma_source_query_notify(); + $this->_create_plugin_wuma_source_query_verify(); + $this->_create_plugin_wuma_source_template(); + $this->_create_plugin_wuma_warehouse(); + $this->_create_plugin_wuma_warehouse_order(); + $this->_create_plugin_wuma_warehouse_order_data(); + $this->_create_plugin_wuma_warehouse_order_data_mins(); + $this->_create_plugin_wuma_warehouse_order_data_nums(); + $this->_create_plugin_wuma_warehouse_relation(); + $this->_create_plugin_wuma_warehouse_relation_data(); + $this->_create_plugin_wuma_warehouse_replace(); + $this->_create_plugin_wuma_warehouse_stock(); + $this->_create_plugin_wuma_warehouse_user(); + } + + /** + * 创建数据对象 + * @class PluginWumaCodeRule + * @table plugin_wuma_code_rule + * @return void + */ + private function _create_plugin_wuma_code_rule() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_code_rule', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-生码-规则', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['type', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '批次类型(1前关联,2后关联)']], + ['batch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '批次编号']], + ['mid_min', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '中码与小码比值']], + ['max_mid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '大码与中码比值']], + ['sns_start', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '序号起始值']], + ['sns_after', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '序号结束值']], + ['sns_length', 'biginteger', ['limit' => 20, 'default' => 20, 'null' => true, 'comment' => '序号长度']], + ['max_length', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '大码长度']], + ['mid_length', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '中码长度']], + ['min_length', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '小码长度']], + ['hex_length', 'biginteger', ['limit' => 20, 'default' => 10, 'null' => true, 'comment' => '加密长度']], + ['ver_length', 'biginteger', ['limit' => 20, 'default' => 4, 'null' => true, 'comment' => '验证长度']], + ['max_number', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '大码数量']], + ['mid_number', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '中码数量']], + ['number', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '物码总数']], + ['template', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '导出模板']], + ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '物码描述']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']], + ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], + ], [ + 'type', 'batch', 'status', 'deleted', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaCodeRuleRange + * @table plugin_wuma_code_rule_range + * @return void + */ + private function _create_plugin_wuma_code_rule_range() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_code_rule_range', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-生码-范围', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['type', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '物码类型']], + ['batch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物码批次号']], + ['code_type', 'string', ['limit' => 3, 'default' => '', 'null' => true, 'comment' => '数码类型(min小码,mid中码,max大码)']], + ['code_length', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '数码长度']], + ['range_start', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '起始数码']], + ['range_after', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '结束数码']], + ['range_number', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '数码数量']], + ], [ + 'type', 'code_type', 'code_length', 'range_start', 'range_after', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaSalesOrder + * @table plugin_wuma_sales_order + * @return void + */ + private function _create_plugin_wuma_sales_order() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_sales_order', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-订单', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '经销商编号']], + ['xuid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '来源经销商']], + ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作单单号']], + ['mode', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '操作方式(1扫码,2虚拟)']], + ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品哈唏']], + ['vir_need', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟库统计']], + ['vir_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟库使用']], + ['num_need', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '累计出库数量']], + ['num_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '累计已经出库']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效,2完成)']], + ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], + ], [ + 'auid', 'xuid', 'code', 'mode', 'ghash', 'status', 'deleted', 'create_time', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaSalesOrderData + * @table plugin_wuma_sales_order_data + * @return void + */ + private function _create_plugin_wuma_sales_order_data() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_sales_order_data', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-数据', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '经销商编号']], + ['xuid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '来源经销商']], + ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作单号']], + ['mode', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '操作方式(1扫码,2虚拟)']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']], + ['number', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '物码总数']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], + ], [ + 'auid', 'xuid', 'mode', 'code', 'status', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaSalesOrderDataMins + * @table plugin_wuma_sales_order_data_mins + * @return void + */ + private function _create_plugin_wuma_sales_order_data_mins() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_sales_order_data_mins', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-小码', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['ddid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '数据编号']], + ['auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '代理编号']], + ['code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '物码数据']], + ['mode', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '操作类型(1扫码,2虚拟)']], + ['stock', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '库存有效']], + ['ghash', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品哈唏']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '数据状态(0无效,1有效)']], + ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0有效,1已删)']], + ['status_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '状态时间']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ], [ + 'ddid', 'auid', 'code', 'mode', 'stock', 'ghash', 'status', 'deleted', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaSalesOrderDataNums + * @table plugin_wuma_sales_order_data_nums + * @return void + */ + private function _create_plugin_wuma_sales_order_data_nums() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_sales_order_data_nums', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-箱码', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['uuid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '所属品牌']], + ['ddid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '数据编号']], + ['count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '物码数量']], + ['type', 'string', ['limit' => 40, 'default' => '', 'null' => true, 'comment' => '物码类型']], + ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物码数据']], + ], [ + 'type', 'uuid', 'ddid', 'code', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaSalesUser + * @table plugin_wuma_sales_user + * @return void + */ + private function _create_plugin_wuma_sales_user() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_sales_user', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-用户', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上级代理']], + ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '授权编号']], + ['level', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '代理等级']], + ['master', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '总部账号']], + ['phone', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '用户手机']], + ['userid', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '身份证号']], + ['mobile', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '联系电话']], + ['headimg', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户头像']], + ['username', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户姓名']], + ['password', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '登录密码']], + ['date_start', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '开始时间']], + ['date_after', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '结束时间']], + ['super_auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '邀请上级用户']], + ['super_phone', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '邀请上级手机']], + ['business', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '营业执照']], + ['region_prov', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所属省份']], + ['region_city', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所属城市']], + ['region_area', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所属区域']], + ['region_address', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '详细地址']], + ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户备注描述']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '用户状态(1正常,0已黑)']], + ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '注册时间']], + ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], + ], [ + 'auid', 'code', 'level', 'status', 'deleted', 'super_auid', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaSalesUserLevel + * @table plugin_wuma_sales_user_level + * @return void + */ + private function _create_plugin_wuma_sales_user_level() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_sales_user_level', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-等级', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '代理级别名称']], + ['number', 'integer', ['limit' => 2, 'default' => 0, 'null' => true, 'comment' => '代理级别序号']], + ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '代理级别描述']], + ['utime', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '等级更新时间']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '代理等级状态(1使用,0禁用)']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '等级创建时间']], + ], [ + 'status', 'number', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaSalesUserStock + * @table plugin_wuma_sales_user_stock + * @return void + */ + private function _create_plugin_wuma_sales_user_stock() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_sales_user_stock', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-代理-库存', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '经销编号']], + ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品哈唏']], + ['vir_total', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟库存']], + ['vir_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟出货']], + ['num_total', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '累计库存']], + ['num_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '累计出货']], + ], [ + 'auid', 'ghash', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaSourceAssign + * @table plugin_wuma_source_assign + * @return void + */ + private function _create_plugin_wuma_source_assign() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_source_assign', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-赋码批次', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '赋码类型(0区间,1关联)']], + ['batch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '赋码批次号']], + ['cbatch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物码批次号']], + ['outer_items', 'text', ['default' => NULL, 'null' => true, 'comment' => 'JSON出库']], + ['coder_items2', 'text', ['default' => NULL, 'null' => true, 'comment' => 'JSON赋码']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']], + ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], + ], [ + 'type', 'batch', 'cbatch', 'status', 'deleted', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaSourceAssignItem + * @table plugin_wuma_source_assign_item + * @return void + */ + private function _create_plugin_wuma_source_assign_item() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_source_assign_item', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-赋码规则', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['real', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '是否真锁定']], + ['lock', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '是否已锁定']], + ['batch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '赋码批次号']], + ['cbatch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物码批次号']], + ['pbatch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '生产批次号']], + ['range_start', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '开始物码区间']], + ['range_after', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '结束物码区间']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], + ], [ + 'lock', 'real', 'batch', 'cbatch', 'pbatch', 'range_start', 'range_after', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaSourceBlockchain + * @table plugin_wuma_source_blockchain + * @return void + */ + private function _create_plugin_wuma_source_blockchain() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_source_blockchain', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-区块链', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['scid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '确权证书']], + ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '流程编号']], + ['hash', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '流程HASH']], + ['name', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '流程名称']], + ['data', 'text', ['default' => NULL, 'null' => true, 'comment' => '流程环节']], + ['remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '流程备注']], + ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效1有效)']], + ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删1已删)']], + ['hash_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '上链时间']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], + ], [ + 'code', 'scid', 'sort', 'status', 'deleted', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaSourceCertificate + * @table plugin_wuma_source_certificate + * @return void + */ + private function _create_plugin_wuma_source_certificate() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_source_certificate', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-确权证书', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '模板编号']], + ['name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '模板名称']], + ['times', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '访问次数']], + ['image', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '证书底图']], + ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '定制规则']], + ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效1有效)']], + ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删1已删)']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], + ], [ + 'code', 'status', 'deleted', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaSourceProduce + * @table plugin_wuma_source_produce + * @return void + */ + private function _create_plugin_wuma_source_produce() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_source_produce', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-生产批次', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['batch', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '生产批次']], + ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '产品编号']], + ['tcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '关联溯源模板']], + ['addr_prov', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '所在省份']], + ['addr_city', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '所在城市']], + ['addr_area', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '所在区域']], + ['remark', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '批次备注']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效1有效)']], + ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], + ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删1已删)']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], + ], [ + 'batch', 'status', 'deleted', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaSourceQuery + * @table plugin_wuma_source_query + * @return void + */ + private function _create_plugin_wuma_source_query() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_source_query', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-查询记录', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '代理用户']], + ['code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '小码数码']], + ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品哈希']], + ['times', 'biginteger', ['limit' => 20, 'default' => 1, 'null' => true, 'comment' => '查询次数']], + ['encode', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '物码编号']], + ['prov', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '所在省份']], + ['city', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '所在城市']], + ['area', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '所在区域']], + ['addr', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '详细地址']], + ['geoip', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '访问IP']], + ['gtype', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '定位类型']], + ['latlng', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '经纬度']], + ['notify', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '窜货状态']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], + ], [ + 'code', 'auid', 'prov', 'city', 'area', 'notify', 'encode', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaSourceQueryNotify + * @table plugin_wuma_source_query_notify + * @return void + */ + private function _create_plugin_wuma_source_query_notify() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_source_query_notify', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-窜货异常', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '代理用户']], + ['code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '小码数码']], + ['type', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '记录类型']], + ['times', 'biginteger', ['limit' => 20, 'default' => 1, 'null' => true, 'comment' => '查询次数']], + ['encode', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '物码编号']], + ['prov', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所在省份']], + ['city', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所在城市']], + ['area', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所在区域']], + ['addr', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '详细地址']], + ['gtype', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '定位类型']], + ['geoip', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '访问IP']], + ['latlng', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '经纬度']], + ['pcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品编号']], + ['pspec', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '商品规格']], + ['agent_prov', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '代理省份']], + ['agent_city', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '代理城市']], + ['agent_area', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '代理区域']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], + ], [ + 'auid', 'prov', 'city', 'area', 'code', 'encode', 'agent_prov', 'agent_city', 'agent_area', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaSourceQueryVerify + * @table plugin_wuma_source_query_verify + * @return void + */ + private function _create_plugin_wuma_source_query_verify() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_source_query_verify', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-查询记录', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '代理用户']], + ['code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '小码数码']], + ['times', 'biginteger', ['limit' => 20, 'default' => 1, 'null' => true, 'comment' => '查询次数']], + ['ghash', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '商品编号']], + ['encode', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '物码编号']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], + ], [ + 'code', 'auid', 'encode', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaSourceTemplate + * @table plugin_wuma_source_template + * @return void + */ + private function _create_plugin_wuma_source_template() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_source_template', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '溯源-页面模板', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '模板编号']], + ['name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '模板名称']], + ['times', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '访问次数']], + ['styles', 'text', ['default' => NULL, 'null' => true, 'comment' => '主题样式']], + ['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '模板内容']], + ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']], + ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], + ], [ + 'code', 'status', 'deleted', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaWarehouse + * @table plugin_wuma_warehouse + * @return void + */ + private function _create_plugin_wuma_warehouse() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_warehouse', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '仓库编号']], + ['name', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '仓库名称']], + ['person', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '负责人']], + ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '物码描述']], + ['addr_prov', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所属省份']], + ['addr_city', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所属城市']], + ['addr_area', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '所属区域']], + ['addr_text', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '详细地址']], + ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效1有效)']], + ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删1已删)']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], + ], [ + 'code', 'name', 'sort', 'status', 'deleted', 'create_time', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaWarehouseOrder + * @table plugin_wuma_warehouse_order + * @return void + */ + private function _create_plugin_wuma_warehouse_order() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_warehouse_order', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-订单', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '操作类型(1订单入库,2直接入库,3调货入库,4订单出库,5直接出库,6调货出库,7关联出库,8直接退货)']], + ['mode', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '操作方式(1扫码操作,2虚拟操作)']], + ['auid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '出库代理']], + ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作单号']], + ['wcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '仓库编号']], + ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '绑定产品']], + ['vir_need', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟总数']], + ['vir_used', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟完成']], + ['num_need', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '扫码总数']], + ['num_used', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '扫码完成']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效,2完成)']], + ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], + ['deleted_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '删除时间']], + ], [ + 'mode', 'auid', 'type', 'code', 'ghash', 'wcode', 'status', 'deleted', 'create_time', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaWarehouseOrderData + * @table plugin_wuma_warehouse_order_data + * @return void + */ + private function _create_plugin_wuma_warehouse_order_data() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_warehouse_order_data', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-数据', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '操作类型(1订单入库,2直接入库,3调货入库,4订单出库,5直接出库,6调货出库,7关联出库,8直接退货)']], + ['mode', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '操作方式(1扫码操作,2虚拟操作)']], + ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作单号']], + ['number', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '标签总数']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ], [ + 'mode', 'type', 'code', 'status', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaWarehouseOrderDataMins + * @table plugin_wuma_warehouse_order_data_mins + * @return void + */ + private function _create_plugin_wuma_warehouse_order_data_mins() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_warehouse_order_data_mins', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-小码', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['type', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '操作类型(1订单入库,2直接入库,3调货入库,4订单出库,5直接出库,6调货出库,7关联出库,8直接退货)']], + ['mode', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '操作方式(1扫码操作,2虚拟操作)']], + ['ddid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '数据编号']], + ['code', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '物码数据']], + ['stock', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '调货:库存有效(0已出,1暂存)']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '退货:记录状态(0无效,1有效)']], + ['status_time', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '状态时间']], + ], [ + 'type', 'mode', 'ddid', 'code', 'stock', 'status', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaWarehouseOrderDataNums + * @table plugin_wuma_warehouse_order_data_nums + * @return void + */ + private function _create_plugin_wuma_warehouse_order_data_nums() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_warehouse_order_data_nums', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-箱码', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['ddid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '数据编号']], + ['type', 'string', ['limit' => 40, 'default' => '', 'null' => true, 'comment' => '物码类型']], + ['code', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物码数据']], + ['count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '物码数量']], + ], [ + 'ddid', 'code', 'type', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaWarehouseRelation + * @table plugin_wuma_warehouse_relation + * @return void + */ + private function _create_plugin_wuma_warehouse_relation() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_warehouse_relation', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-关联', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['max', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '大码数值']], + ['mid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '中码数值']], + ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], + ['create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上传用户']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ], [ + 'max', 'mid', 'deleted', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaWarehouseRelationData + * @table plugin_wuma_warehouse_relation_data + * @return void + */ + private function _create_plugin_wuma_warehouse_relation_data() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_warehouse_relation_data', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-关联', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['rid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '批次数据']], + ['max', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '大码数值']], + ['mid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '中码数值']], + ['min', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '小码数值']], + ['number', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '防窜编码']], + ['encode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '防伪编码']], + ['lock', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '锁定状态']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']], + ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], + ['create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上传用户']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ], [ + 'rid', 'max', 'mid', 'min', 'lock', 'status', 'encode', 'number', 'deleted', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaWarehouseReplace + * @table plugin_wuma_warehouse_replace + * @return void + */ + private function _create_plugin_wuma_warehouse_replace() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_warehouse_replace', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-替换', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['type', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '物码类型']], + ['smin', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '原值小码']], + ['tmin', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '目标小码']], + ['source', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '原物码值']], + ['target', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '目标物码']], + ['lock', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '锁定状态']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']], + ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], + ['create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上传用户']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ], [ + 'smin', 'tmin', 'lock', 'status', 'target', 'source', 'deleted', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaWarehouseStock + * @table plugin_wuma_warehouse_stock + * @return void + */ + private function _create_plugin_wuma_warehouse_stock() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_warehouse_stock', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-库存', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['wcode', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '仓库编号']], + ['ghash', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '商品规格']], + ['vir_total', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟总数']], + ['vir_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '虚拟完成']], + ['num_total', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '扫码总数']], + ['num_count', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '扫码完成']], + ], [ + 'wcode', 'ghash', + ], true); + } + + /** + * 创建数据对象 + * @class PluginWumaWarehouseUser + * @table plugin_wuma_warehouse_user + * @return void + */ + private function _create_plugin_wuma_warehouse_user() + { + // 创建数据表对象 + $table = $this->table('plugin_wuma_warehouse_user', [ + 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '物码-仓库-用户', + ]); + // 创建或更新数据表 + PhinxExtend::upgrade($table, [ + ['token', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '接口令牌']], + ['username', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '用户账号']], + ['nickname', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '用户昵称']], + ['password', 'string', ['limit' => 32, 'default' => '', 'null' => true, 'comment' => '登录密码']], + ['login_ip', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '登录地址']], + ['login_time', 'string', ['limit' => 180, 'default' => '', 'null' => true, 'comment' => '登录时间']], + ['login_num', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '登录测试']], + ['login_vars', 'string', ['limit' => 999, 'default' => '', 'null' => true, 'comment' => '登录参数']], + ['remark', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '物码描述']], + ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], + ['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '记录状态(0无效,1有效)']], + ['deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)']], + ['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']], + ['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']], + ], [ + 'sort', 'token', 'status', 'deleted', 'username', 'password', + ], true); + } +}