fix: 调整更新插件数据库脚本

This commit is contained in:
邹景立 2024-10-16 21:43:14 +08:00
parent ce40c67479
commit 55d08ff770
16 changed files with 1024 additions and 6165 deletions

View File

@ -1,288 +0,0 @@
<?php
use think\admin\extend\PhinxExtend;
use think\migration\Migrator;
@set_time_limit(0);
@ini_set('memory_limit', -1);
class InstallSystemTable extends Migrator
{
/**
* 创建数据库
*/
public function change()
{
$this->_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',
]);
}
}

View File

@ -1,817 +0,0 @@
<?php
use think\admin\extend\PhinxExtend;
use think\migration\Migrator;
@set_time_limit(0);
@ini_set('memory_limit', -1);
class InstallWumaTable extends Migrator
{
/**
* 创建数据库
*/
public function change()
{
$this->_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',
]);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,231 +0,0 @@
<?php
use think\admin\extend\PhinxExtend;
use think\migration\Migrator;
@set_time_limit(0);
@ini_set('memory_limit', -1);
class InstallPaymentTable extends Migrator
{
/**
* 创建数据库
*/
public function change()
{
$this->_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',
]);
}
}

View File

@ -1,142 +0,0 @@
<?php
use think\admin\extend\PhinxExtend;
use think\migration\Migrator;
@set_time_limit(0);
@ini_set('memory_limit', -1);
class InstallAccountTable extends Migrator
{
/**
* 创建数据库
*/
public function change()
{
$this->_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',
]);
}
}

View File

@ -1,298 +0,0 @@
<?php
use think\admin\extend\PhinxExtend;
use think\admin\model\SystemConfig;
use think\admin\model\SystemMenu;
use think\admin\model\SystemUser;
use think\admin\service\ProcessService;
use think\helper\Str;
use think\migration\Migrator;
@set_time_limit(0);
@ini_set('memory_limit', -1);
/**
* 数据安装包
* @class InstallPackage
*/
class InstallPackage extends Migrator
{
/**
* 数据库初始化
* @return void
*/
public function change()
{
$this->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) ?: []);
}
}
}

View File

@ -1,81 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | Wechat Service Plugin for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2022~2024 Anyon <zoujingli@qq.com>
// +----------------------------------------------------------------------
// | 官方网站: 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]);
}
}

View File

@ -0,0 +1,70 @@
<?php
use think\admin\extend\PhinxExtend;
use think\migration\Migrator;
@set_time_limit(0);
@ini_set('memory_limit', -1);
class InstallWechatService20241016 extends Migrator
{
/**
* 获取脚本名称
* @return string
*/
public function getName(): string
{
return 'WechatServicePlugin';
}
/**
* 创建数据库
*/
public function change()
{
$this->_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);
}
}

View File

@ -1,416 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +----------------------------------------------------------------------
// | 官方网站: 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]);
}
}

View File

@ -1,54 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +----------------------------------------------------------------------
// | 官方网站: 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'
]);
}
}

View File

@ -1,129 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | Wechat Plugin for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2024 Anyon <zoujingli@qq.com>
// +----------------------------------------------------------------------
// | 官方网站: 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]);
}
}

View File

@ -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);
}
}

View File

@ -9,6 +9,15 @@ use think\migration\Migrator;
class InstallWemall20241016 extends Migrator
{
/**
* 获取脚本名称
* @return string
*/
public function getName(): string
{
return 'WemallPlugin';
}
/**
* 创建数据库
*/

View File

@ -0,0 +1,881 @@
<?php
use think\admin\extend\PhinxExtend;
use think\migration\Migrator;
@set_time_limit(0);
@ini_set('memory_limit', -1);
class InstallWuma20241016 extends Migrator
{
/**
* 获取脚本名称
* @return string
*/
public function getName(): string
{
return 'WumaPlugin';
}
/**
* 创建数据库
*/
public function change()
{
$this->_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);
}
}