Commit 83008621 by 王昆

gsb

parent 8d939bf6
......@@ -24,12 +24,11 @@ class InvoiceCtl extends CtlBase {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
// 平台交易列表
async platformPage(params, pobj2, req) {
// 交易信息列表页
async tradePage(params, pobj2, req) {
try {
params.unInvoice = 1;
params.order_type = "10";
params.order_type = params.fee_type;
params.trade_status = "00";
this.doTimeCondition(params, ["createBegin", "createEnd"]);
return await this.tradeSve.itemPage(params);
......@@ -37,15 +36,17 @@ class InvoiceCtl extends CtlBase {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
// 商户交易列表
async merchantPage(params, pobj2, req) {
// 交易列表
async platformPage(params, pobj2, req) {
try {
params.unInvoice = 1;
params.order_type = "20";
params.trade_status = "00";
this.doTimeCondition(params, ["createBegin", "createEnd"]);
return await this.tradeSve.itemPage(params);
if (["00", "10", "20"].indexOf(params.fee_type) == -1) {
return system.getResultSuccess({count:0, rows:[], fee_type: params.fee_type});
}
if(params.fee_type == "00") {
return this.orderPage(params, pobj2, req);
} else {
return this.tradePage(params, pobj2, req);
}
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
......@@ -61,7 +62,6 @@ class InvoiceCtl extends CtlBase {
}
}
// 发票申请
async apply(params, pobj2, req) {
try {
......
......@@ -14,6 +14,18 @@ class MerchantCtl extends CtlBase {
}
}
// 开票类型字典获取
async feeTypeDic(params, pobj2, req) {
try {
// params.forceUpdate = true;
let feeType = await this.merchantSve.getFeeTypeWithCache(params);
let dic = [{"type": "00", "name": "注册订单付款"}, {"type": feeType, "name": "转账交易付款"}];
return system.getResultSuccess(dic);
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
async info(params, pobj2, req) {
try {
return await this.merchantSve.info(params);
......
......@@ -43,7 +43,9 @@ class UserCtl extends CtlBase {
async setLogin(user) {
let loginsid = "saasmcth_" + uuidv4();
// loginsid = "saasmcth_" + "2cb49932-fa02-44f0-90db-9f06fe02e5c7";
if (settings.env = "dev") {
loginsid = "saasmcth_" + "2cb49932-fa02-44f0-90db-9f06fe02e5c7";
}
await this.redisClient.setWithEx(loginsid, JSON.stringify(user), 60 * 60 * 5);
return loginsid;
}
......
......@@ -26,6 +26,7 @@ class MerchantService extends ServiceBase {
if(rs.data && rs.data.sign) {
this.transSignFields([rs.data.sign]);
await this.setChannel([rs.data]);
await this.setMain(rs.data.rows);
}
return rs;
}
......@@ -62,7 +63,7 @@ class MerchantService extends ServiceBase {
async getMerchantWithCache(params) {
let key = this.INFO_KEY + params.id;
let merchant = await this.redisClient.get(key);
if(!merchant || params.forceUpdate) {
if(!merchant || !merchant.id || params.forceUpdate) {
let info = await this.info(params) || {};
merchant = info.data || {};
await this.redisClient.setWithEx(key, JSON.stringify(merchant), 60 * 31);
......@@ -72,6 +73,12 @@ class MerchantService extends ServiceBase {
return merchant;
}
async getFeeTypeWithCache(params) {
let merchant = await this.getMerchantWithCache({id: params.saas_merchant_id}) || {};
let sign = merchant.sign || {};
return sign.main_id_trade ? "10" : "20";
}
async getSettings(merchant_id) {
if(!merchant_id) {
return;
......
......@@ -187,7 +187,7 @@ class System {
merchant: dev + ":3101" + path,
// 订单服务
order: local + ":3103" + path,
order: dev + ":3103" + path,
// 发票服务
invoice: dev + ":3105" + path,
......
<a name="menu">目录</a>
1. [发票申请-功能1-交易列表](#merchantPage)
1. [发票申请-功能2-交易列表](#platformPage)
1. [费用记录类型](#feeTypeDic)
1. [发票申请-功能2-交易&订单列表](#platformPage)
1. [发票申请-功能2](#apply2)
1. [发票申请-功能3-订单列表](#orderPage)
1. [商户抬头](#merchantTitle)
1. [商户地址](#merchantAddr)
1. [商户地址编辑](#merchantAddrSave)
......@@ -10,22 +9,18 @@
1. [发票列表](#invoicePage)
1. [平台查询发票详情](#invoiceOrder)
## **<a name="orderPage"> 发票申请-功能1-交易列表</a>**
## **<a name="feeTypeDic"> 费用记录类型</a>**
[返回到目录](#menu)
##### URL
[/web/saas/invoiceCtl/orderPage]
[/web/saas/merchantCtl/feeTypeDic]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"currentPage": 1,
"pageSize": 10,
"createBegin": "", // 创建时间-开始 可以只选开始,也可以只选结束,格式:2020-04-03
"createEnd": "" // 创建时间-结束
}
{}
```
......@@ -35,40 +30,22 @@
{
"status": 0,
"msg": "success",
"data": {
"count": 1493,
"rows": [
{
"id": "1298463038002876", // id
"trade_no": "T10014949456718", // 打款编号
"acc_name": "11", // 收款户名
"acc_no": "3", // 收款账号
"trade_status": "01", // 交易状态
"trade_status_name": "待处理", // 交易状态名称
"trade_desc": "", // 交易描述
"trade_receipt": "", // 回执图片,判断为空时不显示按钮
"amt": 131083.32, // 商户请求打款金额
"actual_amt": 131083.32, // 实发金额
"service_tax": 2621.66, // 服务费
"deduct_amt": 128535.56, // 总扣款金额
"credit_code": "92321311MA205KN92J", // 信用代码
"out_trade_no": "13695922219233720", // 商户订单号
"created_at": "2020-04-03 11:38:19", // 创建时间
"data": [
{
"type": "00",
"name": "注册订单付款"
},
{
"type": "10",
"name": "转账交易付款"
}
]
}
"order_id": "1298386120003945", // 订单id
"open_bank": "4", // 开户行全称
"trade_time": null, // 交易时间
"remark": "6", // 打款备注
"service_rate": 0, // 服务费比率
}
]
},
"requestid": "d14ae10263ec45ab8cd3be23ab59faf2"
}
```
## **<a name="platformPage"> 发票申请-功能2-交易列表</a>**
## **<a name="platformPage"> 发票申请-功能2-交易&订单列表</a>**
[返回到目录](#menu)
##### URL
[/web/saas/invoiceCtl/platformPage]
......@@ -78,6 +55,7 @@
{
"currentPage": 1,
"pageSize": 10,
"fee_type": "00", // 00 注册订单 10功能2转账交易 20功能3转账交易
"createBegin": "", // 创建时间-开始 可以只选开始,也可以只选结束,格式:2020-04-03
"createEnd": "" // 创建时间-结束
}
......@@ -87,10 +65,13 @@
#### 返回结果
```javascript
fee_type == "00"
{
"status": 0,
"msg": "success",
"data": {
"feeType": "20", // 00 注册订单 10功能2转账交易 20功能3转账交易
"count": 1493,
"rows": [
{
......@@ -121,29 +102,9 @@
},
"requestid": "d14ae10263ec45ab8cd3be23ab59faf2"
}
```
## **<a name="orderPage"> 发票申请-功能3-订单列表</a>**
[返回到目录](#menu)
##### URL
[/web/saas/invoiceCtl/orderPage]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"currentPage": "1",
"pageSize": "10",
"createBegin": "", // 创建时间 开始
"createEnd": "" // 创建时间 结束
}
```
fee_type == "10" || fee_type == "20"
#### 返回结果
```javascript
{
"status": 0,
"msg": "success",
......@@ -186,8 +147,10 @@
},
"requestid": "00521a0a0f094c8d982bf4375fbe91b1"
}
```
## **<a name="merchantTitle"> 商户抬头</a>**
[返回到目录](#menu)
##### URL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment