Explorar el Código

1.文档整理, 2.表结构

liaoxxxx hace 2 años
padre
commit
746a08989b

+ 1 - 42
README.md

@@ -2,51 +2,10 @@
 
 跨境收款项目-20220413
 
-## 代码结构层次
+## 代码结构层次
 
 
 ```text
- |----. internal
- |    | 
- |    | ---.app
- |    |    | 
- |    |    |---. moduleXXX       (应用模块)
- |    |    |    |
- |    |    |    |--- api         (控制器)
- |    |    |    |
- |    |    |    |--- payload     (请求载体) 
- |    |    |    |
- |    |    |    |--- service     (服务) 
- |    |    |    |    
- |    |    |    |--- exports     (输出数据载体)     
- |    |    |
- |    |    |
- |    |    |---. moduleYYYY
- |    |    |
- |    |    |
- |    |    |---. moduleZZZZ
- |    |   
- |    |      
- |    | 
- |    |--- middleware        (中间件)
- |    | 
- |    |--- entity           (模型实体)
- |    |
- |    |--- repository      (数据存储)
- |   
-
- |
- |---. pkg
- |   |
- |   |--- enum           (枚举常量)
- |   |
- |   |--- util           (工具类)
- | 
- |
- |---. router
- |
- |
- |____________
 
 ```
 

+ 3 - 2
doc/model/README.md

@@ -6,8 +6,9 @@
 
 ### [商户外部账户表](./merchant_account_out_struct.md)
 
-### [商户创建系统账户流程](./currency.md)
+### [币种](./currency.md)
 
-### [商户充值到外部账户](./merchant/充值到外部账户.md)
+### [商户充值到外部账户记录](./merchant_account_out_log.md)
 
 
+### [交易订单记录](./payment_order.md)

+ 9 - 1
doc/model/currency.md

@@ -1,9 +1,17 @@
 
 ###币种信息表 `currency`
+
+
+> currency_code :币种国际代码 如USD ERU CNH ,  
+> 
+> currency_name  : 币种名称 美元,欧元,人民币等,
+> 
+> currency_type :货币类型
+
 ```mysql
 CREATE TABLE `currency` (
     `id` int NOT NULL AUTO_INCREMENT,
-    `currency_id` bigint DEFAULT NULL,
+    `currency_code` bigint DEFAULT NULL,
     `currency_name` varchar(255) DEFAULT NULL,
     `currency_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '币种类型',
     `state` int DEFAULT NULL,

+ 25 - 1
doc/model/merchant_struct.md

@@ -1,5 +1,29 @@
 
 ###商户基本信息表 `merchant`
+
+>username :用戶名字,
+>
+>phone:手机号,
+>
+>password:密碼,
+>
+>pause_transfer:是否暂停转账,  (0:否,1:是),
+>
+>pause_login:是否暂停登录,停用账户,(0:否,1:是),
+
+
+>transfer_fee_type:付款手续费收取形式(0:内扣;1:外扣;) ,
+> 
+>join_fee:开户费,
+> 
+>annual_fee:年服务费,
+> 
+>transfer_fee:外币付款手续费(USD),
+> 
+>transfer_fee_cny:人民币付款手续费(USD),
+
+
+
 ```mysql
 CREATE TABLE `merchant` (
        `id` int NOT NULL AUTO_INCREMENT,
@@ -17,7 +41,7 @@ CREATE TABLE `merchant` (
        `pause_login` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否暂停登录(0:否,1:是)',
        `transfer_fee_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '付款手续费收取形式(0:内扣;1:外扣;) ',
        `join_fee` decimal(10,2) NOT NULL COMMENT '开户费',
-       `anual_fee` decimal(10,2) NOT NULL COMMENT '年服务费',
+       `annual_fee` decimal(10,2) NOT NULL COMMENT '年服务费',
        `transfer_fee` decimal(10,2) NOT NULL COMMENT '外币付款手续费(USD)',
        `transfer_fee_cny` decimal(10,2) NOT NULL COMMENT '人民币付款手续费(USD)',
        `confirm_token` varchar(64) NOT NULL COMMENT '开户验证码 (google登陆验证器token)',

+ 31 - 0
doc/model/payment_order.md

@@ -0,0 +1,31 @@
+
+### 交易订单记录表 `payment_order`
+
+
+
+
+```mysql
+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',
+    `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='商户外部账户余额明细记录';
+```

+ 9 - 1
doc/process/README.md

@@ -15,4 +15,12 @@
 
 ### [商户创建系统账户流程](./merchant/创建系统账户.md)
 
-### [商户充值到外部账户](./merchant/充值到外部账户.md)
+### [商户充值到外部账户](./merchant/充值到外部账户.md)
+
+<br>
+<hr>
+
+### [换汇流程](./payment/换汇.md)
+
+### [结汇流程](./payment/结汇.md)
+

+ 76 - 0
doc/process/payment/换汇.md

@@ -0,0 +1,76 @@
+## 换汇  外币转成`CNH`
+
+
+
+### 流程
+#### 流程图
+![](./../换汇流程图.png)
+### 1. 发起结汇
+> 商户从前端选择 系统账户(币种CNH),发起换汇, 
+
+```js
+// 提交结汇的账户 ,金额,等
+http.post("",{
+    amount:10000.00,
+    fromAccountID:"66688",  //来自到的账户
+    toAccountID:"2332",  //转到的账户
+    TradeType:"swap"
+})
+```
+<br>
+<hr>
+
+### 2. 收款系统生成结汇订单号 ,记录到交易日志  
+### 3. 关联操作的账户
+```go
+orderSN:="charge".util.PayTool.GenOrderSn()    //生成结汇单号  settlement202204221059590001
+order := &entity.PaymentOoder{
+    MerchantID:mid,
+    FromCurrencyID:fromCurrencyID, //来自账户 币种如USD  /EUR
+    ToCurrencyID:toCurrencyID ,//转到的账户 CNH
+    Amount:1000.00 ,   //金额
+    FromAccountID:22325222 ,//来自到的账户
+    ToAccountID:22325222 ,//转到的账户 
+    OrderSN:orderSN,
+    TradeType:"settlement", //交易类型 结汇	
+    TradeOrg:"settlement", //交易 机构指银行	
+    OrderSN:orderSN,
+    //  ......
+}
+accountID,err:=repo.PaymentOrderDao.Save(order)  //保存订单
+
+//日志
+payLog:=&entity.PaymentOoderLog{
+    OrderSN:orderSN,
+    StepR:0    ,        //步骤
+    StepR:"order_create", //步骤 init
+    TradeType:"settlement", //交易类型 结汇
+    CallBack:""      //回调信息
+}
+err:=repo.PaymentOrderLogDao.Save(payLog)  //保存订单日志
+```
+
+<br>
+<hr>
+
+### 4. 向银行机构发起结汇请求 略
+##### 4.1  查询实时汇率等,渠道,币种;
+##### 4.2  包装请求体,向银行发起结汇请求
+##### 4.3  记录请求数据及响应数据
+
+
+<br>
+<hr>
+
+
+### 5. 收到银行机构结汇成功的通知
+##### 5.1   解析通知body, 查询订单,验证签名,回应银行机构 success
+##### 5.2   更改订单状态,记录银行通知数据、订单状态等到日志
+
+<br>
+<hr>
+
+
+### 6.换汇成功,更改目标账户金额
+##### 6.1   查询订单信息,获取商户账户信息(CNH币种),订单金额等
+##### 6.3   记录订单状态等到`PaymentOrderLog`日志

+ 78 - 0
doc/process/payment/结汇.md

@@ -0,0 +1,78 @@
+## 结汇  `CNH`结算成`CNY`
+ [结汇是什么意思?](./结汇概念.md)
+
+### 流程
+#### 流程图
+![](./../结汇流程图.png)
+### 1. 发起结汇
+> 商户从前端选择 系统账户(币种CNH)发起结汇,
+
+```js
+// 提交结汇的账户 ,金额,等
+http.post("",{
+    amount:10000.00,
+    //currencyID:88,  // 币种 CNY
+    paymentChannel:"CNH",  //"alipay" unionpay
+    fromAccountID:"66688",  //来自到的账户
+    toAccountID:"2332",  //转到的账户
+    TradeType:"settlement"
+})
+```
+<br>
+<hr>
+
+### 2. 收款系统生成结汇订单号 ,记录到交易日志  
+### 3. 关联操作的账户
+```go
+orderSN:="charge".util.PayTool.GenOrderSn()    //生成结汇单号  settlement202204221059590001
+order := &entity.PaymentOoder{
+    MerchantID:mid,
+    FromCurrencyID:CurrencyID, // 币种
+    ToCurrencyID:22325222 ,//转到的账户 
+    Amount:1000.00 ,   //金额
+    FromAccountID:22325222 ,//来自到的账户
+    ToAccountID:22325222 ,//转到的账户 
+    OrderSN:orderSN,
+    TradeType:"settlement", //交易类型 结汇	
+    TradeOrg:"settlement", //交易 机构指银行	
+    OrderSN:orderSN,
+    //  ......
+}
+accountID,err:=repo.PaymentOrderDao.Save(order)  //保存订单
+
+//日志
+payLog:=&entity.PaymentOoderLog{
+    OrderSN:orderSN,
+    StepR:0    ,        //步骤
+    StepR:"order_create", //步骤 init
+    TradeType:"settlement", //交易类型 结汇
+    CallBack:""      //回调信息
+}
+err:=repo.PaymentOrderLogDao.Save(payLog)  //保存订单日志
+```
+
+<br>
+<hr>
+
+### 4. 向银行机构发起结汇请求 略
+##### 4.1  查询实时汇率等,渠道,币种;
+##### 4.2  包装请求体,向银行发起结汇请求
+##### 4.3  记录请求数据及响应数据
+
+
+<br>
+<hr>
+
+
+### 5. 收到银行机构结汇成功的通知
+##### 5.1   解析通知body, 查询订单,验证签名,回应银行机构 success
+##### 5.2   更改订单状态,记录银行通知数据、订单状态等到日志
+
+<br>
+<hr>
+
+
+### 6.结汇成功,更改目标账户金额
+##### 6.1   查询订单信息,获取商户外部账户信息(CNY币种),订单金额等
+##### 6.2   更改外部账户金额、记录订单状态等到`MerchantAccountOutLog`日志
+##### 6.3   记录订单状态等到`PaymentOrderLog`日志

+ 70 - 0
doc/process/payment/结汇概念.md

@@ -0,0 +1,70 @@
+## 结汇
+结汇是什么意思?
+结汇,是外汇结算(exchange settlement/foreign exchange settlement) 的简称,分为个人结汇与公司结汇两种情况,都是必须到银行办理的,而且目前,我国国内多家银行都可以办理。
+
+结汇是指外汇收入所有者将其外汇收入出售给外汇指定银行,外汇指定银行按一定汇率付给等值的本币的行为。
+
+结汇有强制结汇、意愿结汇和限额结汇等多种形式。
+
+举个例子,中国出口企业向者外卖出一批货物,国外买家外用美金付款,那么这家中国的出口企业把收到的美金兑换成人民币,这个过程就称为结汇或外汇结算。
+
+
+
+
+结汇方式有哪些?
+
+结汇方式通常用于对外贸易中,而贸易结汇方式很多,根据不同的情况会用到不同的结汇方式,或者出口卖家出于自身资金着想会根据自身情况选择利于本身的结汇方式。
+
+结汇方式分为以下几种:TT银行电汇、DP付款交单、LC信用证(又分即期信用证和远期信用证)、D/A承兑交单、MT信汇、外贸O/A记帐。
+
+结汇方法分別有:个人离岸账户收款结汇(限额5万美金)、企业对公账户收款结汇、离岸公司离岸账户结汇、西联结汇、连连支付、PayPal。
+
+国内公司账户可以收外汇吗?
+
+国内普通公司如果没有进出口权,公司账户是无法接收外币的。如果一定要接收外币,只能曲线接收外币。你可以注册一个离岸公司,配合你内地的公司一起使用。离岸公司账户就能满足你接受外币的需求。
+
+国内公司账户如何收外汇?
+
+必须具备进出口经营资格的公司才有可能接受外汇并兑换成人民币,个人一本通储蓄卡也可以接收外汇。如果没有进出口经营资格,即便是外汇到了你们的账户,也无法接收,银行将会要求你们将外汇退回。
+
+购汇是什么意思
+
+购汇就是在国内进行进行购买外币,有很多币种,不仅仅是美元,比如欧元,日元和韩元,这些都属于外币,所以都可以用等价的人民币去兑换,购汇就是一种转账的交易,就是用自己账户上的本币来换外币就相当于外汇的买卖换完之后外币就可以放在自己的账户上,或者是银行卡上,但是就不可以去提现,这点必须弄清楚。
+
+
+
+
+企业怎样办理购汇美元?都需要带什么资料?
+
+一、电汇:
+
+办理电汇需填写电汇申请书,必须以英文填写,在办理业务前,需要准确提供取得如下汇款信息:
+
+1.汇款货币及金额;
+
+2.收款人姓名及地址;
+
+3.收款人在开户银行的账号;
+
+4.收款人开户银行名称、SWIFT代码(SWIFTCODE)或地址。
+
+为了保证收款人及时收到款项,请您提供准确的汇款信息,同时,留下联系方式,并保存好汇款回单,以便在汇款出现问题时,能够及时联络。
+
+二、票汇:
+
+办理票汇需填写汇票申请书,以英文填写(汇往港澳台地区可以中文填写),需要准确提供如下信息:
+
+1.汇款货币及金额;
+
+2.收款人姓名及地址。
+
+办理完票汇手续,可邮寄或自行携带出境。
+
+
+
+个人结售汇额度有上限,每人每年等值5万美元
+
+根据国家外汇管理局相关规定,个人结汇年度总额及售汇年度总额上限分别为每人每年等值5万美元。等值5万美元是指,小额外币兑换交易的限额货币单位采用美元,非美元货币则根据外汇管理局的折算率折算成美元后,不超过5万美元。超过年度总额度的,需要携带本人身份证及相关材料到银行办理。
+
+据有关部门规定,可办理结售汇业务的各家银行在办理对企业和个人的结售汇时,都是根据人民银行公布的汇率,在规定的幅度内制定挂牌汇率,因此差别汇率不大。同时,结汇、售汇业务的办理,银行不收取任何手续费,目前多数银行可办理包括美元、日元、澳元、欧元等多种外币结售汇交易。
+

BIN
doc/process/换汇流程图.png


BIN
doc/process/结汇流程图.png


+ 0 - 0
doc/sql/admin_u.sql


+ 0 - 0
doc/sql/channel.sql


+ 0 - 0
doc/sql/city.sql


+ 0 - 0
doc/sql/country.sql


+ 441 - 0
doc/sql/crossbordercoll.sql

@@ -0,0 +1,441 @@
+/*
+ Navicat Premium Data Transfer
+
+ Source Server         : 跨境收款-测试
+ Source Server Type    : MySQL
+ Source Server Version : 80024
+ Source Host           : 127.0.0.1:3306
+ Source Schema         : crossbordercoll
+
+ Target Server Type    : MySQL
+ Target Server Version : 80024
+ File Encoding         : 65001
+
+ Date: 24/04/2022 15:43:42
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for admin_u
+-- ----------------------------
+DROP TABLE IF EXISTS `admin_u`;
+CREATE TABLE `admin_u`  (
+  `id` int(0) NOT NULL AUTO_INCREMENT,
+  `created_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+  `updated_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `deleted_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `username` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '用戶名字',
+  `phone` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '手机号',
+  `password` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '密碼',
+  `salt` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '加密盐',
+  `state` tinyint(0) NOT NULL DEFAULT 0 COMMENT '狀態 0 待審核  1 審核中 2 正常 4 刪除 -1 已經註銷',
+  `avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '头像',
+  `sex` tinyint(0) NOT NULL DEFAULT 0 COMMENT '性别 0 位置 1男 2女',
+  `nickname` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '用户真实昵称',
+  `is_super_admin` tinyint(1) NOT NULL DEFAULT 0 COMMENT '超级管理员',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 67 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '后台登錄表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of admin_u
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for channel
+-- ----------------------------
+DROP TABLE IF EXISTS `channel`;
+CREATE TABLE `channel`  (
+  `id` int(0) NOT NULL AUTO_INCREMENT,
+  `channel_id` bigint(0) NULL DEFAULT NULL,
+  `channel_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+  `channel_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '通道名称',
+  `docking_method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '对接方式',
+  `channel_type` int(0) NULL DEFAULT NULL,
+  `area` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '区域',
+  `supported_currencies` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '支持的币种',
+  `state` int(0) NULL DEFAULT NULL,
+  `created_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+  `updated_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `deleted_at` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of channel
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for city
+-- ----------------------------
+DROP TABLE IF EXISTS `city`;
+CREATE TABLE `city`  (
+  `id` int(0) NOT NULL AUTO_INCREMENT,
+  `city_id` bigint(0) NULL DEFAULT NULL,
+  `city_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+  `city_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+  `state` int(0) NULL DEFAULT NULL,
+  `created_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+  `updated_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `deleted_at` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of city
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for country
+-- ----------------------------
+DROP TABLE IF EXISTS `country`;
+CREATE TABLE `country`  (
+  `id` int(0) NOT NULL AUTO_INCREMENT,
+  `country_id` bigint(0) NULL DEFAULT NULL,
+  `country_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+  `country_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+  `status` int(0) NULL DEFAULT NULL,
+  `created_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+  `updated_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `deleted_at` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of country
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for currency
+-- ----------------------------
+DROP TABLE IF EXISTS `currency`;
+CREATE TABLE `currency`  (
+  `id` int(0) NOT NULL AUTO_INCREMENT,
+  `currency_id` bigint(0) NULL DEFAULT NULL,
+  `currency_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+  `currency_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '币种类型',
+  `state` int(0) NULL DEFAULT NULL,
+  `created_at` datetime(0) NULL DEFAULT NULL,
+  `updated_at` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
+  `deleted_at` datetime(0) NULL DEFAULT NULL,
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '币种' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of currency
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for merchant
+-- ----------------------------
+DROP TABLE IF EXISTS `merchant`;
+CREATE TABLE `merchant`  (
+  `id` int(0) NOT NULL AUTO_INCREMENT,
+  `created_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+  `updated_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `deleted_at` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+  `username` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '用戶名字',
+  `phone` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '手机号',
+  `password` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '密碼',
+  `salt` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '加密盐',
+  `state` tinyint(0) NOT NULL DEFAULT 0 COMMENT '状态 0:关停,1:激活,2:待激活,3:待审核',
+  `avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '头像',
+  `email` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '邮箱',
+  `pause_transfer` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否暂停转账(0:否,1:是)',
+  `pause_login` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否暂停登录(0:否,1:是)',
+  `transfer_fee_type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '付款手续费收取形式(0:内扣;1:外扣;) ',
+  `join_fee` decimal(10, 2) NOT NULL COMMENT '开户费',
+  `anual_fee` decimal(10, 2) NOT NULL COMMENT '年服务费',
+  `transfer_fee` decimal(10, 2) NOT NULL COMMENT '外币付款手续费(USD)',
+  `transfer_fee_cny` decimal(10, 2) NOT NULL COMMENT '人民币付款手续费(USD)',
+  `confirm_token` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '开户验证码 (google登陆验证器token)',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 67 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户基本信息表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of merchant
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for merchant_account_out
+-- ----------------------------
+DROP TABLE IF EXISTS `merchant_account_out`;
+CREATE TABLE `merchant_account_out`  (
+  `id` int(0) NOT NULL AUTO_INCREMENT,
+  `created_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+  `updated_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `deleted_at` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `merchant_id` int(0) NOT NULL DEFAULT 0 COMMENT '商户ID',
+  `account_num` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '银行的账户编号',
+  `balance_amount` decimal(10, 2) NOT NULL COMMENT '余额',
+  `freeze_amount` decimal(10, 2) NOT NULL COMMENT '冻结的余额',
+  `currency_id` int(0) NULL DEFAULT 0 COMMENT '关联的币种id',
+  `capital_prop` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '资金的属性',
+  `currency_type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '币种',
+  `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 67 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户外部账户表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of merchant_account_out
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for merchant_account_out_log
+-- ----------------------------
+DROP TABLE IF EXISTS `merchant_account_out_log`;
+CREATE TABLE `merchant_account_out_log`  (
+  `id` int(0) NOT NULL AUTO_INCREMENT,
+  `created_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+  `updated_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `deleted_at` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `merchant_id` int(0) NOT NULL DEFAULT 0 COMMENT '商户ID',
+  `accout_num` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '外部账户关联的银行的账户编号',
+  `accout_out_id` int(0) NULL DEFAULT 0 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_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 NULL DEFAULT NULL COMMENT '备注',
+  `loan_mark` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '借贷标识',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 67 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户外部账户余额明细记录' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of merchant_account_out_log
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for merchant_account_out_tpl
+-- ----------------------------
+DROP TABLE IF EXISTS `merchant_account_out_tpl`;
+CREATE TABLE `merchant_account_out_tpl`  (
+  `id` int(0) NOT NULL AUTO_INCREMENT,
+  `created_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+  `updated_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `deleted_at` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `state` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '状态',
+  `currency` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '币种',
+  `currency_type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '货币类型',
+  `currency_type_cn` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '货币类型中文',
+  `account_properties` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '账户属性',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 67 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户外部账户模板表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of merchant_account_out_tpl
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for merchant_account_sys
+-- ----------------------------
+DROP TABLE IF EXISTS `merchant_account_sys`;
+CREATE TABLE `merchant_account_sys`  (
+  `id` int(0) NOT NULL AUTO_INCREMENT,
+  `created_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+  `updated_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `deleted_at` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `merchant_id` int(0) NOT NULL DEFAULT 0 COMMENT '商户ID',
+  `bank_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '银行名称',
+  `bank_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '银行代码',
+  `account_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '账户编号',
+  `account_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '账户名',
+  `account_name_en` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '账户名 英文',
+  `country` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '账户所属的国家/地区',
+  `province` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '账户所属的省/州',
+  `city` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '账户所属的省/州城市',
+  `address` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '详细地址',
+  `postal_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '邮政编码',
+  `swift_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT 'SWIFT CODE',
+  `sys_account_id` int(0) NOT NULL COMMENT '关联的系统账户的子账户 id ',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 67 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户外部账户交易明细' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of merchant_account_sys
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for merchant_contperson
+-- ----------------------------
+DROP TABLE IF EXISTS `merchant_contperson`;
+CREATE TABLE `merchant_contperson`  (
+  `id` int(0) NOT NULL AUTO_INCREMENT,
+  `created_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+  `updated_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `deleted_at` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `merchant_id` int(0) NOT NULL DEFAULT 0 COMMENT '商户ID',
+  `bank_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '银行名称',
+  `bank_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '银行代码',
+  `account_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '账户编号',
+  `account_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '账户名',
+  `account_name_en` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '账户名 英文',
+  `country` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '账户所属的国家/地区',
+  `province` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '账户所属的省/州',
+  `city` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '账户所属的省/州城市',
+  `address` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '详细地址',
+  `postal_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '邮政编码',
+  `swift_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'SWIFT CODE',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 67 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户基本信息表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of merchant_contperson
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for merchant_kyc
+-- ----------------------------
+DROP TABLE IF EXISTS `merchant_kyc`;
+CREATE TABLE `merchant_kyc`  (
+  `id` int(0) NOT NULL AUTO_INCREMENT,
+  `created_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+  `updated_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `deleted_at` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
+  `merchant_id` int(0) NOT NULL DEFAULT 0 COMMENT '商户ID',
+  `company_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '企业名称',
+  `tel` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '电话',
+  `biz_license_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '营业执照号',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 67 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户基本信息表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of merchant_kyc
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for payment_order
+-- ----------------------------
+DROP TABLE IF EXISTS `payment_order`;
+CREATE TABLE `payment_order`  (
+  `id` int(0) NOT NULL AUTO_INCREMENT,
+  `created_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+  `updated_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `deleted_at` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `merchant_id` int(0) NOT NULL DEFAULT 0 COMMENT '商户ID',
+  `from_account_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '来自银行的账户编号',
+  `from_account_id` int(0) NULL DEFAULT 0 COMMENT '来自账户的id',
+  `to_account_id` int(0) NULL 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) NULL 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 NULL DEFAULT NULL COMMENT '备注',
+  `loan_mark` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '借贷标识',
+  `trade_org_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '交易机构的id',
+  `trade_org_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '交易机构代码',
+  `org_trade_no` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '交易机构的交易单号',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 67 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户外部账户余额明细记录' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of payment_order
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for payment_order_ext
+-- ----------------------------
+DROP TABLE IF EXISTS `payment_order_ext`;
+CREATE TABLE `payment_order_ext`  (
+  `id` int(0) NOT NULL AUTO_INCREMENT,
+  `created_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+  `updated_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `deleted_at` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `merchant_id` int(0) NOT NULL DEFAULT 0 COMMENT '商户ID',
+  `accout_num` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '外部账户关联的银行的账户编号',
+  `accout_out_id` int(0) NULL DEFAULT 0 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_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 NULL DEFAULT NULL COMMENT '备注',
+  `loan_mark` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '借贷标识',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 67 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户外部账户余额明细记录' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of payment_order_ext
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for payment_order_log
+-- ----------------------------
+DROP TABLE IF EXISTS `payment_order_log`;
+CREATE TABLE `payment_order_log`  (
+  `id` int(0) NOT NULL AUTO_INCREMENT,
+  `created_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+  `updated_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `deleted_at` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `merchant_id` int(0) NOT NULL DEFAULT 0 COMMENT '商户ID',
+  `accout_num` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '账户关联的银行的账户编号',
+  `accout_id` int(0) NULL DEFAULT 0 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_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 NULL DEFAULT NULL COMMENT '备注',
+  `notify_msg` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '银行机构通知的消息',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 67 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户支付订单记录' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of payment_order_log
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for sys_account
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_account`;
+CREATE TABLE `sys_account`  (
+  `id` int(0) NOT NULL AUTO_INCREMENT,
+  `created_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+  `updated_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `deleted_at` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `pid` int(0) NULL DEFAULT 0 COMMENT '子账户所关联的父账户id',
+  `is_main` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否主账户{ 1:是 ,2:子账户}',
+  `bank_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '银行名称',
+  `bank_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '银行代码',
+  `account_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '账户编号',
+  `account_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '账户名',
+  `account_name_en` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '账户名 英文',
+  `country` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '账户所属的国家/地区',
+  `province` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '账户所属的省/州',
+  `city` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '账户所属的省/州城市',
+  `address` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '详细地址',
+  `postal_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '邮政编码',
+  `swift_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'SWIFT CODE',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 67 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户外部账户交易明细' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of sys_account
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for table_template
+-- ----------------------------
+DROP TABLE IF EXISTS `table_template`;
+CREATE TABLE `table_template`  (
+  `id` int(0) NOT NULL AUTO_INCREMENT,
+  `created_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+  `updated_at` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
+  `deleted_at` datetime(0) NOT NULL COMMENT '修改时间',
+  `state` tinyint(0) NOT NULL DEFAULT 0 COMMENT '狀態 0 待審核  1 審核中 2 正常 4 刪除 -1 已經註銷',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 67 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '后台登錄表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of table_template
+-- ----------------------------
+
+SET FOREIGN_KEY_CHECKS = 1;

+ 0 - 0
doc/sql/currency.sql


+ 0 - 0
doc/sql/merchant.sql


+ 0 - 0
doc/sql/merchant_account_out.sql


+ 0 - 0
doc/sql/merchant_account_out_log.sql


+ 0 - 0
doc/sql/merchant_account_out_tpl.sql


+ 0 - 0
doc/sql/merchant_account_sys.sql


+ 0 - 0
doc/sql/merchant_contperson.sql


+ 0 - 0
doc/sql/merchant_kyc.sql


+ 0 - 0
doc/sql/payment_order.sql


+ 0 - 0
doc/sql/payment_order_log.sql


+ 0 - 0
doc/sql/sys_account.sql


+ 0 - 0
doc/sql/table_template.sql