Pārlūkot izejas kodu

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

liaoxxxx 2 gadi atpakaļ
vecāks
revīzija
4007d533a5

+ 3 - 0
README.md

@@ -59,4 +59,7 @@
 ##   [流程文档](./doc/process/README.md)
 
 
+##   [数据库表结构文档](./doc/model/README.md)
+
+
 

+ 13 - 0
doc/model/README.md

@@ -0,0 +1,13 @@
+
+
+
+### [商户基本信息表](./merchant_struct.md)
+
+
+### [商户外部账户表](./merchant_account_out_struct.md)
+
+### [商户创建系统账户流程](./currency.md)
+
+### [商户充值到外部账户](./merchant/充值到外部账户.md)
+
+

+ 15 - 0
doc/model/currency.md

@@ -0,0 +1,15 @@
+
+###币种信息表 `currency`
+```mysql
+CREATE TABLE `currency` (
+    `id` int NOT NULL AUTO_INCREMENT,
+    `currency_id` 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,
+    `created_at` datetime DEFAULT NULL,
+    `updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+    `deleted_at` datetime DEFAULT NULL,
+    PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='币种';
+```

+ 4 - 2
doc/model/merchant_account_out.uml

@@ -3,17 +3,19 @@
   <ID>DATABASE</ID>
   <OriginalElement>026ac481-c6f6-42b9-bff4-be8d21e53f55.TABLE:crossbordercoll.merchant_account_out</OriginalElement>
   <nodes>
-    <node x="66.5" y="601.0">026ac481-c6f6-42b9-bff4-be8d21e53f55.TABLE:crossbordercoll.merchant_account_out</node>
+    <node x="175.5" y="574.0">026ac481-c6f6-42b9-bff4-be8d21e53f55.TABLE:crossbordercoll.merchant_account_out</node>
     <node x="0.0" y="0.0">026ac481-c6f6-42b9-bff4-be8d21e53f55.TABLE:crossbordercoll.merchant</node>
   </nodes>
   <notes />
   <edges>
     <edge source="026ac481-c6f6-42b9-bff4-be8d21e53f55.TABLE:crossbordercoll.merchant_account_out" target="026ac481-c6f6-42b9-bff4-be8d21e53f55.TABLE:crossbordercoll.merchant" relationship="REFERENCES">
       <point x="0.0" y="-142.5" />
+      <point x="320.5" y="535.0" />
+      <point x="211.5" y="535.0" />
       <point x="0.0" y="234.5" />
     </edge>
   </edges>
-  <settings layout="Hierarchic" zoom="1.0" showDependencies="false" x="211.5" y="402.0" />
+  <settings layout="Hierarchic" zoom="1.0" showDependencies="false" x="54.0" y="442.0" />
   <SelectedNodes>
     <node>026ac481-c6f6-42b9-bff4-be8d21e53f55.TABLE:crossbordercoll.merchant_account_out</node>
   </SelectedNodes>

+ 23 - 0
doc/model/merchant_account_out_struct.md

@@ -0,0 +1,23 @@
+
+###商户外部账户表 `merchant_account_out`
+```mysql
+CREATE TABLE `merchant_account_out` (
+    `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 '银行的账户编号',
+    `balance_amount` decimal(10,2) NOT NULL COMMENT '余额',
+    `freeze_amount` decimal(10,2) NOT NULL COMMENT '冻结的余额',
+    `capital_prop` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '资金的属性',
+    `currency_id` int DEFAULT '0' COMMENT '关联的币种id',
+    `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='商户外部账户表';
+```
+
+> merchant_id 关联 [merchant.id](./merchant_struct.md) 
+
+> `currency_id` 关联 [currency.id](./currency.md),   `currency_type`  关联 [currency.currency_type](./currency.md)

+ 20 - 0
doc/model/merchant_account_out_tpl_struct.md

@@ -0,0 +1,20 @@
+
+###商户外部账户模板表 `merchant_account_out_tpl`
+```mysql
+CREATE TABLE `merchant_account_out_tpl` (
+   `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 '修改时间',
+   `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 DEFAULT NULL COMMENT '账户属性',
+   PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=67 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)

+ 26 - 0
doc/model/merchant_struct.md

@@ -0,0 +1,26 @@
+
+###商户基本信息表 `merchant`
+```mysql
+CREATE TABLE `merchant` (
+       `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 '修改时间',
+       `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 NOT NULL DEFAULT '0' COMMENT '状态 0:关停,1:激活,2:待激活,3:待审核',
+       `avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '头像',
+       `email` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci 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) NOT NULL COMMENT '开户验证码 (google登陆验证器token)',
+       PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='商户基本信息表';
+```

+ 49 - 7
doc/process/merchant/充值到外部账户.md

@@ -1,12 +1,41 @@
-## 商户注册入驻
-### 入驻
-### 1.商户发起充值  
-> 要素 :金额,币种,充值方式 ,指定外部钱包 
+## 商户充值到外部账户
+### 流程图-红色
+
+
+### ![流程图-红色](./../商户充值到外部账户.png)
 
+<hr>
 <br>
 
-### 2.平台生成充值记录单
+### 1.商户发起充值  
 
+> 要素 :金额,币种,充值方式 ,指定外部钱包
+
+```js
+// 1.获取配置
+let config=  http.get("/payment/config",{
+    types:"charge"
+})  
+
+// 提交充值的账户 ,金额,等
+http.post("",{
+    amount:10000.00,
+    //currencyID:88,  // 币种 CNY
+    paymentChannel:"wechat",  //"alipay" unionpay
+    accountID:"2332"
+})
+```
+
+
+<br>
+
+### 2.平台生成充值记录单,下发数据到客户端
+```go
+ orderSn:="charge".util.PayTool.GenOrderSn()    //生成充值单号  charge202204221059590001
+ qrcode :.util.PayTool.chargeQrcode(types,amount,paymentChannel,accountID)  //生成二维码
+ data:={orderSn,qrcode}
+ ctx.JsonSucess(200,data)
+```
 
 
 
@@ -15,15 +44,28 @@
 
 ### 3.商户存入款项到平台
 
-> 充值方式 : 支付宝,微信,扫码、直接转帐 ,银行卡转帐
+> 充值方式 : 支付宝,微信,扫码、直接转帐 ,银行卡转帐
 
 <br>
 
-### 4.系统运营人员在管理后台 审核通过
+### 4.系统运营人员在管理后台 审核通过  `银行卡转帐`,`线下交易`等方式需要审核(略)
 
 <br>
 
 ### 5. 增加指定外部钱包的余额
+#### 5.1 增加外部账户钱包余额 `merchant_account_out`
+
+```go
+
+```
+
+
+#### 5.2 写入日志到 `merchant_account_out_log`
+
+```go
+
+
 
+```
 <br>
 

BIN
doc/process/商户充值到外部账户.png


BIN
doc/源文档/跨境管理系统概要设计-V1.0.0.docx


BIN
doc/源文档/需求说明 - 1.0.docx


+ 25 - 0
doc/词语释义.md

@@ -0,0 +1,25 @@
+## 伞型账户
+#### 主账户 下可以开通多个子账户 具备实体功能
+#### 平台在银行渠道会有一个主账户  这个主账户下申请多个子账户 
+#### 商户可以根据  业务类 可以申请 创建 银行子账户
+
+## 换汇
+
+#### 换汇 从是 商户从余额  划出到平台  ,平台再 转账到境外的银行账户,转换成其他货币?
+#### 外币 换 外币包含CNH
+
+
+## SWIFT Code
+```
+银行国际代码(SWIFT Code)是由SWIFT协会提出并被ISO通过的银行识别代码,凡该协会的成员银行都有自己特定的SWIFT代码.
+在电汇时,汇出行按照收款行的SWIFT CODE发送付款电文,就可将款项汇至收款行。该号相当于各个银行的身份证号。
+其原名是BIC(Bank Identifier Code),但是BIC这个名字意思太泛,担心有人理解成别的银行识别代码系统,
+故渐渐大家约定俗成地把BIC叫作SWIFT Code了。SWIFT是(Society for Worldwide Interbank Financial
+Telecommunications)环球银行间金融通信协会是一个由金融机构共同拥有的私营股份公司,按比利时的法律登记注册,
+由会员银行和其他金融机构协同管理。
+```
+
+
+
+##  外币转本币
+#### 1.多币种钱包  2.外币转CNH再下发 都需要经过银行 2.商户需要的是外币转成人民币,而不是人民币转外币