_create_channel_account(); $this->_create_channel_card(); $this->_create_channel_card_group(); $this->_create_channel_kami(); $this->_create_channel_list(); $this->_create_channel_percent(); $this->_create_channel_product(); $this->_create_channel_product_mappingid(); $this->_create_channel_shop(); } /** * 创建数据对象 * @class ChannelAccount * @table channel_account * @return void */ private function _create_channel_account() { // 创建数据表对象 $table = $this->table('channel_account', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户-充值-日志', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['day', 'string', ['limit' => 50, 'default' => NULL, 'null' => true, 'comment' => '日期']], ['cid', 'biginteger', ['default' => NULL, 'null' => true, 'comment' => '渠道id']], ['num', 'string', ['limit' => 50, 'default' => '0', 'null' => true, 'comment' => '成功金额']], ['add', 'string', ['limit' => 50, 'default' => '0', 'null' => false, 'comment' => '当日加款']], ['hui', 'string', ['limit' => 50, 'default' => '0', 'null' => false, 'comment' => '截止23时待回款']], ['yue', 'string', ['limit' => 50, 'default' => '0', 'null' => false, 'comment' => '截止23时余额']], ['dong', 'string', ['limit' => 50, 'default' => '0', 'null' => false, 'comment' => '冻结额度']], ['zhang', 'string', ['limit' => 50, 'default' => '0', 'null' => false, 'comment' => '']], ['desc', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], ], [ 'day', 'cid', ], false); } /** * 创建数据对象 * @class ChannelCard * @table channel_card * @return void */ private function _create_channel_card() { // 创建数据表对象 $table = $this->table('channel_card', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '卡密表', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['cnum', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '卡号']], ['cpwd', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '密码']], ['value', 'integer', ['default' => '0', 'null' => false, 'comment' => '面值']], ['use', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '使用状态1可用2下单中3下单成功4下单失败5充值成功6渠道充值失败7卡密充值失败']], ['chongzhi_use', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '']], ['use_num', 'integer', ['default' => '0', 'null' => false, 'comment' => '使用次数']], ['use_mid', 'integer', ['default' => '-1', 'null' => false, 'comment' => '分配的商户']], ['use_info', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '充值说明']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '状态1可用0禁用']], ['group_id', 'integer', ['default' => NULL, 'null' => false, 'comment' => '批次']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ], [ 'cnum', 'cpwd', ], false); } /** * 创建数据对象 * @class ChannelCardGroup * @table channel_card_group * @return void */ private function _create_channel_card_group() { // 创建数据表对象 $table = $this->table('channel_card_group', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '卡密表分组', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['name', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '名称']], ['reorder', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '密码']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '状态1可用0禁用']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ], [ 'name', 'reorder', ], false); } /** * 创建数据对象 * @class ChannelKami * @table channel_kami * @return void */ private function _create_channel_kami() { // 创建数据表对象 $table = $this->table('channel_kami', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '卡密表', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['cnum', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '卡号']], ['cpwd', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '密码']], ['value', 'integer', ['default' => '0', 'null' => false, 'comment' => '面值']], ['use', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '使用状态1可用2下单中3下单成功4下单失败5充值成功6渠道充值失败7卡密充值失败']], ['use_mid', 'integer', ['default' => '-1', 'null' => false, 'comment' => '分配的商户']], ['use_info', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '充值说明']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '状态1可用0禁用']], ['kami_group_id', 'integer', ['default' => NULL, 'null' => false, 'comment' => '批次']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ['expire_time', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '过期时间']], ], [ 'cnum', 'cpwd', ], false); } /** * 创建数据对象 * @class ChannelList * @table channel_list * @return void */ private function _create_channel_list() { // 创建数据表对象 $table = $this->table('channel_list', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '渠道', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['name', 'string', ['limit' => 50, 'default' => '', 'null' => true, 'comment' => '渠道名称']], ['key', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '渠道关键词']], ['order_limit', 'integer', ['default' => '0', 'null' => false, 'comment' => '每分钟请求次数']], ['system_id', 'integer', ['default' => '0', 'null' => false, 'comment' => '系统id']], ['contacts', 'string', ['limit' => 50, 'default' => NULL, 'null' => true, 'comment' => '联系人']], ['phone', 'string', ['limit' => 50, 'default' => NULL, 'null' => true, 'comment' => '联系电话']], ['percent', 'decimal', ['precision' => 10, 'scale' => 0, 'default' => '0', 'null' => true, 'comment' => '渠道分成']], ['mid', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '商户id']], ['token', 'string', ['limit' => 8000, 'default' => NULL, 'null' => true, 'comment' => '商户token']], ['host', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '接口主机域名']], ['notify_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '回调地址']], ['describe', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '渠道备注']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '状态(0禁用,1启用)']], ['ip_white', 'string', ['limit' => 255, 'default' => '', 'null' => false, 'comment' => 'ip白名单']], ['sort', 'biginteger', ['default' => '0', 'null' => true, 'comment' => '排序权重']], ['is_deleted', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '删除(1删除,0未删)']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], ['channel_num', 'string', ['limit' => 100, 'default' => '', 'null' => false, 'comment' => '渠道编号']], ['query_status', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => false, 'comment' => '是否支持查询,0不支持,1支持,2主动查询']], ['cancel_status', 'tinyinteger', ['default' => '0', 'null' => false, 'comment' => '是否支持退单,0不支持,1支持']], ['suoka_status', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => false, 'comment' => '是否支持锁卡,0不支持,1api锁卡,2爬虫锁卡']], ['other_data', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '其他数据,以json格式储存']], ], [ 'name', 'status', 'is_deleted', ], false); } /** * 创建数据对象 * @class ChannelPercent * @table channel_percent * @return void */ private function _create_channel_percent() { // 创建数据表对象 $table = $this->table('channel_percent', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '渠道-商品', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['cid', 'biginteger', ['default' => '0', 'null' => true, 'comment' => '所属渠道']], ['pid', 'integer', ['default' => NULL, 'null' => true, 'comment' => '产品id']], ['percent_type', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '分成类型1折扣,2固定数值']], ['percent', 'decimal', ['precision' => 10, 'scale' => 4, 'default' => NULL, 'null' => true, 'comment' => '渠道分成']], ['rule', 'string', ['limit' => 2000, 'default' => NULL, 'null' => true, 'comment' => '分面值规则']], ['gid', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '默认产品id']], ['gid_rule', 'string', ['limit' => 2000, 'default' => NULL, 'null' => true, 'comment' => '按面值产品id']], ['order_limit', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '每分钟订单数']], ['order_limit_rule', 'string', ['limit' => 2000, 'default' => NULL, 'null' => true, 'comment' => '分面值每分钟订单数']], ['isp_rule', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '']], ['status', 'tinyinteger', ['limit' => 4, 'default' => 1, 'null' => true, 'comment' => '使用状态']], ['is_deleted', 'tinyinteger', ['limit' => 4, 'default' => 0, 'null' => true, 'comment' => '删除状态']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], ], [ 'pid', ], false); } /** * 创建数据对象 * @class ChannelProduct * @table channel_product * @return void */ private function _create_channel_product() { // 创建数据表对象 $table = $this->table('channel_product', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '渠道-商品', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['cid', 'biginteger', ['default' => '0', 'null' => true, 'comment' => '所属渠道']], ['service_id', 'integer', ['default' => '0', 'null' => false, 'comment' => '业务ID,service_info的id']], ['percent_type', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '分成类型1折扣,2固定数值']], ['percent', 'decimal', ['precision' => 10, 'scale' => 4, 'default' => '0.0000', 'null' => false, 'comment' => '分成']], ['shop_id', 'integer', ['default' => NULL, 'null' => true, 'comment' => '']], ['name', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '商品名称']], ['key', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '拼音KEY']], ['remark', 'string', ['limit' => 999, 'default' => NULL, 'null' => true, 'comment' => '商品描述']], ['opentime', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '开放时间可以是区间值']], ['value', 'string', ['limit' => 800, 'default' => '0', 'null' => false, 'comment' => '面值,多个逗号隔开']], ['auto_value', 'string', ['limit' => 800, 'default' => '0', 'null' => false, 'comment' => '自动切换渠道的面额']], ['limit_order', 'integer', ['default' => '0', 'null' => false, 'comment' => '同时限制处理订单数']], ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], ['rule', 'string', ['limit' => 5000, 'default' => NULL, 'null' => true, 'comment' => '分面值规则']], ['gid', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '默认产品id']], ['gid_rule', 'string', ['limit' => 5000, 'default' => NULL, 'null' => true, 'comment' => '按面值产品id']], ['order_limit', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '每分钟订单数']], ['order_limit_rule', 'string', ['limit' => 2000, 'default' => NULL, 'null' => true, 'comment' => '分面值每分钟订单数']], ['status', 'tinyinteger', ['limit' => 4, 'default' => 1, 'null' => true, 'comment' => '使用状态']], ['is_deleted', 'tinyinteger', ['limit' => 4, 'default' => 0, 'null' => true, 'comment' => '删除状态']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], ], [ 'sort', 'status', 'is_deleted', ], false); } /** * 创建数据对象 * @class ChannelProductMappingid * @table channel_product_mappingid * @return void */ private function _create_channel_product_mappingid() { // 创建数据表对象 $table = $this->table('channel_product_mappingid', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '渠道-商品映射id', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['cid', 'biginteger', ['default' => '0', 'null' => true, 'comment' => '所属渠道']], ['mapping_id', 'integer', ['default' => NULL, 'null' => true, 'comment' => '映射id']], ['name', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '商品名称']], ['key', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '拼音KEY']], ['value', 'string', ['limit' => 800, 'default' => '0', 'null' => false, 'comment' => '面值,多个逗号隔开']], ['status', 'tinyinteger', ['limit' => 4, 'default' => 1, 'null' => true, 'comment' => '使用状态']], ['is_deleted', 'tinyinteger', ['limit' => 4, 'default' => 0, 'null' => true, 'comment' => '删除状态']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], ], [ 'status', 'is_deleted', ], false); } /** * 创建数据对象 * @class ChannelShop * @table channel_shop * @return void */ private function _create_channel_shop() { // 创建数据表对象 $table = $this->table('channel_shop', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['cid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '渠道id']], ['name', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '']], ['shop_id', 'string', ['limit' => 11, 'default' => NULL, 'null' => true, 'comment' => '']], ['value', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '面值,暂时没用']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '']], ['is_deleted', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => false, 'comment' => '']], ], [ ], false); } }