REAPI/database/migrations/20009999999993_install_linshi_table.php
mzeros b0fbd5c5a6 feat(database): 添加多个数据库迁移脚本
- 新增 test、taobao、system、suoka 和 stat 数据库表的迁移脚本- 包含各种数据表的创建和字段定义
- 为系统初始化、统计、对账等功能提供数据支持
2024-12-22 17:42:44 +08:00

76 lines
4.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use think\admin\extend\PhinxExtend;
use think\migration\Migrator;
@set_time_limit(0);
@ini_set('memory_limit', -1);
class InstallLinshiTable extends Migrator
{
/**
* 创建数据库
*/
public function change()
{
$this->_create_linshi_order();
}
/**
* 创建数据对象
* @class LinshiOrder
* @table linshi_order
* @return void
*/
private function _create_linshi_order()
{
// 创建数据表对象
$table = $this->table('linshi_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存储']],
['expire_time', 'timestamp', ['default' => NULL, 'null' => true, 'comment' => '超时时间']],
['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']],
['lockcard_id', 'integer', ['default' => NULL, 'null' => true, 'comment' => '锁卡id']],
], [
'pid', 'cash', 'param', 'status', 'account', 'product_key', 'merchant_order_id', 'merchant_callback_error',
], false);
}
}