payment_order.md 2.3 KB

交易订单记录表 payment_order

merchant_id 关联 merchant.id

trade_no: 由平台生成的交易单号

from_account_no []

CREATE TABLE `payment_order` (
  `id` int NOT NULL AUTO_INCREMENT,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  `deleted_at` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  `merchant_id` int NOT NULL DEFAULT '0' COMMENT '商户ID',
  `trade_no` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '平台生成的交易单号',
  `from_account_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '来自银行的账户编号',
  `from_account_id` int DEFAULT '0' COMMENT '来自账户的id',
  `to_account_id` int DEFAULT '0' COMMENT '转到账户的id',
  `to_account_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '转到银行的账户编号',
  `exchange_rate` decimal(10,10) DEFAULT NULL COMMENT '汇率',
  `amount` decimal(10,2) NOT NULL COMMENT '交易的金额',
  `from_currency_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '来自币种',
  `to_currency_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '目标币种',
  `transfer_type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '交易类型(汇兑、结汇、充值)',
  `transfer_state` tinyint(1) NOT NULL DEFAULT '0' COMMENT '交易状态',
  `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '备注',
  `loan_mark` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '借贷标识',
  `trade_org_id` varchar(64) DEFAULT NULL COMMENT '交易机构的id',
  `trade_org_code` varchar(64) DEFAULT NULL COMMENT '交易机构代码',
  `org_trade_no` varchar(64) DEFAULT NULL COMMENT '交易机构的交易单号',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='商户外部账户余额明细记录';