_create_merchant_account(); $this->_create_merchant_account_log(); $this->_create_merchant_account_log_history(); $this->_create_merchant_bee_task(); $this->_create_merchant_card(); $this->_create_merchant_card_mobile(); $this->_create_merchant_channel_repeat(); $this->_create_merchant_day(); $this->_create_merchant_dong_log(); $this->_create_merchant_list(); $this->_create_merchant_mapping_product(); $this->_create_merchant_order(); $this->_create_merchant_order_aftersales(); $this->_create_merchant_order_auto_error(); $this->_create_merchant_order_history(); $this->_create_merchant_order_history_aftersales(); $this->_create_merchant_order_history_kami91(); $this->_create_merchant_order_kami91(); $this->_create_merchant_order_last_history(); $this->_create_merchant_order_lastweek_history(); $this->_create_merchant_order_two_history(); $this->_create_merchant_percent(); $this->_create_merchant_product(); $this->_create_merchant_project(); $this->_create_merchant_project_percent(); $this->_create_merchant_project_product(); $this->_create_merchant_qianmi_apply(); $this->_create_merchant_qianmi_order(); $this->_create_merchant_rebate(); $this->_create_merchant_relation(); $this->_create_merchant_system_auth(); $this->_create_merchant_system_auth_node(); $this->_create_merchant_system_config(); $this->_create_merchant_system_data(); $this->_create_merchant_system_menu(); $this->_create_merchant_system_oplog(); $this->_create_merchant_system_queue(); $this->_create_merchant_system_user(); } /** * 创建数据对象 * @class MerchantAccount * @table merchant_account * @return void */ private function _create_merchant_account() { // 创建数据表对象 $table = $this->table('merchant_account', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户-充值-日志', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['day', 'string', ['limit' => 50, 'default' => NULL, 'null' => true, 'comment' => '日期']], ['mid', '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' => '冻结额度']], ['desc', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], ], [ 'day', 'mid', ], false); } /** * 创建数据对象 * @class MerchantAccountLog * @table merchant_account_log * @return void */ private function _create_merchant_account_log() { // 创建数据表对象 $table = $this->table('merchant_account_log', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户-充值-日志', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['type', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '1 => \'后台充值\', 2 => \'后台减少\', 3 => \'API使用\'']], ['oper', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '1增加2减少']], ['is_type', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '1充值;2授信']], ['account_type', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '账户类型1余额账户2授信账户']], ['mid', 'biginteger', ['default' => NULL, 'null' => true, 'comment' => '商户id']], ['num', 'decimal', ['precision' => 60, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '充值金额']], ['yue', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => '0.00', 'null' => false, 'comment' => '当前余额']], ['qian_yue', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => '0.00', 'null' => false, 'comment' => '变动前余额']], ['is_yue', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '是否计入余额1计入2不计入']], ['order_id', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '订单id']], ['order_date', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '订单下单时间']], ['product_cash', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => '0.00', 'null' => false, 'comment' => '所使用的产品分成计算后的价格']], ['profit', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => '0.00', 'null' => false, 'comment' => '']], ['pid', 'integer', ['default' => '0', 'null' => false, 'comment' => '产品id']], ['desc', 'text', ['default' => NULL, 'null' => true, 'comment' => '充值说明']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], ], [ 'pid', 'mid', 'mid', 'oper', 'type', 'is_yue', 'order_id', 'account_type', ], false); } /** * 创建数据对象 * @class MerchantAccountLogHistory * @table merchant_account_log_history * @return void */ private function _create_merchant_account_log_history() { // 创建数据表对象 $table = $this->table('merchant_account_log_history', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户-充值-日志', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['type', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '1,授信 2,充值 3,API']], ['oper', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '1增加2减少']], ['is_type', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '1充值;2授信']], ['account_type', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '账户类型1充值、2授信']], ['mid', 'biginteger', ['default' => NULL, 'null' => true, 'comment' => '商户id']], ['num', 'decimal', ['precision' => 60, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '充值金额']], ['yue', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => '0.00', 'null' => false, 'comment' => '当前余额']], ['qian_yue', 'decimal', ['precision' => 30, 'scale' => 2, 'default' => NULL, 'null' => true, 'comment' => '变动前余额']], ['is_yue', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '是否计入余额1计入2不计入']], ['order_id', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '订单id']], ['order_date', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '订单下单时间']], ['product_cash', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => '0.00', 'null' => false, 'comment' => '所使用的产品分成计算后的价格']], ['profit', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => '0.00', 'null' => false, 'comment' => '本单利润']], ['pid', 'integer', ['default' => '0', 'null' => false, 'comment' => '产品id']], ['desc', 'text', ['default' => NULL, 'null' => true, 'comment' => '充值说明']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], ], [ ], false); } /** * 创建数据对象 * @class MerchantBeeTask * @table merchant_bee_task * @return void */ private function _create_merchant_bee_task() { // 创建数据表对象 $table = $this->table('merchant_bee_task', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['mid', 'integer', ['default' => '0', 'null' => false, 'comment' => '商户id']], ['vender_id', 'integer', ['default' => '0', 'null' => false, 'comment' => '渠道id']], ['amount', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '面值']], ['operator_id', 'string', ['limit' => 100, 'default' => '移动,电信,联通', 'null' => false, 'comment' => '运营商']], ['order_num', 'integer', ['default' => '1', 'null' => false, 'comment' => '查询条数']], ['prov_code', 'text', ['default' => NULL, 'null' => true, 'comment' => '区域']], ['times', 'integer', ['default' => '5', 'null' => false, 'comment' => '时间间隔分钟']], ['lasttimes', 'biginteger', ['default' => '0', 'null' => false, 'comment' => '']], ], [ ], false); } /** * 创建数据对象 * @class MerchantCard * @table merchant_card * @return void */ private function _create_merchant_card() { // 创建数据表对象 $table = $this->table('merchant_card', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户使用卡密记录表', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['card_id', 'integer', ['default' => NULL, 'null' => false, 'comment' => '']], ['mid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '']], ['order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => false, 'comment' => '系统订单号']], ['card', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '油卡卡号']], ['cash', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '油卡面额']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '使用状态1可用2下单中3下单成功4下单失败5充值成功6渠道充值失败7卡密充值失败']], ['info', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '充值说明']], ['msg', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ], [ 'mid', 'card_id', 'order_id', ], false); } /** * 创建数据对象 * @class MerchantCardMobile * @table merchant_card_mobile * @return void */ private function _create_merchant_card_mobile() { // 创建数据表对象 $table = $this->table('merchant_card_mobile', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户使用卡密记录表', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['card', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '油卡卡号']], ['mobile', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '手机号']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ], [ 'card', ], false); } /** * 创建数据对象 * @class MerchantChannelRepeat * @table merchant_channel_repeat * @return void */ private function _create_merchant_channel_repeat() { // 创建数据表对象 $table = $this->table('merchant_channel_repeat', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['mid', 'integer', ['default' => '0', 'null' => false, 'comment' => '商户id']], ['vender_id', 'integer', ['default' => '0', 'null' => false, 'comment' => '渠道id']], ['amount', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '面值']], ['operator_id', 'string', ['limit' => 100, 'default' => '移动,电信,联通', 'null' => false, 'comment' => '运营商']], ['order_num', 'integer', ['default' => '1', 'null' => false, 'comment' => '查询条数']], ['prov_code', 'text', ['default' => NULL, 'null' => true, 'comment' => '区域']], ['times', 'integer', ['default' => '5', 'null' => false, 'comment' => '时间间隔分钟']], ['lasttimes', 'biginteger', ['default' => '0', 'null' => false, 'comment' => '']], ], [ ], false); } /** * 创建数据对象 * @class MerchantDay * @table merchant_day * @return void */ private function _create_merchant_day() { // 创建数据表对象 $table = $this->table('merchant_day', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['mid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '']], ['day', 'integer', ['default' => NULL, 'null' => false, 'comment' => '']], ['account_surplus', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => ' 账户余额']], ['account_add', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => false, 'comment' => '当日加款']], ['account_des', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => false, 'comment' => '当日退款']], ['account_consum', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => false, 'comment' => '当日消费']], ['credit_surplus', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => false, 'comment' => '授信余额']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '1未结算2已结算']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ], [ 'mid', 'day', ], false); } /** * 创建数据对象 * @class MerchantDongLog * @table merchant_dong_log * @return void */ private function _create_merchant_dong_log() { // 创建数据表对象 $table = $this->table('merchant_dong_log', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户-充值-日志', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['day', 'string', ['limit' => 50, 'default' => NULL, 'null' => true, 'comment' => '日期']], ['mid', 'biginteger', ['default' => NULL, 'null' => true, 'comment' => '商户id']], ['num', 'string', ['limit' => 50, 'default' => '0', 'null' => true, 'comment' => '成功金额']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], ], [ 'day', 'mid', ], false); } /** * 创建数据对象 * @class MerchantList * @table merchant_list * @return void */ private function _create_merchant_list() { // 创建数据表对象 $table = $this->table('merchant_list', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['name', 'string', ['limit' => 50, 'default' => NULL, 'null' => true, 'comment' => '商户名称']], ['username', 'string', ['limit' => 50, 'default' => NULL, 'null' => true, 'comment' => '商户后台登陆账号']], ['password', 'string', ['limit' => 32, 'default' => NULL, 'null' => true, 'comment' => '登陆密码']], ['agentId', 'string', ['limit' => 20, 'default' => NULL, 'null' => true, 'comment' => '代理商ID']], ['agentkey', 'string', ['limit' => 50, 'default' => NULL, 'null' => true, 'comment' => '代理商KEY']], ['show_pwd', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '']], ['headimg', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '头像地址']], ['authorize', 'string', ['limit' => 255, 'default' => '2', 'null' => true, 'comment' => '权限授权-默认给商户查询后台权限']], ['contacts', 'string', ['limit' => 50, 'default' => NULL, 'null' => true, 'comment' => '联系人']], ['phone', 'string', ['limit' => 50, 'default' => NULL, 'null' => true, 'comment' => '联系电话']], ['percent', 'decimal', ['precision' => 10, 'scale' => 4, 'default' => '0.0000', 'null' => true, 'comment' => '渠道分成%']], ['account_total', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '累计充值']], ['account_surplus', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '账户余额']], ['account_baitiao', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => false, 'comment' => '余额白条额度']], ['account_consum', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '累计消费']], ['credit_total', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => false, 'comment' => '授信额度']], ['credit_surplus', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => false, 'comment' => '授信账户当前余额']], ['credit_consum', 'decimal', ['precision' => 20, 'scale' => 2, 'default' => '0.00', 'null' => false, 'comment' => '授信账户消费余额']], ['appid', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => 'AppID']], ['appsecret', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => 'AppKey']], ['api_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '接口地址']], ['notify_url', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '回调地址']], ['notify_type', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '1post2postjson3get4getjson5自定义回调方式']], ['merchant_type', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '1标准2自营3京东4苏宁5快手6抖音7蜜蜂汇云8天猫游戏直充9淘宝直充']], ['kami_status', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => false, 'comment' => '是否支持卡密提货功能1支持0不开通']], ['describe', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '商户备注']], ['login_ip', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '登录地址']], ['login_at', 'string', ['limit' => 20, 'default' => NULL, 'null' => true, 'comment' => '登录时间']], ['login_num', 'biginteger', ['default' => '0', 'null' => true, 'comment' => '登录次数']], ['cids', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户使用的渠道列表']], ['auto', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '自动切换渠道,1为不切换,2为切换']], ['order_auto', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '下单失败是否自动切换渠道']], ['callback_auto', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '渠道回调如果失败自动切换1不切换2切换']], ['callback_repeat', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '二次回调返销1不处理2开启']], ['order_handle_num', 'integer', ['default' => '0', 'null' => false, 'comment' => '检测当前的处理单数,如果超过多少单,就自动切换到另外一个渠道']], ['stop', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '']], ['callback_fc', 'string', ['limit' => 11, 'default' => '0', 'null' => false, 'comment' => '']], ['callback_fc_time', 'integer', ['default' => '0', 'null' => false, 'comment' => '']], ['opentime', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '维护时间']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '状态(0禁用,1启用)']], ['other_status', 'tinyinteger', ['default' => '1', 'null' => true, 'comment' => '其他特殊状态(0禁用,1启用) ']], ['refresh_token', 'text', ['default' => NULL, 'null' => true, 'comment' => 'refresh_token存储']], ['access_token', 'text', ['default' => NULL, 'null' => true, 'comment' => 'access_token存储']], ['other_key', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '更多KEY值']], ['sub_code', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '子code']], ['access_token_time', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '获取时间']], ['other_param', 'text', ['default' => NULL, 'null' => true, 'comment' => '其他参数值,json存储']], ['ip_white', 'string', ['limit' => 255, 'default' => '', 'null' => false, 'comment' => 'ip白名单']], ['api_version', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '版本号']], ['cancel_support', 'tinyinteger', ['default' => '0', 'null' => false, 'comment' => '是否支持取消']], ['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' => '创建时间']], ], [ 'appid', 'status', 'username', 'is_deleted', ], false); } /** * 创建数据对象 * @class MerchantMappingProduct * @table merchant_mapping_product * @return void */ private function _create_merchant_mapping_product() { // 创建数据表对象 $table = $this->table('merchant_mapping_product', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户产品设置表', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['mid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '']], ['proid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '产品id']], ['mapping_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '映射id']], ['product_key', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '产品key']], ['sort', 'integer', ['default' => '1', 'null' => false, 'comment' => '优先级,数字越大优先级越高']], ['cash', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '可用面值,多个用逗号隔开']], ['status', 'integer', ['default' => '1', 'null' => false, 'comment' => '']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ], [ 'mid', 'mid', 'sort', 'proid', 'product_key', ], false); } /** * 创建数据对象 * @class MerchantOrder * @table merchant_order * @return void */ private function _create_merchant_order() { // 创建数据表对象 $table = $this->table('merchant_order', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['mid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '商户id']], ['cid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '渠道id']], ['pid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '产品id']], ['product_key', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '商品key']], ['project_id', 'integer', ['default' => '0', 'null' => false, 'comment' => '商户项目id(通道)']], ['cash', 'float', ['default' => NULL, 'null' => false, 'comment' => '付的金额']], ['actual_cash', 'float', ['default' => '0', 'null' => false, 'comment' => '实际扣费']], ['product_cash', 'float', ['default' => '0', 'null' => false, 'comment' => '使用的渠道产品实际支付的价格']], ['account_type', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '账户类型1余额账户2授信账户']], ['url', 'string', ['limit' => 300, 'default' => NULL, 'null' => false, 'comment' => '请求地址']], ['account', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '账户:卡号或者手机号']], ['isp', 'integer', ['default' => '-1', 'null' => false, 'comment' => '移动运营商1移动2联通3电信4其他']], ['order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '本站订单id']], ['num', 'integer', ['default' => '0', 'null' => false, 'comment' => '复冲次数']], ['parent_order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '']], ['channel_order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '渠道订单id,一般为请求后生成']], ['merchant_order_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户订单id']], ['platform_order_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '平台订单id']], ['param', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户请求的数据,json格式']], ['order_type', 'integer', ['default' => '1', 'null' => false, 'comment' => '1为直充,2为卡密订单']], ['request', 'text', ['default' => NULL, 'null' => true, 'comment' => '请求参数']], ['response', 'text', ['default' => NULL, 'null' => true, 'comment' => '请求时返回的数据']], ['channel_callback_msg', 'text', ['default' => NULL, 'null' => true, 'comment' => '渠道回调时返回的数据']], ['channel_callback_at', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '渠道回调时间']], ['merchant_callback_msg', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '商户回调发过来的消息,success是成功,fail是失败']], ['merchant_callback_error', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => false, 'comment' => '1正确2错误']], ['merchant_callback_at', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '商家回调时间']], ['merchant_callback_num', 'integer', ['default' => '0', 'null' => false, 'comment' => '通知次数,5次之后就不发了']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '1下单2成功3失败']], ['card_id', 'integer', ['default' => '0', 'null' => false, 'comment' => '卡密表id']], ['error_account_oper', 'tinyinteger', ['limit' => 1, 'default' => 2, 'null' => false, 'comment' => '错误时是否已经返还金额,1未处理,2已返还']], ['yctime', 'integer', ['default' => NULL, 'null' => true, 'comment' => '']], ['kami_data', 'text', ['default' => NULL, 'null' => true, 'comment' => '卡密数据,json存储']], ['kami_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '卡密数据表id,若对应多个则用英文逗号切割']], ['expire_time', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '超时时间']], ['apply_refund', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => false, 'comment' => '是否申请退单,1是申请,2已退单,3退单失败,4,退单中,0否']], ['buy_back', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '是否返销,1是0否']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ['lockcard_id', 'integer', ['default' => NULL, 'null' => true, 'comment' => '锁卡id']], ], [ 'pid', 'cash', 'param', 'status', 'account', 'order_id', 'product_key', 'merchant_order_id', 'merchant_callback_error', ], false); } /** * 创建数据对象 * @class MerchantOrderAftersales * @table merchant_order_aftersales * @return void */ private function _create_merchant_order_aftersales() { // 创建数据表对象 $table = $this->table('merchant_order_aftersales', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['mid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '商户id']], ['cid', 'integer', ['default' => NULL, 'null' => true, 'comment' => '渠道id']], ['pid', 'integer', ['default' => NULL, 'null' => true, 'comment' => '产品id']], ['product_key', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '商品key']], ['order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '本站订单id']], ['merchant_order_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户订单id']], ['dispute_type', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '']], ['refund_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '退款id']], ['listdata', 'text', ['default' => NULL, 'null' => true, 'comment' => '获取退款初步请求数据']], ['refund_fee', 'float', ['default' => NULL, 'null' => true, 'comment' => '退款金额']], ['refund_desc', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '描述原因']], ['reason', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '理由']], ['refund_phase', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '退款原因']], ['request', 'text', ['default' => NULL, 'null' => true, 'comment' => '请求参数']], ['buyer_nick', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '买家名称']], ['buyer_open_uid', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '买家ouid']], ['infodata', 'text', ['default' => NULL, 'null' => true, 'comment' => '详情数据']], ['s_nubmer', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '支付流水号']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '1下单2成功3失败']], ['expire_time', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '超时时间']], ['end_time', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '结束时间']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ], [ 'pid', 'status', 'order_id', 'product_key', 'merchant_order_id', ], false); } /** * 创建数据对象 * @class MerchantOrderAutoError * @table merchant_order_auto_error * @return void */ private function _create_merchant_order_auto_error() { // 创建数据表对象 $table = $this->table('merchant_order_auto_error', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['mid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '商户id']], ['cid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '渠道id']], ['pid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '产品id']], ['product_key', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '产品key']], ['project_id', 'integer', ['default' => '0', 'null' => false, 'comment' => '商户项目id(通道)']], ['cash', 'float', ['default' => NULL, 'null' => false, 'comment' => '付的金额']], ['actual_cash', 'float', ['default' => '0', 'null' => false, 'comment' => '实际扣费']], ['product_cash', 'float', ['default' => '0', 'null' => false, 'comment' => '使用的渠道产品实际支付的价格']], ['account_type', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '账户类型1余额账户2授信账户']], ['url', 'string', ['limit' => 300, 'default' => NULL, 'null' => false, 'comment' => '请求地址']], ['account', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '账户:卡号或者手机号']], ['isp', 'integer', ['default' => '-1', 'null' => false, 'comment' => '移动运营商1移动2联通3电信4其他']], ['order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '本站订单id']], ['num', 'integer', ['default' => '0', 'null' => false, 'comment' => '复冲次数']], ['parent_order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '']], ['channel_order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '渠道订单id,一般为请求后生成']], ['merchant_order_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户订单id']], ['platform_order_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '平台订单id']], ['param', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户请求的数据,json格式']], ['order_type', 'integer', ['default' => '1', 'null' => false, 'comment' => '1为直充,2为卡密订单']], ['request', 'text', ['default' => NULL, 'null' => true, 'comment' => '请求参数']], ['response', 'text', ['default' => NULL, 'null' => true, 'comment' => '请求时返回的数据']], ['channel_callback_msg', 'text', ['default' => NULL, 'null' => true, 'comment' => '渠道回调时返回的数据']], ['channel_callback_at', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '渠道回调时间']], ['merchant_callback_msg', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '商户回调发过来的消息,success是成功,fail是失败']], ['merchant_callback_error', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => false, 'comment' => '1正确2错误']], ['merchant_callback_at', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '商家回调时间']], ['merchant_callback_num', 'integer', ['default' => '0', 'null' => false, 'comment' => '通知次数,5次之后就不发了']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '1下单2成功3失败']], ['card_id', 'integer', ['default' => '0', 'null' => false, 'comment' => '卡密表id']], ['error_account_oper', 'tinyinteger', ['limit' => 1, 'default' => 2, 'null' => false, 'comment' => '错误时是否已经返还金额,1未处理,2已返还']], ['yctime', 'integer', ['default' => NULL, 'null' => true, 'comment' => '']], ['kami_data', 'text', ['default' => NULL, 'null' => true, 'comment' => '卡密数据,json存储']], ['kami_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '卡密数据表id,若对应多个则用英文逗号切割']], ['expire_time', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '超时时间']], ['apply_refund', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => false, 'comment' => '是否申请退单,1是申请,2已退单,3退单失败,4,退单中,0否']], ['buy_back', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '是否返销,1是0否']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ['lockcard_id', 'integer', ['default' => NULL, 'null' => true, 'comment' => '锁卡id']], ], [ 'cash', 'account', 'order_id', 'merchant_order_id', 'merchant_callback_error', ], false); } /** * 创建数据对象 * @class MerchantOrderHistory * @table merchant_order_history * @return void */ private function _create_merchant_order_history() { // 创建数据表对象 $table = $this->table('merchant_order_history', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['mid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '商户id']], ['cid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '渠道id']], ['pid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '产品id']], ['product_key', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '产品key']], ['project_id', 'integer', ['default' => '0', 'null' => false, 'comment' => '商户项目id(通道)']], ['cash', 'float', ['default' => NULL, 'null' => false, 'comment' => '付的金额']], ['actual_cash', 'float', ['default' => '0', 'null' => false, 'comment' => '实际扣费']], ['product_cash', 'float', ['default' => '0', 'null' => false, 'comment' => '使用的渠道产品实际支付的价格']], ['account_type', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '账户类型1余额账户2授信账户']], ['url', 'string', ['limit' => 300, 'default' => NULL, 'null' => false, 'comment' => '请求地址']], ['account', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '账户:卡号或者手机号']], ['isp', 'integer', ['default' => '-1', 'null' => false, 'comment' => '移动运营商1移动2联通3电信4其他']], ['order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '本站订单id']], ['num', 'integer', ['default' => '0', 'null' => false, 'comment' => '复冲次数']], ['parent_order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '']], ['channel_order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '渠道订单id,一般为请求后生成']], ['merchant_order_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户订单id']], ['platform_order_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '平台订单id']], ['param', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户请求的数据,json格式']], ['order_type', 'integer', ['default' => '1', 'null' => false, 'comment' => '1为直充,2为卡密订单']], ['request', 'text', ['default' => NULL, 'null' => true, 'comment' => '请求参数']], ['response', 'text', ['default' => NULL, 'null' => true, 'comment' => '请求时返回的数据']], ['channel_callback_msg', 'text', ['default' => NULL, 'null' => true, 'comment' => '渠道回调时返回的数据']], ['channel_callback_at', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '渠道回调时间']], ['merchant_callback_msg', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '商户回调发过来的消息,success是成功,fail是失败']], ['merchant_callback_error', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => false, 'comment' => '1正确2错误']], ['merchant_callback_at', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '商家回调时间']], ['merchant_callback_num', 'integer', ['default' => '0', 'null' => false, 'comment' => '通知次数,5次之后就不发了']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '1下单2成功3失败']], ['card_id', 'integer', ['default' => '0', 'null' => false, 'comment' => '卡密表id']], ['error_account_oper', 'tinyinteger', ['limit' => 1, 'default' => 2, 'null' => false, 'comment' => '错误时是否已经返还金额,1未处理,2已返还']], ['yctime', 'integer', ['default' => NULL, 'null' => true, 'comment' => '']], ['kami_data', 'text', ['default' => NULL, 'null' => true, 'comment' => '卡密数据,json存储']], ['kami_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '卡密数据表id,若对应多个则用英文逗号切割']], ['expire_time', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '超时时间']], ['apply_refund', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => false, 'comment' => '是否申请退单,1是申请,2已退单,3退单失败,4,退单中,0否']], ['buy_back', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '是否返销,1是0否']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ['lockcard_id', 'integer', ['default' => NULL, 'null' => true, 'comment' => '锁卡id']], ], [ 'order_id', 'product_key', 'merchant_order_id', 'merchant_callback_error', ], false); } /** * 创建数据对象 * @class MerchantOrderHistoryAftersales * @table merchant_order_history_aftersales * @return void */ private function _create_merchant_order_history_aftersales() { // 创建数据表对象 $table = $this->table('merchant_order_history_aftersales', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['mid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '商户id']], ['cid', 'integer', ['default' => NULL, 'null' => true, 'comment' => '渠道id']], ['pid', 'integer', ['default' => NULL, 'null' => true, 'comment' => '产品id']], ['product_key', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '商品key']], ['order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '本站订单id']], ['merchant_order_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户订单id']], ['dispute_type', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '']], ['refund_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '退款id']], ['listdata', 'text', ['default' => NULL, 'null' => true, 'comment' => '获取退款初步请求数据']], ['refund_fee', 'float', ['default' => NULL, 'null' => true, 'comment' => '退款金额']], ['refund_desc', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '描述原因']], ['reason', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '理由']], ['refund_phase', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '退款原因']], ['request', 'text', ['default' => NULL, 'null' => true, 'comment' => '请求参数']], ['buyer_nick', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '买家名称']], ['buyer_open_uid', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '买家ouid']], ['infodata', 'text', ['default' => NULL, 'null' => true, 'comment' => '详情数据']], ['s_nubmer', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '支付流水号']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '1下单2成功3失败']], ['expire_time', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '超时时间']], ['end_time', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '结束时间']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ], [ 'pid', 'status', 'order_id', 'product_key', 'merchant_order_id', ], false); } /** * 创建数据对象 * @class MerchantOrderHistoryKami91 * @table merchant_order_history_kami91 * @return void */ private function _create_merchant_order_history_kami91() { // 创建数据表对象 $table = $this->table('merchant_order_history_kami91', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['mid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '商户id']], ['pid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '产品id']], ['product_key', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '商品key']], ['cash', 'float', ['default' => NULL, 'null' => false, 'comment' => '付的金额']], ['cardno', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '卡号']], ['order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '关联订单id']], ['cardpwd', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '卡密']], ['merchant_order_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户订单id']], ['param', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户请求的数据,json格式']], ['callback_msg', 'text', ['default' => NULL, 'null' => true, 'comment' => '回调时返回的数据']], ['notifyurl', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '回调地址']], ['callback_at', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '回调时间']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '1未关联订单2成功3失败4处理中5异常订单']], ['expire_time', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '超时时间']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ], [ 'pid', 'cash', 'cardno', 'status', 'order_id', 'product_key', 'merchant_order_id', ], false); } /** * 创建数据对象 * @class MerchantOrderKami91 * @table merchant_order_kami91 * @return void */ private function _create_merchant_order_kami91() { // 创建数据表对象 $table = $this->table('merchant_order_kami91', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['mid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '商户id']], ['pid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '产品id']], ['product_key', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '商品key']], ['cash', 'float', ['default' => NULL, 'null' => false, 'comment' => '付的金额']], ['cardno', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '卡号']], ['order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '关联订单id']], ['cardpwd', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '卡密']], ['merchant_order_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户订单id']], ['param', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户请求的数据,json格式']], ['callback_msg', 'text', ['default' => NULL, 'null' => true, 'comment' => '回调时返回的数据']], ['notifyurl', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '回调地址']], ['callback_at', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '回调时间']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '1未关联订单2成功3失败4处理中5异常订单']], ['expire_time', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '超时时间']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ], [ 'pid', 'cash', 'cardno', 'status', 'order_id', 'product_key', 'merchant_order_id', ], false); } /** * 创建数据对象 * @class MerchantOrderLastHistory * @table merchant_order_last_history * @return void */ private function _create_merchant_order_last_history() { // 创建数据表对象 $table = $this->table('merchant_order_last_history', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['mid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '商户id']], ['cid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '渠道id']], ['pid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '产品id']], ['product_key', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '商品key']], ['project_id', 'integer', ['default' => '0', 'null' => false, 'comment' => '商户项目id(通道)']], ['cash', 'float', ['default' => NULL, 'null' => false, 'comment' => '付的金额']], ['actual_cash', 'float', ['default' => '0', 'null' => false, 'comment' => '实际扣费']], ['product_cash', 'float', ['default' => '0', 'null' => false, 'comment' => '使用的渠道产品实际支付的价格']], ['account_type', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '账户类型1余额账户2授信账户']], ['url', 'string', ['limit' => 300, 'default' => NULL, 'null' => false, 'comment' => '请求地址']], ['account', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '账户:卡号或者手机号']], ['isp', 'integer', ['default' => '-1', 'null' => false, 'comment' => '移动运营商1移动2联通3电信4其他']], ['order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '本站订单id']], ['num', 'integer', ['default' => '0', 'null' => false, 'comment' => '复冲次数']], ['parent_order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '']], ['channel_order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '渠道订单id,一般为请求后生成']], ['merchant_order_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户订单id']], ['platform_order_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '平台订单id']], ['param', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户请求的数据,json格式']], ['order_type', 'integer', ['default' => '1', 'null' => false, 'comment' => '1为直充,2为卡密订单']], ['request', 'text', ['default' => NULL, 'null' => true, 'comment' => '请求参数']], ['response', 'text', ['default' => NULL, 'null' => true, 'comment' => '请求时返回的数据']], ['channel_callback_msg', 'text', ['default' => NULL, 'null' => true, 'comment' => '渠道回调时返回的数据']], ['channel_callback_at', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '渠道回调时间']], ['merchant_callback_msg', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '商户回调发过来的消息,success是成功,fail是失败']], ['merchant_callback_error', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => false, 'comment' => '1正确2错误']], ['merchant_callback_at', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '商家回调时间']], ['merchant_callback_num', 'integer', ['default' => '0', 'null' => false, 'comment' => '通知次数,5次之后就不发了']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '1下单2成功3失败']], ['card_id', 'integer', ['default' => '0', 'null' => false, 'comment' => '卡密表id']], ['error_account_oper', 'tinyinteger', ['limit' => 1, 'default' => 2, 'null' => false, 'comment' => '错误时是否已经返还金额,1未处理,2已返还']], ['yctime', 'integer', ['default' => NULL, 'null' => true, 'comment' => '']], ['kami_data', 'text', ['default' => NULL, 'null' => true, 'comment' => '卡密数据,json存储']], ['kami_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '卡密数据表id,若对应多个则用英文逗号切割']], ['expire_time', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '超时时间']], ['apply_refund', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => false, 'comment' => '是否申请退单,1是申请,2已退单,3退单失败,4,退单中,0否']], ['buy_back', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '是否返销,1是0否']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ['lockcard_id', 'integer', ['default' => NULL, 'null' => true, 'comment' => '锁卡id']], ], [ 'pid', 'cash', 'param', 'status', 'account', 'order_id', 'product_key', 'merchant_order_id', 'merchant_callback_error', ], false); } /** * 创建数据对象 * @class MerchantOrderLastweekHistory * @table merchant_order_lastweek_history * @return void */ private function _create_merchant_order_lastweek_history() { // 创建数据表对象 $table = $this->table('merchant_order_lastweek_history', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['mid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '商户id']], ['cid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '渠道id']], ['pid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '产品id']], ['product_key', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '商品key']], ['project_id', 'integer', ['default' => '0', 'null' => false, 'comment' => '商户项目id(通道)']], ['cash', 'float', ['default' => NULL, 'null' => false, 'comment' => '付的金额']], ['actual_cash', 'float', ['default' => '0', 'null' => false, 'comment' => '实际扣费']], ['product_cash', 'float', ['default' => '0', 'null' => false, 'comment' => '使用的渠道产品实际支付的价格']], ['account_type', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '账户类型1余额账户2授信账户']], ['url', 'string', ['limit' => 300, 'default' => NULL, 'null' => false, 'comment' => '请求地址']], ['account', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '账户:卡号或者手机号']], ['isp', 'integer', ['default' => '-1', 'null' => false, 'comment' => '移动运营商1移动2联通3电信4其他']], ['order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '本站订单id']], ['num', 'integer', ['default' => '0', 'null' => false, 'comment' => '复冲次数']], ['parent_order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '']], ['channel_order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '渠道订单id,一般为请求后生成']], ['merchant_order_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户订单id']], ['platform_order_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '平台订单id']], ['param', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户请求的数据,json格式']], ['order_type', 'integer', ['default' => '1', 'null' => false, 'comment' => '1为直充,2为卡密订单']], ['request', 'text', ['default' => NULL, 'null' => true, 'comment' => '请求参数']], ['response', 'text', ['default' => NULL, 'null' => true, 'comment' => '请求时返回的数据']], ['channel_callback_msg', 'text', ['default' => NULL, 'null' => true, 'comment' => '渠道回调时返回的数据']], ['channel_callback_at', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '渠道回调时间']], ['merchant_callback_msg', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '商户回调发过来的消息,success是成功,fail是失败']], ['merchant_callback_error', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => false, 'comment' => '1正确2错误']], ['merchant_callback_at', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '商家回调时间']], ['merchant_callback_num', 'integer', ['default' => '0', 'null' => false, 'comment' => '通知次数,5次之后就不发了']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '1下单2成功3失败']], ['card_id', 'integer', ['default' => '0', 'null' => false, 'comment' => '卡密表id']], ['error_account_oper', 'tinyinteger', ['limit' => 1, 'default' => 2, 'null' => false, 'comment' => '错误时是否已经返还金额,1未处理,2已返还']], ['yctime', 'integer', ['default' => NULL, 'null' => true, 'comment' => '']], ['kami_data', 'text', ['default' => NULL, 'null' => true, 'comment' => '卡密数据,json存储']], ['kami_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '卡密数据表id,若对应多个则用英文逗号切割']], ['expire_time', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '超时时间']], ['apply_refund', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => false, 'comment' => '是否申请退单,1是申请,2已退单,3退单失败,4,退单中,0否']], ['buy_back', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => true, 'comment' => '是否返销,1是0否']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ['lockcard_id', 'integer', ['default' => NULL, 'null' => true, 'comment' => '锁卡id']], ], [ 'pid', 'cash', 'param', 'status', 'account', 'order_id', 'product_key', 'merchant_order_id', 'merchant_callback_error', ], false); } /** * 创建数据对象 * @class MerchantOrderTwoHistory * @table merchant_order_two_history * @return void */ private function _create_merchant_order_two_history() { // 创建数据表对象 $table = $this->table('merchant_order_two_history', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['mid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '商户id']], ['cid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '渠道id']], ['pid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '产品id']], ['product_key', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '商品key']], ['project_id', 'integer', ['default' => '0', 'null' => false, 'comment' => '商户项目id(通道)']], ['cash', 'float', ['default' => NULL, 'null' => false, 'comment' => '付的金额']], ['actual_cash', 'float', ['default' => '0', 'null' => false, 'comment' => '实际扣费']], ['product_cash', 'float', ['default' => '0', 'null' => false, 'comment' => '使用的渠道产品实际支付的价格']], ['account_type', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '账户类型1余额账户2授信账户']], ['url', 'string', ['limit' => 300, 'default' => NULL, 'null' => false, 'comment' => '请求地址']], ['account', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '账户:卡号或者手机号']], ['isp', 'integer', ['default' => '-1', 'null' => false, 'comment' => '移动运营商1移动2联通3电信4其他']], ['order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '本站订单id']], ['num', 'integer', ['default' => '0', 'null' => false, 'comment' => '复冲次数']], ['parent_order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '']], ['channel_order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '渠道订单id,一般为请求后生成']], ['merchant_order_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户订单id']], ['platform_order_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '平台订单id']], ['param', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户请求的数据,json格式']], ['order_type', 'integer', ['default' => '1', 'null' => false, 'comment' => '1为直充,2为卡密订单']], ['request', 'text', ['default' => NULL, 'null' => true, 'comment' => '请求参数']], ['response', 'text', ['default' => NULL, 'null' => true, 'comment' => '请求时返回的数据']], ['channel_callback_msg', 'text', ['default' => NULL, 'null' => true, 'comment' => '渠道回调时返回的数据']], ['channel_callback_at', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '渠道回调时间']], ['merchant_callback_msg', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '商户回调发过来的消息,success是成功,fail是失败']], ['merchant_callback_error', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => false, 'comment' => '1正确2错误']], ['merchant_callback_at', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '商家回调时间']], ['merchant_callback_num', 'integer', ['default' => '0', 'null' => false, 'comment' => '通知次数,5次之后就不发了']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '1下单2成功3失败']], ['card_id', 'integer', ['default' => '0', 'null' => false, 'comment' => '卡密表id']], ['error_account_oper', 'tinyinteger', ['limit' => 1, 'default' => 2, 'null' => false, 'comment' => '错误时是否已经返还金额,1未处理,2已返还']], ['yctime', 'integer', ['default' => NULL, 'null' => true, 'comment' => '']], ['kami_data', 'text', ['default' => NULL, 'null' => true, 'comment' => '卡密数据,json存储']], ['kami_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '卡密数据表id,若对应多个则用英文逗号切割']], ['expire_time', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '超时时间']], ['apply_refund', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => false, 'comment' => '是否申请退单,1是申请,2已退单,3退单失败,4,退单中,0否']], ['buy_back', 'text', ['default' => NULL, 'null' => true, 'comment' => '是否返销,1是0否']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ['lockcard_id', 'integer', ['default' => NULL, 'null' => true, 'comment' => '锁卡id']], ], [ 'pid', 'cash', 'param', 'status', 'account', 'order_id', 'product_key', 'merchant_order_id', 'merchant_callback_error', ], false); } /** * 创建数据对象 * @class MerchantPercent * @table merchant_percent * @return void */ private function _create_merchant_percent() { // 创建数据表对象 $table = $this->table('merchant_percent', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '渠道-商品', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['cid', 'biginteger', ['default' => '0', 'null' => true, 'comment' => '所属渠道']], ['mid', 'integer', ['default' => NULL, 'null' => true, 'comment' => '商户id']], ['product_key', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '商品key']], ['percent_type', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '分成类型1折扣,2固定数值']], ['rid', 'integer', ['default' => NULL, 'null' => true, 'comment' => '商品关联表id']], ['percent', 'decimal', ['precision' => 10, 'scale' => 4, 'default' => NULL, 'null' => true, 'comment' => '渠道分成']], ['rule', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '分面值规则']], ['isp_rule', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '']], ['cash', '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' => '创建时间']], ], [ 'mid', 'product_key', ], false); } /** * 创建数据对象 * @class MerchantProduct * @table merchant_product * @return void */ private function _create_merchant_product() { // 创建数据表对象 $table = $this->table('merchant_product', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户产品设置表', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['mid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '']], ['cid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '']], ['pid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '']], ['product_key', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '产品key']], ['sort', 'integer', ['default' => '1', 'null' => false, 'comment' => '优先级,数字越大优先级越高']], ['cash', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '可用面值,多个用逗号隔开']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ], [ 'mid', 'cid', 'pid', 'mid', 'sort', 'product_key', ], false); } /** * 创建数据对象 * @class MerchantProject * @table merchant_project * @return void */ private function _create_merchant_project() { // 创建数据表对象 $table = $this->table('merchant_project', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '通道', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['name', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '通道项目名称']], ['mid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '1启用2禁用']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ], [ ], false); } /** * 创建数据对象 * @class MerchantProjectPercent * @table merchant_project_percent * @return void */ private function _create_merchant_project_percent() { // 创建数据表对象 $table = $this->table('merchant_project_percent', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '渠道-商品', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['mid', 'integer', ['default' => NULL, 'null' => true, 'comment' => '商户id']], ['project_id', 'integer', ['default' => NULL, 'null' => false, 'comment' => '']], ['product_key', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '商品key']], ['percent', 'decimal', ['precision' => 10, 'scale' => 3, 'default' => NULL, 'null' => true, 'comment' => '渠道分成']], ['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' => '创建时间']], ], [ 'mid', 'project_id', 'product_key', ], false); } /** * 创建数据对象 * @class MerchantProjectProduct * @table merchant_project_product * @return void */ private function _create_merchant_project_product() { // 创建数据表对象 $table = $this->table('merchant_project_product', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户产品设置表', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['mid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '']], ['project_id', 'integer', ['default' => NULL, 'null' => false, 'comment' => '']], ['cid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '']], ['pid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '']], ['product_key', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '产品key']], ['sort', 'integer', ['default' => '1', 'null' => false, 'comment' => '优先级,数字越大优先级越高']], ['cash', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '可用面值,多个用逗号隔开']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ], [ 'mid', 'cid', 'pid', 'mid', 'sort', 'project_id', 'project_id', 'product_key', ], false); } /** * 创建数据对象 * @class MerchantQianmiApply * @table merchant_qianmi_apply * @return void */ private function _create_merchant_qianmi_apply() { // 创建数据表对象 $table = $this->table('merchant_qianmi_apply', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['product', 'string', ['limit' => 200, 'default' => NULL, 'null' => true, 'comment' => '']], ['url', 'string', ['limit' => 300, 'default' => NULL, 'null' => false, 'comment' => '请求地址']], ['reqid', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '请求id']], ['request', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '请求参数']], ['response', 'text', ['default' => NULL, 'null' => true, 'comment' => '请求时返回的数据']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '1下单2成功3失败']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ], [ 'reqid', ], false); } /** * 创建数据对象 * @class MerchantQianmiOrder * @table merchant_qianmi_order * @return void */ private function _create_merchant_qianmi_order() { // 创建数据表对象 $table = $this->table('merchant_qianmi_order', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['reqid', 'string', ['limit' => 800, 'default' => NULL, 'null' => false, 'comment' => '请求id']], ['item_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => 'item拆分的订单id']], ['item_order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '订单编号']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '1下单2成功3失败']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']], ], [ 'reqid', ], false); } /** * 创建数据对象 * @class MerchantRebate * @table merchant_rebate * @return void */ private function _create_merchant_rebate() { // 创建数据表对象 $table = $this->table('merchant_rebate', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户-充值-日志', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['mid', 'biginteger', ['default' => NULL, 'null' => true, 'comment' => '商户id']], ['product_key', 'string', ['limit' => 100, 'default' => NULL, 'null' => true, 'comment' => '商品key']], ['percent', 'decimal', ['precision' => 10, 'scale' => 4, 'default' => '0.0000', 'null' => true, 'comment' => '返点分成']], ['num', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => '0.00', 'null' => true, 'comment' => '总金额']], ['is_yue', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '是否计入余额1计入2不计入']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '']], ['is_deleted', 'tinyinteger', ['limit' => 1, 'default' => 0, 'null' => false, 'comment' => '']], ], [ ], false); } /** * 创建数据对象 * @class MerchantRelation * @table merchant_relation * @return void */ private function _create_merchant_relation() { // 创建数据表对象 $table = $this->table('merchant_relation', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户关联渠道商品', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['cid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '渠道ID']], ['pid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '商品ID']], ['mid', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '商户ID']], ['product_key', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '商品KEY']], ['status', 'tinyinteger', ['limit' => 4, 'default' => 0, 'null' => true, 'comment' => '状态(0:禁用,1:启用)']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], ], [ 'mid', 'product_key', ], false); } /** * 创建数据对象 * @class MerchantSystemAuth * @table merchant_system_auth * @return void */ private function _create_merchant_system_auth() { // 创建数据表对象 $table = $this->table('merchant_system_auth', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户系统-系统-权限', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['title', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '权限名称']], ['desc', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '备注说明']], ['sort', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '排序权重']], ['status', 'tinyinteger', ['limit' => 4, 'default' => 1, 'null' => true, 'comment' => '权限状态(1使用,0禁用)']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], ], [ 'title', 'status', ], false); } /** * 创建数据对象 * @class MerchantSystemAuthNode * @table merchant_system_auth_node * @return void */ private function _create_merchant_system_auth_node() { // 创建数据表对象 $table = $this->table('merchant_system_auth_node', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户系统-系统-授权', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['auth', 'biginteger', ['limit' => 20, 'default' => 0, 'null' => true, 'comment' => '角色']], ['node', 'string', ['limit' => 200, 'default' => '', 'null' => true, 'comment' => '节点']], ], [ 'auth', 'node', ], false); } /** * 创建数据对象 * @class MerchantSystemConfig * @table merchant_system_config * @return void */ private function _create_merchant_system_config() { // 创建数据表对象 $table = $this->table('merchant_system_config', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户系统-系统-配置', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['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', ], false); } /** * 创建数据对象 * @class MerchantSystemData * @table merchant_system_data * @return void */ private function _create_merchant_system_data() { // 创建数据表对象 $table = $this->table('merchant_system_data', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户系统-系统-数据', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['name', 'string', ['limit' => 100, 'default' => '', 'null' => true, 'comment' => '配置名']], ['value', 'text', ['default' => NULL, 'null' => true, 'comment' => '配置值']], ], [ 'name', ], false); } /** * 创建数据对象 * @class MerchantSystemMenu * @table merchant_system_menu * @return void */ private function _create_merchant_system_menu() { // 创建数据表对象 $table = $this->table('merchant_system_menu', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户系统-系统-菜单', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['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', 'integer', ['limit' => 11, 'default' => 0, 'null' => true, 'comment' => '排序权重']], ['status', 'tinyinteger', ['limit' => 4, 'default' => 1, 'null' => true, 'comment' => '状态(0:禁用,1:启用)']], ['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => true, 'comment' => '创建时间']], ], [ 'node', 'status', ], false); } /** * 创建数据对象 * @class MerchantSystemOplog * @table merchant_system_oplog * @return void */ private function _create_merchant_system_oplog() { // 创建数据表对象 $table = $this->table('merchant_system_oplog', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '商户系统-系统-日志', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['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' => '创建时间']], ], [ ], false); } /** * 创建数据对象 * @class MerchantSystemQueue * @table merchant_system_queue * @return void */ private function _create_merchant_system_queue() { // 创建数据表对象 $table = $this->table('merchant_system_queue', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-任务', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['code', 'string', ['limit' => 20, 'default' => '', 'null' => false, 'comment' => '任务编号']], ['title', 'string', ['limit' => 50, 'default' => '', 'null' => false, 'comment' => '任务名称']], ['command', 'string', ['limit' => 500, 'default' => '', 'null' => true, 'comment' => '执行指令']], ['exec_pid', 'biginteger', ['default' => '0', 'null' => true, 'comment' => '执行进程']], ['exec_data', 'text', ['default' => NULL, 'null' => true, 'comment' => '执行参数']], ['exec_time', 'biginteger', ['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', ['default' => '0', 'null' => true, 'comment' => '循环时间']], ['attempts', 'biginteger', ['default' => '0', 'null' => true, 'comment' => '执行次数']], ['rscript', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '任务类型(0单例,1多例)']], ['status', 'tinyinteger', ['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', ], false); } /** * 创建数据对象 * @class MerchantSystemUser * @table merchant_system_user * @return void */ private function _create_merchant_system_user() { // 创建数据表对象 $table = $this->table('merchant_system_user', [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '系统-用户', ]); // 创建或更新数据表 PhinxExtend::upgrade($table, [ ['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', ['default' => '0', 'null' => true, 'comment' => '登录次数']], ['describe', 'string', ['limit' => 255, 'default' => '', 'null' => true, 'comment' => '备注说明']], ['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => true, 'comment' => '状态(0禁用,1启用)']], ['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' => '创建时间']], ], [ 'status', 'username', 'is_deleted', ], false); } }