mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2026-06-07 12:38:11 +08:00
fix: 重新备份新的数据库脚本
This commit is contained in:
parent
a07dcdda5f
commit
b97a453f2f
@ -1,441 +0,0 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
@set_time_limit(0);
|
||||
@ini_set('memory_limit', -1);
|
||||
|
||||
class InstallWechatTable extends Migrator {
|
||||
|
||||
/**
|
||||
* 创建数据库
|
||||
*/
|
||||
public function change() {
|
||||
$this->_create_wechat_auth();
|
||||
$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 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','integer',['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','string',['limit' => 500, 'default' => '', 'null' => true, 'comment' => '小程序序列内容'])
|
||||
->addColumn('total','integer',['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','integer',['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '授权状态(0已取消,1已授权)'])
|
||||
->addColumn('deleted','integer',['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删除,1已删除)'])
|
||||
->addColumn('auth_time','integer',['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]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @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]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,396 +0,0 @@
|
||||
<?php
|
||||
|
||||
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() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'system_auth';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-权限',
|
||||
])
|
||||
->addColumn('title','string',['limit' => 100, 'default' => '', 'null' => true, 'comment' => '权限名称'])
|
||||
->addColumn('utype','string',['limit' => 50, 'default' => '', 'null' => true, 'comment' => '身份权限'])
|
||||
->addColumn('desc','string',['limit' => 500, 'default' => '', 'null' => true, 'comment' => '备注说明'])
|
||||
->addColumn('sort','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重'])
|
||||
->addColumn('status','integer',['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '权限状态(1使用,0禁用)'])
|
||||
->addColumn('create_at','timestamp',['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间'])
|
||||
->addIndex('sort', ['name' => 'i73a781d61_sort'])
|
||||
->addIndex('title', ['name' => 'i73a781d61_title'])
|
||||
->addIndex('status', ['name' => 'i73a781d61_status'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class SystemAuthNode
|
||||
* @table system_auth_node
|
||||
* @return void
|
||||
*/
|
||||
private function _create_system_auth_node() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'system_auth_node';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-授权',
|
||||
])
|
||||
->addColumn('auth','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '角色'])
|
||||
->addColumn('node','string',['limit' => 200, 'default' => '', 'null' => true, 'comment' => '节点'])
|
||||
->addIndex('auth', ['name' => 'i4cd9aaff6_auth'])
|
||||
->addIndex('node', ['name' => 'i4cd9aaff6_node'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class SystemBase
|
||||
* @table system_base
|
||||
* @return void
|
||||
*/
|
||||
private function _create_system_base() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'system_base';
|
||||
|
||||
// 存在则跳过
|
||||
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' => 100, 'default' => '', 'null' => true, 'comment' => '数据代码'])
|
||||
->addColumn('name','string',['limit' => 500, 'default' => '', 'null' => true, 'comment' => '数据名称'])
|
||||
->addColumn('content','text',['default' => NULL, 'null' => true, 'comment' => '数据内容'])
|
||||
->addColumn('sort','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重'])
|
||||
->addColumn('status','integer',['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '数据状态(0禁用,1启动)'])
|
||||
->addColumn('deleted','integer',['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0正常,1已删)'])
|
||||
->addColumn('deleted_at','string',['limit' => 20, 'default' => '', 'null' => true, 'comment' => '删除时间'])
|
||||
->addColumn('deleted_by','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '删除用户'])
|
||||
->addColumn('create_at','timestamp',['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间'])
|
||||
->addIndex('type', ['name' => 'i2a29c450f_type'])
|
||||
->addIndex('code', ['name' => 'i2a29c450f_code'])
|
||||
->addIndex('name', ['name' => 'i2a29c450f_name'])
|
||||
->addIndex('sort', ['name' => 'i2a29c450f_sort'])
|
||||
->addIndex('status', ['name' => 'i2a29c450f_status'])
|
||||
->addIndex('deleted', ['name' => 'i2a29c450f_deleted'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class SystemConfig
|
||||
* @table system_config
|
||||
* @return void
|
||||
*/
|
||||
private function _create_system_config() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'system_config';
|
||||
|
||||
// 存在则跳过
|
||||
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('name','string',['limit' => 100, 'default' => '', 'null' => true, 'comment' => '配置名称'])
|
||||
->addColumn('value','string',['limit' => 2048, 'default' => '', 'null' => true, 'comment' => '配置内容'])
|
||||
->addIndex('type', ['name' => 'i48e345b98_type'])
|
||||
->addIndex('name', ['name' => 'i48e345b98_name'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class SystemData
|
||||
* @table system_data
|
||||
* @return void
|
||||
*/
|
||||
private function _create_system_data() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'system_data';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-数据',
|
||||
])
|
||||
->addColumn('name','string',['limit' => 100, 'default' => '', 'null' => true, 'comment' => '配置名'])
|
||||
->addColumn('value','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('name', ['name' => 'icbccedc16_name'])
|
||||
->addIndex('create_time', ['name' => 'icbccedc16_create_time'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class SystemFile
|
||||
* @table system_file
|
||||
* @return void
|
||||
*/
|
||||
private function _create_system_file() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'system_file';
|
||||
|
||||
// 存在则跳过
|
||||
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('hash','string',['limit' => 32, 'default' => '', 'null' => true, 'comment' => '文件哈希'])
|
||||
->addColumn('tags','string',['limit' => 50, 'default' => '', 'null' => true, 'comment' => '文件标签'])
|
||||
->addColumn('name','string',['limit' => 180, 'default' => '', 'null' => true, 'comment' => '文件名称'])
|
||||
->addColumn('xext','string',['limit' => 100, 'default' => '', 'null' => true, 'comment' => '文件后缀'])
|
||||
->addColumn('xurl','string',['limit' => 500, 'default' => '', 'null' => true, 'comment' => '访问链接'])
|
||||
->addColumn('xkey','string',['limit' => 500, 'default' => '', 'null' => true, 'comment' => '文件路径'])
|
||||
->addColumn('mime','string',['limit' => 100, 'default' => '', 'null' => true, 'comment' => '文件类型'])
|
||||
->addColumn('size','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '文件大小'])
|
||||
->addColumn('uuid','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '用户编号'])
|
||||
->addColumn('unid','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '会员编号'])
|
||||
->addColumn('isfast','integer',['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '是否秒传'])
|
||||
->addColumn('issafe','integer',['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '安全模式'])
|
||||
->addColumn('status','integer',['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '上传状态(1悬空,2落地)'])
|
||||
->addColumn('create_at','datetime',['default' => NULL, 'null' => true, 'comment' => '创建时间'])
|
||||
->addColumn('update_at','datetime',['default' => NULL, 'null' => true, 'comment' => '更新时间'])
|
||||
->addIndex('type', ['name' => 'i738a363ca_type'])
|
||||
->addIndex('hash', ['name' => 'i738a363ca_hash'])
|
||||
->addIndex('uuid', ['name' => 'i738a363ca_uuid'])
|
||||
->addIndex('xext', ['name' => 'i738a363ca_xext'])
|
||||
->addIndex('unid', ['name' => 'i738a363ca_unid'])
|
||||
->addIndex('tags', ['name' => 'i738a363ca_tags'])
|
||||
->addIndex('name', ['name' => 'i738a363ca_name'])
|
||||
->addIndex('status', ['name' => 'i738a363ca_status'])
|
||||
->addIndex('issafe', ['name' => 'i738a363ca_issafe'])
|
||||
->addIndex('isfast', ['name' => 'i738a363ca_isfast'])
|
||||
->addIndex('create_at', ['name' => 'i738a363ca_create_at'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class SystemMenu
|
||||
* @table system_menu
|
||||
* @return void
|
||||
*/
|
||||
private function _create_system_menu() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'system_menu';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-菜单',
|
||||
])
|
||||
->addColumn('pid','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '上级ID'])
|
||||
->addColumn('title','string',['limit' => 100, 'default' => '', 'null' => true, 'comment' => '菜单名称'])
|
||||
->addColumn('icon','string',['limit' => 100, 'default' => '', 'null' => true, 'comment' => '菜单图标'])
|
||||
->addColumn('node','string',['limit' => 100, 'default' => '', 'null' => true, 'comment' => '节点代码'])
|
||||
->addColumn('url','string',['limit' => 400, 'default' => '', 'null' => true, 'comment' => '链接节点'])
|
||||
->addColumn('params','string',['limit' => 500, 'default' => '', 'null' => true, 'comment' => '链接参数'])
|
||||
->addColumn('target','string',['limit' => 20, 'default' => '_self', 'null' => true, 'comment' => '打开方式'])
|
||||
->addColumn('sort','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重'])
|
||||
->addColumn('status','integer',['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '状态(0:禁用,1:启用)'])
|
||||
->addColumn('create_at','timestamp',['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间'])
|
||||
->addIndex('pid', ['name' => 'i29b9da675_pid'])
|
||||
->addIndex('sort', ['name' => 'i29b9da675_sort'])
|
||||
->addIndex('status', ['name' => 'i29b9da675_status'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class SystemOplog
|
||||
* @table system_oplog
|
||||
* @return void
|
||||
*/
|
||||
private function _create_system_oplog() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'system_oplog';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-日志',
|
||||
])
|
||||
->addColumn('node','string',['limit' => 200, 'default' => '', 'null' => false, 'comment' => '当前操作节点'])
|
||||
->addColumn('geoip','string',['limit' => 15, 'default' => '', 'null' => false, 'comment' => '操作者IP地址'])
|
||||
->addColumn('action','string',['limit' => 200, 'default' => '', 'null' => false, 'comment' => '操作行为名称'])
|
||||
->addColumn('content','string',['limit' => 1024, 'default' => '', 'null' => false, 'comment' => '操作内容描述'])
|
||||
->addColumn('username','string',['limit' => 50, 'default' => '', 'null' => false, 'comment' => '操作人用户名'])
|
||||
->addColumn('create_at','timestamp',['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '创建时间'])
|
||||
->addIndex('create_at', ['name' => 'id7cb1c775_create_at'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class SystemQueue
|
||||
* @table system_queue
|
||||
* @return void
|
||||
*/
|
||||
private function _create_system_queue() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'system_queue';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-任务',
|
||||
])
|
||||
->addColumn('code','string',['limit' => 20, 'default' => '', 'null' => false, 'comment' => '任务编号'])
|
||||
->addColumn('title','string',['limit' => 100, 'default' => '', 'null' => false, 'comment' => '任务名称'])
|
||||
->addColumn('command','string',['limit' => 500, 'default' => '', 'null' => true, 'comment' => '执行指令'])
|
||||
->addColumn('exec_pid','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '执行进程'])
|
||||
->addColumn('exec_data','text',['default' => NULL, 'null' => true, 'comment' => '执行参数'])
|
||||
->addColumn('exec_time','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '执行时间'])
|
||||
->addColumn('exec_desc','string',['limit' => 500, 'default' => '', 'null' => true, 'comment' => '执行描述'])
|
||||
->addColumn('enter_time','decimal',['precision' => 20, 'scale' => 4, 'default' => '0.0000', 'null' => true, 'comment' => '开始时间'])
|
||||
->addColumn('outer_time','decimal',['precision' => 20, 'scale' => 4, 'default' => '0.0000', 'null' => true, 'comment' => '结束时间'])
|
||||
->addColumn('loops_time','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '循环时间'])
|
||||
->addColumn('attempts','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '执行次数'])
|
||||
->addColumn('message','text',['default' => NULL, 'null' => true, 'comment' => '最新消息'])
|
||||
->addColumn('rscript','integer',['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '任务类型(0单例,1多例)'])
|
||||
->addColumn('status','integer',['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '任务状态(1新任务,2处理中,3成功,4失败)'])
|
||||
->addColumn('create_at','timestamp',['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '创建时间'])
|
||||
->addIndex('code', ['name' => 'if64376974_code'])
|
||||
->addIndex('title', ['name' => 'if64376974_title'])
|
||||
->addIndex('status', ['name' => 'if64376974_status'])
|
||||
->addIndex('rscript', ['name' => 'if64376974_rscript'])
|
||||
->addIndex('create_at', ['name' => 'if64376974_create_at'])
|
||||
->addIndex('exec_time', ['name' => 'if64376974_exec_time'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class SystemUser
|
||||
* @table system_user
|
||||
* @return void
|
||||
*/
|
||||
private function _create_system_user() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'system_user';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-用户',
|
||||
])
|
||||
->addColumn('usertype','string',['limit' => 20, 'default' => '', 'null' => true, 'comment' => '用户类型'])
|
||||
->addColumn('username','string',['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户账号'])
|
||||
->addColumn('password','string',['limit' => 32, 'default' => '', 'null' => true, 'comment' => '用户密码'])
|
||||
->addColumn('nickname','string',['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户昵称'])
|
||||
->addColumn('headimg','string',['limit' => 255, 'default' => '', 'null' => true, 'comment' => '头像地址'])
|
||||
->addColumn('authorize','string',['limit' => 255, 'default' => '', 'null' => true, 'comment' => '权限授权'])
|
||||
->addColumn('contact_qq','string',['limit' => 20, 'default' => '', 'null' => true, 'comment' => '联系QQ'])
|
||||
->addColumn('contact_mail','string',['limit' => 20, 'default' => '', 'null' => true, 'comment' => '联系邮箱'])
|
||||
->addColumn('contact_phone','string',['limit' => 20, 'default' => '', 'null' => true, 'comment' => '联系手机'])
|
||||
->addColumn('login_ip','string',['limit' => 255, 'default' => '', 'null' => true, 'comment' => '登录地址'])
|
||||
->addColumn('login_at','string',['limit' => 20, 'default' => '', 'null' => true, 'comment' => '登录时间'])
|
||||
->addColumn('login_num','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '登录次数'])
|
||||
->addColumn('describe','string',['limit' => 255, 'default' => '', 'null' => true, 'comment' => '备注说明'])
|
||||
->addColumn('sort','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重'])
|
||||
->addColumn('status','integer',['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '状态(0禁用,1启用)'])
|
||||
->addColumn('is_deleted','integer',['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除(1删除,0未删)'])
|
||||
->addColumn('create_at','timestamp',['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间'])
|
||||
->addIndex('sort', ['name' => 'i34b957835_sort'])
|
||||
->addIndex('status', ['name' => 'i34b957835_status'])
|
||||
->addIndex('username', ['name' => 'i34b957835_username'])
|
||||
->addIndex('is_deleted', ['name' => 'i34b957835_is_deleted'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,315 +0,0 @@
|
||||
<?php
|
||||
|
||||
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() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'plugin_payment_address';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-支付-地址',
|
||||
])
|
||||
->addColumn('unid','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '主账号ID'])
|
||||
->addColumn('type','integer',['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '默认状态(0普通,1默认)'])
|
||||
->addColumn('idcode','string',['limit' => 180, 'default' => '', 'null' => true, 'comment' => '身体证证号'])
|
||||
->addColumn('idimg1','string',['limit' => 500, 'default' => '', 'null' => true, 'comment' => '身份证正面'])
|
||||
->addColumn('idimg2','string',['limit' => 500, 'default' => '', 'null' => true, 'comment' => '身份证反面'])
|
||||
->addColumn('user_name','string',['limit' => 100, 'default' => '', 'null' => true, 'comment' => '收货人姓名'])
|
||||
->addColumn('user_phone','string',['limit' => 20, 'default' => '', 'null' => true, 'comment' => '收货人手机'])
|
||||
->addColumn('region_prov','string',['limit' => 100, 'default' => '', 'null' => true, 'comment' => '地址-省份'])
|
||||
->addColumn('region_city','string',['limit' => 100, 'default' => '', 'null' => true, 'comment' => '地址-城市'])
|
||||
->addColumn('region_area','string',['limit' => 100, 'default' => '', 'null' => true, 'comment' => '地址-区域'])
|
||||
->addColumn('region_addr','string',['limit' => 500, 'default' => '', 'null' => true, 'comment' => '地址-详情'])
|
||||
->addColumn('deleted','integer',['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(1已删,0未删)'])
|
||||
->addColumn('create_time','datetime',['default' => NULL, 'null' => true, 'comment' => '创建时间'])
|
||||
->addColumn('update_time','datetime',['default' => NULL, 'null' => true, 'comment' => '更新时间'])
|
||||
->addIndex('type', ['name' => 'i368e636cc_type'])
|
||||
->addIndex('unid', ['name' => 'i368e636cc_unid'])
|
||||
->addIndex('deleted', ['name' => 'i368e636cc_deleted'])
|
||||
->addIndex('user_phone', ['name' => 'i368e636cc_user_phone'])
|
||||
->addIndex('create_time', ['name' => 'i368e636cc_create_time'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class PluginPaymentBalance
|
||||
* @table plugin_payment_balance
|
||||
* @return void
|
||||
*/
|
||||
private function _create_plugin_payment_balance() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'plugin_payment_balance';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-支付-余额',
|
||||
])
|
||||
->addColumn('unid','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '账号编号'])
|
||||
->addColumn('code','string',['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作编号'])
|
||||
->addColumn('name','string',['limit' => 200, 'default' => '', 'null' => true, 'comment' => '操作名称'])
|
||||
->addColumn('remark','string',['limit' => 999, 'default' => '', 'null' => true, 'comment' => '操作备注'])
|
||||
->addColumn('amount','decimal',['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '操作金额'])
|
||||
->addColumn('amount_prev','decimal',['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '操作前金额'])
|
||||
->addColumn('amount_next','decimal',['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '操作后金额'])
|
||||
->addColumn('cancel','integer',['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '作废状态(0未作废,1已作废)'])
|
||||
->addColumn('unlock','integer',['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '解锁状态(0锁定中,1已生效)'])
|
||||
->addColumn('deleted','integer',['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删除,1已删除)'])
|
||||
->addColumn('create_by','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '系统用户'])
|
||||
->addColumn('cancel_time','datetime',['default' => NULL, 'null' => true, 'comment' => '作废时间'])
|
||||
->addColumn('unlock_time','datetime',['default' => NULL, 'null' => true, 'comment' => '解锁时间'])
|
||||
->addColumn('create_time','datetime',['default' => NULL, 'null' => true, 'comment' => '创建时间'])
|
||||
->addColumn('deleted_time','datetime',['default' => NULL, 'null' => true, 'comment' => '删除时间'])
|
||||
->addColumn('update_time','datetime',['default' => NULL, 'null' => true, 'comment' => '更新时间'])
|
||||
->addIndex('unid', ['name' => 'i8a8f8318f_unid'])
|
||||
->addIndex('code', ['name' => 'i8a8f8318f_code'])
|
||||
->addIndex('cancel', ['name' => 'i8a8f8318f_cancel'])
|
||||
->addIndex('unlock', ['name' => 'i8a8f8318f_unlock'])
|
||||
->addIndex('deleted', ['name' => 'i8a8f8318f_deleted'])
|
||||
->addIndex('create_time', ['name' => 'i8a8f8318f_create_time'])
|
||||
->addIndex('deleted_time', ['name' => 'i8a8f8318f_deleted_time'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class PluginPaymentConfig
|
||||
* @table plugin_payment_config
|
||||
* @return void
|
||||
*/
|
||||
private function _create_plugin_payment_config() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'plugin_payment_config';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-支付-配置',
|
||||
])
|
||||
->addColumn('type','string',['limit' => 50, 'default' => '', 'null' => true, 'comment' => '支付类型'])
|
||||
->addColumn('code','string',['limit' => 20, 'default' => '', 'null' => true, 'comment' => '通道编号'])
|
||||
->addColumn('name','string',['limit' => 100, 'default' => '', 'null' => true, 'comment' => '支付名称'])
|
||||
->addColumn('cover','string',['limit' => 500, 'default' => '', 'null' => true, 'comment' => '支付图标'])
|
||||
->addColumn('remark','string',['limit' => 500, 'default' => '', 'null' => true, 'comment' => '支付说明'])
|
||||
->addColumn('content','text',['default' => NULL, 'null' => true, 'comment' => '支付参数'])
|
||||
->addColumn('sort','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重'])
|
||||
->addColumn('status','integer',['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '支付状态(1使用,0禁用)'])
|
||||
->addColumn('deleted','integer',['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态'])
|
||||
->addColumn('create_time','datetime',['default' => NULL, 'null' => true, 'comment' => '创建时间'])
|
||||
->addColumn('update_time','datetime',['default' => NULL, 'null' => true, 'comment' => '更新时间'])
|
||||
->addIndex('type', ['name' => 'if27d5755e_type'])
|
||||
->addIndex('code', ['name' => 'if27d5755e_code'])
|
||||
->addIndex('sort', ['name' => 'if27d5755e_sort'])
|
||||
->addIndex('status', ['name' => 'if27d5755e_status'])
|
||||
->addIndex('deleted', ['name' => 'if27d5755e_deleted'])
|
||||
->addIndex('create_time', ['name' => 'if27d5755e_create_time'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class PluginPaymentIntegral
|
||||
* @table plugin_payment_integral
|
||||
* @return void
|
||||
*/
|
||||
private function _create_plugin_payment_integral() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'plugin_payment_integral';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-支付-积分',
|
||||
])
|
||||
->addColumn('unid','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '账号编号'])
|
||||
->addColumn('code','string',['limit' => 20, 'default' => '', 'null' => true, 'comment' => '操作编号'])
|
||||
->addColumn('name','string',['limit' => 200, 'default' => '', 'null' => true, 'comment' => '操作名称'])
|
||||
->addColumn('remark','string',['limit' => 999, 'default' => '', 'null' => true, 'comment' => '操作备注'])
|
||||
->addColumn('amount','decimal',['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '操作金额'])
|
||||
->addColumn('amount_prev','decimal',['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '操作前金额'])
|
||||
->addColumn('amount_next','decimal',['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '操作后金额'])
|
||||
->addColumn('cancel','integer',['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '作废状态(0未作废,1已作废)'])
|
||||
->addColumn('unlock','integer',['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '解锁状态(0锁定中,1已生效)'])
|
||||
->addColumn('deleted','integer',['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删除,1已删除)'])
|
||||
->addColumn('create_by','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '系统用户'])
|
||||
->addColumn('cancel_time','datetime',['default' => NULL, 'null' => true, 'comment' => '作废时间'])
|
||||
->addColumn('unlock_time','datetime',['default' => NULL, 'null' => true, 'comment' => '解锁时间'])
|
||||
->addColumn('create_time','datetime',['default' => NULL, 'null' => true, 'comment' => '创建时间'])
|
||||
->addColumn('deleted_time','datetime',['default' => NULL, 'null' => true, 'comment' => '删除时间'])
|
||||
->addColumn('update_time','datetime',['default' => NULL, 'null' => true, 'comment' => '更新时间'])
|
||||
->addIndex('unid', ['name' => 'ie9553d71a_unid'])
|
||||
->addIndex('code', ['name' => 'ie9553d71a_code'])
|
||||
->addIndex('cancel', ['name' => 'ie9553d71a_cancel'])
|
||||
->addIndex('unlock', ['name' => 'ie9553d71a_unlock'])
|
||||
->addIndex('deleted', ['name' => 'ie9553d71a_deleted'])
|
||||
->addIndex('create_time', ['name' => 'ie9553d71a_create_time'])
|
||||
->addIndex('deleted_time', ['name' => 'ie9553d71a_deleted_time'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class PluginPaymentRecord
|
||||
* @table plugin_payment_record
|
||||
* @return void
|
||||
*/
|
||||
private function _create_plugin_payment_record() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'plugin_payment_record';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-支付-行为',
|
||||
])
|
||||
->addColumn('unid','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '主账号编号'])
|
||||
->addColumn('usid','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '子账号编号'])
|
||||
->addColumn('code','string',['limit' => 20, 'default' => '', 'null' => true, 'comment' => '发起支付号'])
|
||||
->addColumn('order_no','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('channel_type','string',['limit' => 50, 'default' => '', 'null' => true, 'comment' => '支付通道类型'])
|
||||
->addColumn('channel_code','string',['limit' => 20, 'default' => '', '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_coupon','decimal',['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '平台优惠券金额'])
|
||||
->addColumn('payment_images','string',['limit' => 999, 'default' => '', 'null' => true, 'comment' => '凭证支付图片'])
|
||||
->addColumn('payment_remark','string',['limit' => 999, 'default' => '', 'null' => true, 'comment' => '支付状态备注'])
|
||||
->addColumn('payment_notify','text',['default' => NULL, 'null' => true, 'comment' => '支付通知内容'])
|
||||
->addColumn('audit_user','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '审核用户(系统用户ID)'])
|
||||
->addColumn('audit_time','datetime',['default' => NULL, 'null' => true, 'comment' => '审核时间'])
|
||||
->addColumn('audit_status','integer',['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '审核状态(0已拒,1待审,2已审)'])
|
||||
->addColumn('audit_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('refund_payment','decimal',['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退回金额'])
|
||||
->addColumn('refund_balance','decimal',['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退回余额'])
|
||||
->addColumn('refund_integral','decimal',['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退回积分'])
|
||||
->addColumn('used_payment','decimal',['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '支付金额'])
|
||||
->addColumn('used_balance','decimal',['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '扣除余额'])
|
||||
->addColumn('used_integral','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('unid', ['name' => 'id72e373f8_unid'])
|
||||
->addIndex('usid', ['name' => 'id72e373f8_usid'])
|
||||
->addIndex('code', ['name' => 'id72e373f8_code'])
|
||||
->addIndex('order_no', ['name' => 'id72e373f8_order_no'])
|
||||
->addIndex('create_time', ['name' => 'id72e373f8_create_time'])
|
||||
->addIndex('audit_status', ['name' => 'id72e373f8_audit_status'])
|
||||
->addIndex('channel_type', ['name' => 'id72e373f8_channel_type'])
|
||||
->addIndex('channel_code', ['name' => 'id72e373f8_channel_code'])
|
||||
->addIndex('payment_trade', ['name' => 'id72e373f8_payment_trade'])
|
||||
->addIndex('refund_status', ['name' => 'id72e373f8_refund_status'])
|
||||
->addIndex('payment_status', ['name' => 'id72e373f8_payment_status'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class PluginPaymentRefund
|
||||
* @table plugin_payment_refund
|
||||
* @return void
|
||||
*/
|
||||
private function _create_plugin_payment_refund() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'plugin_payment_refund';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-支付-退款',
|
||||
])
|
||||
->addColumn('unid','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '主账号编号'])
|
||||
->addColumn('usid','biginteger',['limit' => 20, 'default' => 0, 'null' => true, '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('used_payment','decimal',['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退回金额'])
|
||||
->addColumn('used_balance','decimal',['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '退回余额'])
|
||||
->addColumn('used_integral','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('unid', ['name' => 'icef9ec8c0_unid'])
|
||||
->addIndex('usid', ['name' => 'icef9ec8c0_usid'])
|
||||
->addIndex('code', ['name' => 'icef9ec8c0_code'])
|
||||
->addIndex('record_code', ['name' => 'icef9ec8c0_record_code'])
|
||||
->addIndex('create_time', ['name' => 'icef9ec8c0_create_time'])
|
||||
->addIndex('refund_trade', ['name' => 'icef9ec8c0_refund_trade'])
|
||||
->addIndex('refund_status', ['name' => 'icef9ec8c0_refund_status'])
|
||||
->addIndex('refund_account', ['name' => 'icef9ec8c0_refund_account'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,96 +0,0 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
@set_time_limit(0);
|
||||
@ini_set('memory_limit', -1);
|
||||
|
||||
class InstallOldTable extends Migrator {
|
||||
|
||||
/**
|
||||
* 创建数据库
|
||||
*/
|
||||
public function change() {
|
||||
$this->_create_plugin_old_user();
|
||||
$this->_create_plugin_old_user2();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class PluginOldUser
|
||||
* @table plugin_old_user
|
||||
* @return void
|
||||
*/
|
||||
private function _create_plugin_old_user() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'plugin_old_user';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '',
|
||||
])
|
||||
->addColumn('nickname','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '昵称'])
|
||||
->addColumn('phone','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '绑定手机号'])
|
||||
->addColumn('concat','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '联系方式'])
|
||||
->addColumn('remark','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '备注'])
|
||||
->addColumn('remark2','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '备注名'])
|
||||
->addColumn('create_time','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '加入时间'])
|
||||
->addColumn('role','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '会员身份'])
|
||||
->addColumn('订单数','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => ''])
|
||||
->addColumn('优惠券总数','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => ''])
|
||||
->addColumn('卡券总数','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => ''])
|
||||
->addColumn('integral','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '积分'])
|
||||
->addColumn('balance','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '余额'])
|
||||
->addColumn('总消费','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => ''])
|
||||
->addColumn('spread','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '用户推荐人'])
|
||||
->addColumn('用户标签','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => ''])
|
||||
->addColumn('所属平台(平台标识ID)','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => ''])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class PluginOldUser2
|
||||
* @table plugin_old_user2
|
||||
* @return void
|
||||
*/
|
||||
private function _create_plugin_old_user2() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'plugin_old_user2';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '',
|
||||
])
|
||||
->addColumn('所属平台','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => ''])
|
||||
->addColumn('openid','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => ''])
|
||||
->addColumn('nickname','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '昵称'])
|
||||
->addColumn('username','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '姓名'])
|
||||
->addColumn('phone','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '手机号'])
|
||||
->addColumn('create_time','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '申请时间'])
|
||||
->addColumn('审核状态','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => ''])
|
||||
->addColumn('rebate','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '累计佣金'])
|
||||
->addColumn('usable','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '可提现佣金'])
|
||||
->addColumn('订单数','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => ''])
|
||||
->addColumn('下级用户','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => ''])
|
||||
->addColumn('spread','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '推荐人'])
|
||||
->addColumn('备注信息','string',['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => ''])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,204 +0,0 @@
|
||||
<?php
|
||||
|
||||
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() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'plugin_account_auth';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-账号-授权',
|
||||
])
|
||||
->addColumn('usid','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '终端账号'])
|
||||
->addColumn('time','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '有效时间'])
|
||||
->addColumn('type','string',['limit' => 20, 'default' => '', 'null' => true, 'comment' => '授权类型'])
|
||||
->addColumn('token','string',['limit' => 32, 'default' => '', 'null' => true, 'comment' => '授权令牌'])
|
||||
->addColumn('tokenv','string',['limit' => 32, 'default' => '', 'null' => true, 'comment' => '授权验证'])
|
||||
->addColumn('create_time','datetime',['default' => NULL, 'null' => true, 'comment' => '创建时间'])
|
||||
->addColumn('update_time','datetime',['default' => NULL, 'null' => true, 'comment' => '更新时间'])
|
||||
->addIndex('usid', ['name' => 'i8a91c286f_usid'])
|
||||
->addIndex('type', ['name' => 'i8a91c286f_type'])
|
||||
->addIndex('time', ['name' => 'i8a91c286f_time'])
|
||||
->addIndex('token', ['name' => 'i8a91c286f_token'])
|
||||
->addIndex('create_time', ['name' => 'i8a91c286f_create_time'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class PluginAccountBind
|
||||
* @table plugin_account_bind
|
||||
* @return void
|
||||
*/
|
||||
private function _create_plugin_account_bind() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'plugin_account_bind';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-账号-终端',
|
||||
])
|
||||
->addColumn('unid','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '会员编号'])
|
||||
->addColumn('type','string',['limit' => 20, 'default' => '', 'null' => true, 'comment' => '终端类型'])
|
||||
->addColumn('phone','string',['limit' => 30, 'default' => '', 'null' => true, 'comment' => '绑定手机'])
|
||||
->addColumn('appid','string',['limit' => 30, 'default' => '', 'null' => true, 'comment' => 'APPID'])
|
||||
->addColumn('openid','string',['limit' => 50, 'default' => '', 'null' => true, 'comment' => 'OPENID'])
|
||||
->addColumn('unionid','string',['limit' => 50, 'default' => '', 'null' => true, 'comment' => 'UnionID'])
|
||||
->addColumn('headimg','string',['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户头像'])
|
||||
->addColumn('nickname','string',['limit' => 99, 'default' => '', 'null' => true, 'comment' => '用户昵称'])
|
||||
->addColumn('password','string',['limit' => 32, 'default' => '', 'null' => true, 'comment' => '登录密码'])
|
||||
->addColumn('extra','text',['default' => NULL, 'null' => true, 'comment' => '扩展数据'])
|
||||
->addColumn('sort','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重'])
|
||||
->addColumn('status','integer',['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '账号状态'])
|
||||
->addColumn('deleted','integer',['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)'])
|
||||
->addColumn('create_time','datetime',['default' => NULL, 'null' => true, 'comment' => '注册时间'])
|
||||
->addColumn('update_time','datetime',['default' => NULL, 'null' => true, 'comment' => '更新时间'])
|
||||
->addIndex('type', ['name' => 'i4ec9ee5c7_type'])
|
||||
->addIndex('unid', ['name' => 'i4ec9ee5c7_unid'])
|
||||
->addIndex('sort', ['name' => 'i4ec9ee5c7_sort'])
|
||||
->addIndex('phone', ['name' => 'i4ec9ee5c7_phone'])
|
||||
->addIndex('appid', ['name' => 'i4ec9ee5c7_appid'])
|
||||
->addIndex('status', ['name' => 'i4ec9ee5c7_status'])
|
||||
->addIndex('openid', ['name' => 'i4ec9ee5c7_openid'])
|
||||
->addIndex('unionid', ['name' => 'i4ec9ee5c7_unionid'])
|
||||
->addIndex('deleted', ['name' => 'i4ec9ee5c7_deleted'])
|
||||
->addIndex('create_time', ['name' => 'i4ec9ee5c7_create_time'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class PluginAccountMsms
|
||||
* @table plugin_account_msms
|
||||
* @return void
|
||||
*/
|
||||
private function _create_plugin_account_msms() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'plugin_account_msms';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-账号-短信',
|
||||
])
|
||||
->addColumn('unid','biginteger',['limit' => 20, 'default' => 0, 'null' => false, 'comment' => '账号编号'])
|
||||
->addColumn('usid','biginteger',['limit' => 20, 'default' => 0, 'null' => false, 'comment' => '终端编号'])
|
||||
->addColumn('type','string',['limit' => 100, 'default' => '', 'null' => true, 'comment' => '短信类型'])
|
||||
->addColumn('scene','string',['limit' => 100, 'default' => '', 'null' => true, 'comment' => '业务场景'])
|
||||
->addColumn('smsid','string',['limit' => 100, 'default' => '', 'null' => true, 'comment' => '消息编号'])
|
||||
->addColumn('phone','string',['limit' => 100, 'default' => '', 'null' => true, 'comment' => '目标手机'])
|
||||
->addColumn('result','string',['limit' => 512, 'default' => '', 'null' => true, 'comment' => '返回结果'])
|
||||
->addColumn('params','string',['limit' => 512, 'default' => '', 'null' => true, 'comment' => '短信内容'])
|
||||
->addColumn('status','integer',['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '短信状态(0失败,1成功)'])
|
||||
->addColumn('create_time','datetime',['default' => NULL, 'null' => true, 'comment' => '创建时间'])
|
||||
->addColumn('update_time','datetime',['default' => NULL, 'null' => true, 'comment' => '更新时间'])
|
||||
->addIndex('type', ['name' => 'i66baec398_type'])
|
||||
->addIndex('usid', ['name' => 'i66baec398_usid'])
|
||||
->addIndex('unid', ['name' => 'i66baec398_unid'])
|
||||
->addIndex('phone', ['name' => 'i66baec398_phone'])
|
||||
->addIndex('smsid', ['name' => 'i66baec398_smsid'])
|
||||
->addIndex('scene', ['name' => 'i66baec398_scene'])
|
||||
->addIndex('status', ['name' => 'i66baec398_status'])
|
||||
->addIndex('create_time', ['name' => 'i66baec398_create_time'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class PluginAccountUser
|
||||
* @table plugin_account_user
|
||||
* @return void
|
||||
*/
|
||||
private function _create_plugin_account_user() {
|
||||
|
||||
// 当前数据表
|
||||
$table = 'plugin_account_user';
|
||||
|
||||
// 存在则跳过
|
||||
if ($this->hasTable($table)) return;
|
||||
|
||||
// 创建数据表
|
||||
$this->table($table, [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '插件-账号-资料',
|
||||
])
|
||||
->addColumn('code','string',['limit' => 16, 'default' => '', 'null' => true, 'comment' => '用户编号'])
|
||||
->addColumn('phone','string',['limit' => 20, 'default' => '', 'null' => true, 'comment' => '用户手机'])
|
||||
->addColumn('email','string',['limit' => 99, 'default' => '', 'null' => true, 'comment' => '用户邮箱'])
|
||||
->addColumn('unionid','string',['limit' => 50, 'default' => '', 'null' => true, 'comment' => 'UnionID'])
|
||||
->addColumn('username','string',['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户姓名'])
|
||||
->addColumn('nickname','string',['limit' => 99, 'default' => '', 'null' => true, 'comment' => '用户昵称'])
|
||||
->addColumn('password','string',['limit' => 32, 'default' => '', 'null' => true, 'comment' => '认证密码'])
|
||||
->addColumn('headimg','string',['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户头像'])
|
||||
->addColumn('region_prov','string',['limit' => 99, 'default' => '', 'null' => true, 'comment' => '所在省份'])
|
||||
->addColumn('region_city','string',['limit' => 99, 'default' => '', 'null' => true, 'comment' => '所在城市'])
|
||||
->addColumn('region_area','string',['limit' => 99, 'default' => '', 'null' => true, 'comment' => '所在区域'])
|
||||
->addColumn('remark','string',['limit' => 500, 'default' => '', 'null' => true, 'comment' => '备注(内部使用)'])
|
||||
->addColumn('extra','text',['default' => NULL, 'null' => true, 'comment' => '扩展数据'])
|
||||
->addColumn('sort','biginteger',['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重'])
|
||||
->addColumn('status','integer',['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '用户状态(0拉黑,1正常)'])
|
||||
->addColumn('deleted','integer',['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删,1已删)'])
|
||||
->addColumn('create_time','datetime',['default' => NULL, 'null' => true, 'comment' => '注册时间'])
|
||||
->addColumn('update_time','datetime',['default' => NULL, 'null' => true, 'comment' => '更新时间'])
|
||||
->addIndex('code', ['name' => 'iddb76b051_code'])
|
||||
->addIndex('sort', ['name' => 'iddb76b051_sort'])
|
||||
->addIndex('phone', ['name' => 'iddb76b051_phone'])
|
||||
->addIndex('email', ['name' => 'iddb76b051_email'])
|
||||
->addIndex('status', ['name' => 'iddb76b051_status'])
|
||||
->addIndex('unionid', ['name' => 'iddb76b051_unionid'])
|
||||
->addIndex('deleted', ['name' => 'iddb76b051_deleted'])
|
||||
->addIndex('username', ['name' => 'iddb76b051_username'])
|
||||
->addIndex('nickname', ['name' => 'iddb76b051_nickname'])
|
||||
->addIndex('region_prov', ['name' => 'iddb76b051_region_prov'])
|
||||
->addIndex('region_city', ['name' => 'iddb76b051_region_city'])
|
||||
->addIndex('region_area', ['name' => 'iddb76b051_region_area'])
|
||||
->addIndex('create_time', ['name' => 'iddb76b051_create_time'])
|
||||
->create();
|
||||
|
||||
// 修改主键长度
|
||||
$this->table($table)->changeColumn('id', 'integer', ['limit' => 11, 'identity' => true]);
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
334
database/migrations/20009999999993_install_wechat_table.php
Normal file
334
database/migrations/20009999999993_install_wechat_table.php
Normal file
@ -0,0 +1,334 @@
|
||||
<?php
|
||||
|
||||
use think\admin\extend\PhinxExtend;
|
||||
use think\migration\Migrator;
|
||||
|
||||
@set_time_limit(0);
|
||||
@ini_set('memory_limit', -1);
|
||||
|
||||
class InstallWechatTable extends Migrator
|
||||
{
|
||||
|
||||
/**
|
||||
* 创建数据库
|
||||
*/
|
||||
public function change()
|
||||
{
|
||||
$this->_create_wechat_auth();
|
||||
$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 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
|
||||
* @table wechat_auto
|
||||
* @return void
|
||||
*/
|
||||
private function _create_wechat_auto()
|
||||
{
|
||||
// 创建更新数据表
|
||||
PhinxExtend::upgrade($this->table('wechat_auto', [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-回复',
|
||||
]), [
|
||||
['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' => '消息编号']],
|
||||
['appid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '公众号APPID']],
|
||||
['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '文本内容']],
|
||||
['image_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '图片链接']],
|
||||
['voice_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '语音链接']],
|
||||
['music_title', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '音乐标题']],
|
||||
['music_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '音乐链接']],
|
||||
['music_image', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '缩略图片']],
|
||||
['music_desc', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '音乐描述']],
|
||||
['video_title', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '视频标题']],
|
||||
['video_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '视频URL']],
|
||||
['video_desc', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '视频描述']],
|
||||
['news_id', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '图文ID']],
|
||||
['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '状态(0禁用,1启用)']],
|
||||
['create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '创建人']],
|
||||
['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']],
|
||||
], [
|
||||
'code', 'type', 'time', 'appid', 'status',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class WechatFans
|
||||
* @table wechat_fans
|
||||
* @return void
|
||||
*/
|
||||
private function _create_wechat_fans()
|
||||
{
|
||||
// 创建更新数据表
|
||||
PhinxExtend::upgrade($this->table('wechat_fans', [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-粉丝',
|
||||
]), [
|
||||
['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']],
|
||||
['tagid_list', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '粉丝标签id']],
|
||||
['is_black', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '是否为黑名单状态']],
|
||||
['subscribe', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '关注状态(0未关注,1已关注)']],
|
||||
['nickname', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '用户昵称']],
|
||||
['sex', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '用户性别(1男性,2女性,0未知)']],
|
||||
['country', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户所在国家']],
|
||||
['province', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户所在省份']],
|
||||
['city', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户所在城市']],
|
||||
['language', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户的语言(zh_CN)']],
|
||||
['headimgurl', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '用户头像']],
|
||||
['subscribe_time', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '关注时间']],
|
||||
['subscribe_at', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '关注时间']],
|
||||
['remark', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '备注']],
|
||||
['subscribe_scene', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '扫码关注场景']],
|
||||
['qr_scene', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '二维码场景值']],
|
||||
['qr_scene_str', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '二维码场景内容']],
|
||||
['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']],
|
||||
], [
|
||||
'appid', 'openid', 'unionid', 'is_black', 'subscribe',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class WechatFansTags
|
||||
* @table wechat_fans_tags
|
||||
* @return void
|
||||
*/
|
||||
private function _create_wechat_fans_tags()
|
||||
{
|
||||
// 创建更新数据表
|
||||
PhinxExtend::upgrade($this->table('wechat_fans_tags', [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-标签',
|
||||
]), [
|
||||
['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',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class WechatKeys
|
||||
* @table wechat_keys
|
||||
* @return void
|
||||
*/
|
||||
private function _create_wechat_keys()
|
||||
{
|
||||
// 创建更新数据表
|
||||
PhinxExtend::upgrade($this->table('wechat_keys', [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-规则',
|
||||
]), [
|
||||
['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' => '关键字']],
|
||||
['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '文本内容']],
|
||||
['image_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '图片链接']],
|
||||
['voice_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '语音链接']],
|
||||
['music_title', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '音乐标题']],
|
||||
['music_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '音乐链接']],
|
||||
['music_image', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '缩略图片']],
|
||||
['music_desc', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '音乐描述']],
|
||||
['video_title', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '视频标题']],
|
||||
['video_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '视频URL']],
|
||||
['video_desc', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '视频描述']],
|
||||
['news_id', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '图文ID']],
|
||||
['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序字段']],
|
||||
['status', 'integer', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '状态(0禁用,1启用)']],
|
||||
['create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '创建人']],
|
||||
['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']],
|
||||
], [
|
||||
'type', 'keys', 'sort', 'appid', 'status',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class WechatMedia
|
||||
* @table wechat_media
|
||||
* @return void
|
||||
*/
|
||||
private function _create_wechat_media()
|
||||
{
|
||||
// 创建更新数据表
|
||||
PhinxExtend::upgrade($this->table('wechat_media', [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-素材',
|
||||
]), [
|
||||
['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']],
|
||||
['media_id', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '永久素材MediaID']],
|
||||
['local_url', 'string', ['limit' => 300, 'default' => '', 'null' => true, 'comment' => '本地文件链接']],
|
||||
['media_url', 'string', ['limit' => 300, 'default' => '', 'null' => true, 'comment' => '远程图片链接']],
|
||||
['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']],
|
||||
], [
|
||||
'md5', 'type', 'appid', 'media_id',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class WechatNews
|
||||
* @table wechat_news
|
||||
* @return void
|
||||
*/
|
||||
private function _create_wechat_news()
|
||||
{
|
||||
// 创建更新数据表
|
||||
PhinxExtend::upgrade($this->table('wechat_news', [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-图文',
|
||||
]), [
|
||||
['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(用英文逗号做分割)']],
|
||||
['is_deleted', 'integer', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除状态(0未删除,1已删除)']],
|
||||
['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']],
|
||||
['create_by', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '创建人']],
|
||||
], [
|
||||
'media_id', 'article_id',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class WechatNewsArticle
|
||||
* @table wechat_news_article
|
||||
* @return void
|
||||
*/
|
||||
private function _create_wechat_news_article()
|
||||
{
|
||||
// 创建更新数据表
|
||||
PhinxExtend::upgrade($this->table('wechat_news_article', [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-文章',
|
||||
]), [
|
||||
['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显示)']],
|
||||
['author', 'string', ['limit' => 20, 'default' => '', 'null' => true, 'comment' => '文章作者']],
|
||||
['digest', 'string', ['limit' => 300, 'default' => '', 'null' => true, 'comment' => '摘要内容']],
|
||||
['content', 'text', ['default' => NULL, 'null' => true, 'comment' => '图文内容']],
|
||||
['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' => '创建时间']],
|
||||
], [
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class WechatPaymentRecord
|
||||
* @table wechat_payment_record
|
||||
* @return void
|
||||
*/
|
||||
private function _create_wechat_payment_record()
|
||||
{
|
||||
// 创建更新数据表
|
||||
PhinxExtend::upgrade($this->table('wechat_payment_record', [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-支付-行为',
|
||||
]), [
|
||||
['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']],
|
||||
['openid', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '用户OPENID']],
|
||||
['order_code', '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' => '原订单金额']],
|
||||
['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_bank', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '支付银行类型']],
|
||||
['payment_notify', 'text', ['default' => NULL, 'null' => true, 'comment' => '支付结果通知']],
|
||||
['payment_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' => '退款金额']],
|
||||
['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']],
|
||||
['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']],
|
||||
], [
|
||||
'type', 'code', 'appid', 'openid', 'order_code', 'create_time', 'payment_trade', 'payment_status',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据对象
|
||||
* @class WechatPaymentRefund
|
||||
* @table wechat_payment_refund
|
||||
* @return void
|
||||
*/
|
||||
private function _create_wechat_payment_refund()
|
||||
{
|
||||
// 创建更新数据表
|
||||
PhinxExtend::upgrade($this->table('wechat_payment_refund', [
|
||||
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', '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' => '退款交易通知']],
|
||||
['create_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '创建时间']],
|
||||
['update_time', 'datetime', ['default' => NULL, 'null' => true, 'comment' => '更新时间']],
|
||||
], [
|
||||
'code', 'record_code', 'create_time', 'refund_trade', 'refund_status',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
288
database/migrations/20009999999994_install_system_table.php
Normal file
288
database/migrations/20009999999994_install_system_table.php
Normal file
@ -0,0 +1,288 @@
|
||||
<?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',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
817
database/migrations/20009999999995_install_wuma_table.php
Normal file
817
database/migrations/20009999999995_install_wuma_table.php
Normal file
@ -0,0 +1,817 @@
|
||||
<?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',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
1205
database/migrations/20009999999996_install_wemall_table.php
Normal file
1205
database/migrations/20009999999996_install_wemall_table.php
Normal file
File diff suppressed because it is too large
Load Diff
231
database/migrations/20009999999997_install_payment_table.php
Normal file
231
database/migrations/20009999999997_install_payment_table.php
Normal file
@ -0,0 +1,231 @@
|
||||
<?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',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
142
database/migrations/20009999999998_install_account_table.php
Normal file
142
database/migrations/20009999999998_install_account_table.php
Normal file
@ -0,0 +1,142 @@
|
||||
<?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',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -20,7 +20,6 @@ class InstallPackage extends Migrator
|
||||
/**
|
||||
* 数据库初始化
|
||||
* @return void
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
public function change()
|
||||
{
|
||||
@ -33,7 +32,6 @@ class InstallPackage extends Migrator
|
||||
/**
|
||||
* 安装扩展数据
|
||||
* @return void
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
private function inserData()
|
||||
{
|
||||
Loading…
x
Reference in New Issue
Block a user