Преглед изворни кода

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

liaoxxxx пре 2 година
родитељ
комит
9e3ffa8794

+ 14 - 5
doc/model/README.md

@@ -1,20 +1,29 @@
 
-
+## sql 文件 `/doc/sql/crossbordercoll.sql`
 
 ### [商户基本信息表](./merchant_struct.md)
 
+### [商户KYC信息表](./merchant_kyc.md)
+
+### [商户外部账户模板表](./merchant_account_out_tpl_struct.md)
 
 ### [商户外部账户表](./merchant_account_out_struct.md)
 
+### [商户系统帐户](./merchant_account_sys.md)
+
 ### [币种](./currency.md)
 
-### [商户充值到外部账户记录](./merchant_account_out_log.md)
+### [渠道](./channel.md)
 
+### [银行](./bank.md)
 
-### [交易订单记录](./payment_order.md)
+### [区域](./area.md)
 
+### [平台的银行帐户](./sys_account.md)
 
-### [交易订单日志](./payment_order_log.md)
+### [商户充值到外部账户记录](./merchant_account_out_log.md)
 
+### [交易订单记录](./payment_order.md)
+
+### [交易订单日志](./payment_order_log.md)
 
-### [商户系统帐户](./merchant_account_sys.md)

+ 27 - 0
doc/model/area.md

@@ -0,0 +1,27 @@
+##  区域记录表
+
+> area_en :区域名称 如:Guangxi  ,
+>
+> area_name  : 区域名称 如:广西   ,
+> 
+> level:区域级别 定义 1 :国家或地区 ,2省或州级别 3:城市 ;
+>
+> pid :下级区域关联的父级区域的id
+> 
+> postal_code :邮政编码 
+```mysql
+CREATE TABLE `area` (
+    `id` int NOT NULL AUTO_INCREMENT,
+    `area_id` bigint DEFAULT NULL,
+    `area_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
+    `area_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
+    `state` int DEFAULT NULL,
+    `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 '修改时间',
+    `pid` int DEFAULT '0' COMMENT '关联上一级区域',
+    `level` int DEFAULT NULL COMMENT '区域级别 1 :国家或地区 ,2省或州级别 3:城市  ',
+    `postal_code` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '邮政编码',
+    PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='行政区域';
+```

+ 20 - 0
doc/model/bank.md

@@ -0,0 +1,20 @@
+##  银行记录表
+
+> bank_code :关联银行记录[bank.bank_code](./bank.md)  ,
+>
+> bank_name  : 关联银行记录[bank.bank_name](./bank.md)  ,
+
+
+
+```mysql
+CREATE TABLE `bank` (
+   `id` int NOT NULL AUTO_INCREMENT,
+   `bank_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
+   `bank_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '币种类型',
+   `state` int DEFAULT NULL,
+   `created_at` datetime DEFAULT NULL,
+   `updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+   `deleted_at` datetime DEFAULT NULL,
+   PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='币种';
+```

+ 27 - 0
doc/model/channel.md

@@ -0,0 +1,27 @@
+### 交易渠道表
+> channel_name: 渠道名称
+> 
+> channel_code: 渠道代码
+> 
+> area : 关联区域的id[area.id](./area.md)
+>
+> supported_currencies : 支持的币种id,多个币种id的数组json字符[area.id](./area.md) 如`[1,2,3,..]`
+
+
+```mysql
+CREATE TABLE `channel` (
+  `id` int NOT NULL AUTO_INCREMENT,
+  `channel_id` bigint DEFAULT NULL,
+  `channel_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
+  `channel_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '渠道名称',
+  `docking_method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '对接方式',
+  `channel_type` int DEFAULT NULL,
+  `area` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '区域',
+  `supported_currencies` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '支持的币种',
+  `state` int DEFAULT NULL,
+  `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 '修改时间',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
+```

+ 37 - 0
doc/model/merchant_account_out_log.md

@@ -0,0 +1,37 @@
+
+###商户充值到外部账户记录 `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_num :  关联商户的外部账户记录的银行帐户编号  [merchant_account_out.account_num](./merchant_account_out_struct.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',
+  `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 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=1 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='商户外部账户余额明细记录';
+```

+ 1 - 1
doc/model/merchant_account_out_struct.md

@@ -15,7 +15,7 @@ CREATE TABLE `merchant_account_out` (
     `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 DEFAULT NULL COMMENT '备注',
     PRIMARY KEY (`id`) USING BTREE
-) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='商户外部账户表';
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='商户外部账户表';
 ```
 
 > merchant_id 关联 [merchant.id](./merchant_struct.md) 

+ 6 - 4
doc/model/merchant_account_out_tpl_struct.md

@@ -12,9 +12,11 @@ CREATE TABLE `merchant_account_out_tpl` (
    `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 DEFAULT NULL COMMENT '账户属性',
    PRIMARY KEY (`id`) USING BTREE
-) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='商户外部账户模板表';
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='商户外部账户模板表';
 ```
 
-> merchant_id 关联 [merchant.id](./merchant_struct.md) 
-
-> `currency_id` 关联 [currency.id](./currency.md),   `currency_type`  关联 [currency.currency_type](./currency.md)
+> currency: 关联币种的id [currency.id](./merchant_struct.md)
+> 
+> `currency_type_cn`: 币种中文名称 关联[currency.currency_name](./currency.md), .
+> 
+> `currency_type`:  关联币种国际代码 [currency.currency_code](./currency.md)

+ 6 - 2
doc/model/merchant_account_sys.md

@@ -1,8 +1,12 @@
 
 ###商户系统账户表 `merchant_account_out`
+> merchant_id: 关联商户的id  [merchant.id](./merchant_struct.md)
+>
 >  sys_account_id :关联系统的银行帐户id 
+
+>  currency_id :关联货币id[currency.id](./currency.md)
 > 
-> 
+>  currency_type :关联货币的类型[currency.currency_type](./currency.md)
 ```mysql
 CREATE TABLE `merchant_account_sys` (
    `id` int NOT NULL AUTO_INCREMENT,
@@ -19,7 +23,7 @@ CREATE TABLE `merchant_account_sys` (
    `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 DEFAULT NULL COMMENT '备注',
    PRIMARY KEY (`id`) USING BTREE
-) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='商户外部账户表';
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='商户外部账户表';
 ```
 
 > merchant_id 关联 [merchant.id](./merchant_struct.md) 

+ 27 - 0
doc/model/merchant_kyc.md

@@ -0,0 +1,27 @@
+
+###商户基本信息表 `merchant`
+
+
+> merchant_id: 关联商户的id  [merchant.id](./merchant_struct.md)
+> 
+> company_name:企业名称,
+> 
+> tel: 电话,
+> 
+> biz_license_code:  营业执照号,
+
+
+
+```mysql
+CREATE TABLE `merchant_kyc` (
+    `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 DEFAULT NULL COMMENT '修改时间',
+    `merchant_id` int 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 DEFAULT NULL COMMENT '营业执照号',
+    PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='商户基本信息表';
+```

+ 1 - 1
doc/model/merchant_struct.md

@@ -46,5 +46,5 @@ CREATE TABLE `merchant` (
        `transfer_fee_cny` decimal(10,2) NOT NULL COMMENT '人民币付款手续费(USD)',
        `confirm_token` varchar(64) NOT NULL COMMENT '开户验证码 (google登陆验证器token)',
        PRIMARY KEY (`id`) USING BTREE
-) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='商户基本信息表';
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='商户基本信息表';
 ```

+ 14 - 4
doc/model/payment_order.md

@@ -5,17 +5,25 @@
 > 
 > trade_no: 由平台生成的交易单号
 > 
-> from_account_no []
+> from_account_no :转出账户,关联银行机构的帐户号 [merchant_account_sys.account_num](./merchant_account_sys.md)
 > 
+> from_account_id :转出账户id, [merchant_account_sys.id](./merchant_account_sys.md)
+>
+> to_account_id :转入账户,关联银行机构的帐户号 [merchant_account_sys.account_num](./merchant_account_sys.md)
 > 
+> to_account_no :转入账户,关联银行机构的帐户号 [merchant_account_sys.id](./merchant_account_sys.md)
 > 
+> channel_id: 交易渠道的id: 关联[channel.id](./channel.md)
 > 
+> exchange_rate : 交易时的汇率
 > 
+> from_currency_id :交易来自货币,关联[currency.id](./currency.md)
 > 
+> to_currency_id :交易的目标货币,关联[currency.id](./currency.md)
 > 
+> trade_org_id: 交易机构的id',关联[bank.id](./currency.md)
 > 
-> 
-
+>trade_org_code: 交易机构账户,关联[bank.id](./currency.md)
 
 ```mysql
 CREATE TABLE `payment_order` (
@@ -29,6 +37,7 @@ CREATE TABLE `payment_order` (
   `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 '转到银行的账户编号',
+  `channel_id` int DEFAULT NULL COMMENT '交易渠道id',
   `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 '来自币种',
@@ -40,6 +49,7 @@ CREATE TABLE `payment_order` (
   `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 '交易机构的交易单号',
+  `state` tinyint DEFAULT NULL COMMENT '交易状态',
   PRIMARY KEY (`id`) USING BTREE
-) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='商户外部账户余额明细记录';
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='商户外部账户余额明细记录';
 ```

+ 1 - 1
doc/model/payment_order_log.md

@@ -29,5 +29,5 @@ CREATE TABLE `payment_order_log` (
   `local_request` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '本地向银行机构发起的请求信息',
   `notify_msg` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '银行机构通知的消息',
   PRIMARY KEY (`id`) USING BTREE
-) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='商户支付订单记录';
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='商户支付订单记录';
 ```

+ 44 - 0
doc/model/sys_account.md

@@ -0,0 +1,44 @@
+##  系统银行记录表
+> 伞形账户的主账户 由`is_main`判断, 主账户 有多个子账户
+> 
+> 伞形账户的子账户的pid关联当前银行记录表的主账户
+
+> is_main :是否主账户,主账户关联本表的一个或多个子账户
+>
+> pid` int DEFAULT '0' COMMENT '子账户所关联的父账户id
+>
+> bank_id: 关联银行记录的id[bank.id](./bank.md)  ,
+>
+> bank_code :关联银行记录[bank.bank_code](./bank.md)  ,
+>
+> bank_name  : 关联银行记录[bank.bank_name](./bank.md)  ,
+> 
+> area_id : 关联区域的id[area.id](./area.md)
+>
+> postal_code : 关联区域的邮政编码[area.postal_code](./area.md)
+>
+> swift_code :国际结算系统中编号
+
+
+```mysql
+CREATE TABLE `sys_account` (
+  `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 '修改时间',
+  `pid` int 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_num` 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 '账户所属的省/州',
+  `area_id` 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 DEFAULT NULL COMMENT 'SWIFT CODE',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='商户外部账户交易明细';
+```

+ 54 - 43
doc/sql/crossbordercoll.sql

@@ -11,7 +11,7 @@
  Target Server Version : 80024
  File Encoding         : 65001
 
- Date: 24/04/2022 16:20:04
+ Date: 24/04/2022 17:57:33
 */
 
 SET NAMES utf8mb4;
@@ -36,66 +36,68 @@ CREATE TABLE `admin_u`  (
   `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;
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '后台登錄表' ROW_FORMAT = Dynamic;
 
 -- ----------------------------
 -- Records of admin_u
 -- ----------------------------
 
 -- ----------------------------
+-- Table structure for area
 -- ----------------------------
-DROP TABLE IF EXISTS `channel`;
-CREATE TABLE `channel`  (
+DROP TABLE IF EXISTS `area`;
+CREATE TABLE `area`  (
   `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 '支持的币种',
+  `area_id` bigint(0) NULL DEFAULT NULL,
+  `area_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+  `area_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 '修改时间',
+  `pid` int(0) NULL DEFAULT 0 COMMENT '关联上一级区域',
+  `level` int(0) NULL DEFAULT NULL COMMENT '区域级别 1 :国家或地区 ,2省或州级别 3:城市  ',
+  `postal_code` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '邮政编码',
   PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '行政区域' ROW_FORMAT = Dynamic;
 
 -- ----------------------------
+-- Records of area
 -- ----------------------------
 
 -- ----------------------------
+-- Table structure for bank
 -- ----------------------------
-DROP TABLE IF EXISTS `city`;
-CREATE TABLE `city`  (
+DROP TABLE IF EXISTS `bank`;
+CREATE TABLE `bank`  (
   `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,
+  `bank_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+  `bank_code` 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 '修改时间',
+  `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 ROW_FORMAT = Dynamic;
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '币种' ROW_FORMAT = Dynamic;
 
 -- ----------------------------
+-- Records of bank
 -- ----------------------------
 
 -- ----------------------------
+-- Table structure for channel
 -- ----------------------------
-DROP TABLE IF EXISTS `country`;
-CREATE TABLE `country`  (
+DROP TABLE IF EXISTS `channel`;
+CREATE TABLE `channel`  (
   `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,
+  `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 '修改时间',
@@ -103,7 +105,7 @@ CREATE TABLE `country`  (
 ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
 
 -- ----------------------------
+-- Records of channel
 -- ----------------------------
 
 -- ----------------------------
@@ -151,7 +153,7 @@ CREATE TABLE `merchant`  (
   `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;
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户基本信息表' ROW_FORMAT = Dynamic;
 
 -- ----------------------------
 -- Records of merchant
@@ -175,7 +177,7 @@ CREATE TABLE `merchant_account_out`  (
   `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;
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户外部账户表' ROW_FORMAT = Dynamic;
 
 -- ----------------------------
 -- Records of merchant_account_out
@@ -191,8 +193,8 @@ CREATE TABLE `merchant_account_out_log`  (
   `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',
+  `account_num` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '外部账户关联的银行的账户编号',
+  `account_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 '交易的金额',
@@ -202,7 +204,7 @@ CREATE TABLE `merchant_account_out_log`  (
   `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;
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户外部账户余额明细记录' ROW_FORMAT = Dynamic;
 
 -- ----------------------------
 -- Records of merchant_account_out_log
@@ -223,7 +225,7 @@ CREATE TABLE `merchant_account_out_tpl`  (
   `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;
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户外部账户模板表' ROW_FORMAT = Dynamic;
 
 -- ----------------------------
 -- Records of merchant_account_out_tpl
@@ -248,7 +250,7 @@ CREATE TABLE `merchant_account_sys`  (
   `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;
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户外部账户表' ROW_FORMAT = Dynamic;
 
 -- ----------------------------
 -- Records of merchant_account_sys
@@ -276,7 +278,7 @@ CREATE TABLE `merchant_contperson`  (
   `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;
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户基本信息表' ROW_FORMAT = Dynamic;
 
 -- ----------------------------
 -- Records of merchant_contperson
@@ -296,7 +298,7 @@ CREATE TABLE `merchant_kyc`  (
   `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;
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户基本信息表' ROW_FORMAT = Dynamic;
 
 -- ----------------------------
 -- Records of merchant_kyc
@@ -317,6 +319,7 @@ CREATE TABLE `payment_order`  (
   `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 '转到银行的账户编号',
+  `channel_id` int(0) NULL DEFAULT NULL COMMENT '交易渠道id',
   `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 '来自币种',
@@ -328,8 +331,9 @@ CREATE TABLE `payment_order`  (
   `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 '交易机构的交易单号',
+  `state` tinyint(0) 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;
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户外部账户余额明细记录' ROW_FORMAT = Dynamic;
 
 -- ----------------------------
 -- Records of payment_order
@@ -356,7 +360,7 @@ CREATE TABLE `payment_order_ext`  (
   `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;
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户外部账户余额明细记录' ROW_FORMAT = Dynamic;
 
 -- ----------------------------
 -- Records of payment_order_ext
@@ -379,7 +383,7 @@ CREATE TABLE `payment_order_log`  (
   `local_msg` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '本地向银行机构发起的请求信息',
   `org_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;
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户支付订单记录' ROW_FORMAT = Dynamic;
 
 -- ----------------------------
 -- Records of payment_order_log
@@ -396,19 +400,20 @@ CREATE TABLE `sys_account`  (
   `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_id` int(0) NULL DEFAULT NULL 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_num` 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 '账户所属的省/州城市',
+  `area_id` 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;
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '商户外部账户交易明细' ROW_FORMAT = Dynamic;
 
 -- ----------------------------
 -- Records of sys_account
@@ -425,7 +430,7 @@ CREATE TABLE `table_template`  (
   `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;
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '后台登錄表' ROW_FORMAT = Dynamic;
 
 -- ----------------------------
 -- Records of table_template