
###商户充值到外部账户记录 `merchant_account_out`
> merchant_id: 关联商户的id  [merchant.id](./merchant_struct.md)
>
> account_num :  关联商户的外部账户记录的银行帐户编号  [merchant_account_out.account_num](./merchant_account_out_struct.md)
> 
> account_out_id : 关联商户的外部账户id [merchant_account_out.id](./merchant_account_out_struct.md)
> 
> account_sys_id:  充值到平台的系统账户的id ,关联[sys_account.id](./sys_account.md)
> 
> account_num :  关联商户的外部账户记录的银行帐户编号  [merchant_account_out.account_num](./merchant_account_out_struct.md)
> 
> trade_no :  关联交易订单记录表 [payment_order.trade_no](./payment_order.md)
> 
> before：  交易前的余额
> 
> after：交易后的余额
> 
> amount： 交易的金额


```mysql
CREATE TABLE `merchant_account_out_log` (
    `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',
    `account_num` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '外部账户关联的银行的账户编号',
    `account_out_id` int DEFAULT '0' COMMENT '外部账户记录的id',
    `account_sys_id` int DEFAULT NULL COMMENT '充值到平台的系统账户的id',
    `before` decimal(10,2) NOT NULL COMMENT '交易前的余额',
    `after` decimal(10,2) NOT NULL COMMENT '交易后的余额',
    `amount` decimal(10,2) NOT NULL COMMENT '交易的金额',
    `currency_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_no` varchar(64) DEFAULT NULL COMMENT '交易单号',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='商户外部账户余额明细记录';
```