Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
89eb3877
Commit
89eb3877
authored
Mar 05, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
3da8e404
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
167 additions
and
60 deletions
+167
-60
center-channel/app/base/api/impl/opaction/order.js
+5
-2
center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js
+73
-44
center-channel/app/config/routes/api.js
+42
-11
center-channel/app/config/settings.js
+16
-2
center-channel/app/front/entry/public/apidoc/platform/order.md
+31
-1
No files found.
center-channel/app/base/api/impl/opaction/order.js
View file @
89eb3877
...
...
@@ -4,7 +4,7 @@ var settings = require("../../../../config/settings");
class
ProductAPI
extends
APIBase
{
constructor
()
{
super
();
this
.
utilsOrderSve
=
system
.
getObject
(
"service.utilsSve.utilsOrderSve"
);
this
.
utilsOrderSve
=
system
.
getObject
(
"service.utilsSve.utilsOrderSve"
);
}
/**
* 接口跳转-POST请求
...
...
@@ -26,7 +26,7 @@ class ProductAPI extends APIBase {
var
opResult
=
null
;
switch
(
action_type
)
{
case
"addOrder"
:
//创建订单
opResult
=
await
this
.
utilsOrderSve
.
addOrder
(
pobj
,
pobj
.
actionBody
);
opResult
=
await
this
.
utilsOrderSve
.
addOrder
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getOrderInfo"
:
//获取订单列表信息
opResult
=
await
this
.
utilsOrderSve
.
getOrderInfo
(
pobj
,
pobj
.
actionBody
);
...
...
@@ -43,6 +43,9 @@ class ProductAPI extends APIBase {
case
"getOrderLogInfo"
:
//获取订单日志信息
opResult
=
await
this
.
utilsOrderSve
.
getOrderLogInfo
(
pobj
,
pobj
.
actionBody
);
break
;
case
"delOrder"
:
//删除订单
opResult
=
await
this
.
utilsOrderSve
.
delOrder
(
pobj
,
pobj
.
actionBody
);
break
;
// case "getIcbcOrderDetails"://获取工商详情
// opResult = await this.utilsOrderSve.addOrder(pobj, pobj.actionBody);
// break;
...
...
center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js
View file @
89eb3877
...
...
@@ -8,7 +8,9 @@ class UtilsOrderService extends AppServiceBase {
this
.
utilsPushSve
=
system
.
getObject
(
"service.utilsSve.utilsPushSve"
);
this
.
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
this
.
centerOrderUrl
=
settings
.
centerOrderUrl
();
this
.
tlPayNotifyUrl
=
settings
.
tlPayNotifyUrl
();
this
.
qifuPayAfterH5JumpUrl
=
settings
.
qifuPayAfterH5JumpUrl
();
this
.
qifuPayAfterPcJumpUrl
=
settings
.
qifuPayAfterPcJumpUrl
();
this
.
qifuH5PayNotifyUrl
=
settings
.
qifuH5PayNotifyUrl
();
this
.
centerAppUrl
=
settings
.
centerAppUrl
();
this
.
centerAppPayUrl
=
settings
.
centerAppUrl
()
+
"payment/paymentApi/springBoard"
;
};
...
...
@@ -80,6 +82,14 @@ class UtilsOrderService extends AppServiceBase {
result
.
totalSum
=
actionBody
.
totalSum
;
return
result
;
}
async
delOrder
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
orderNo
)
{
return
system
.
getResult
(
null
,
"actionBody.orderNo can not be empty,100025"
);
}
var
reqUrl
=
this
.
centerOrderUrl
+
"action/order/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
return
result
;
}
async
getOrderInfo
(
pobj
,
actionBody
)
{
var
reqUrl
=
this
.
centerOrderUrl
+
"action/order/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
...
...
@@ -131,7 +141,7 @@ class UtilsOrderService extends AppServiceBase {
/**
* 获取H5支付地址
* @param {*} pobj
* @param {*} actionBody
{orderNo:XXXX}
* @param {*} actionBody
*/
async
getH5PayUrl
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
orderNo
)
{
...
...
@@ -143,11 +153,11 @@ class UtilsOrderService extends AppServiceBase {
if
(
orderResult
.
status
!=
0
)
{
return
orderResult
;
}
// pobj.actionBody.body_desc, pobj.actionBody.total_fee, pobj.actionBody.order_num, pobj.actionBody.returl
pobj
.
actionBody
.
body_desc
=
orderResult
.
data
.
orderProduct
.
channelItemName
;
pobj
.
actionBody
.
total_fee
=
Number
(
orderResult
.
data
.
receiptVoucher
.
totalSum
)
*
100
;
pobj
.
actionBody
.
order_num
=
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
;
pobj
.
actionBody
.
returl
=
this
.
tlPayNotifyUrl
;
pobj
.
actionBody
.
returl
=
orderResult
.
data
.
orderProduct
.
payAfterJumpH5Url
||
this
.
qifuPayAfterH5JumpUrl
;
pobj
.
actionBody
.
notify_url
=
this
.
qifuH5PayNotifyUrl
;
pobj
.
actionType
=
"getH5PayUrl"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
this
.
centerAppPayUrl
);
...
...
@@ -327,7 +337,7 @@ class UtilsOrderService extends AppServiceBase {
}
async
receiveCallBackNotify
(
parmas
,
client_ip
)
{
try
{
if
(
!
parmas
)
{
if
(
!
parmas
||
!
parmas
.
trxcode
)
{
return
system
.
getResult
(
null
,
"回调parmas中参数信息为空,100250"
);
}
//日志记录
...
...
@@ -337,28 +347,14 @@ class UtilsOrderService extends AppServiceBase {
content
:
JSON
.
stringify
(
parmas
),
clientIp
:
client_ip
||
""
});
if
(
parmas
.
trxstatus
&&
parmas
.
trxstatus
==
"0000"
)
{
var
url
=
this
.
centerAppUrl
+
"payment/paymentApi/getAppInfo"
;
var
opResult
=
await
this
.
restPostUrl
({
uappId
:
parmas
.
uappid
},
url
);
if
(
opResult
.
status
!=
0
)
{
return
opResult
;
}
if
(
!
opResult
.
data
)
{
return
system
.
getResult
(
null
,
"应用数据为空,100260"
);
}
// var resultSign = await this.verifySign(parmas, opResult.data.appSecret);
// if (!resultSign || resultSign.status < 0) {
// return resultSign;
// }
var
result
=
await
this
.
opBackNotify
(
parmas
,
opResult
.
data
);
return
result
;
}
else
if
(
parmas
.
trxstatus
==
"3045"
)
{
return
system
.
getResultFail
(
-
100170
,
"超时未支付,请刷新页面,100270"
);
}
return
system
.
getResultFail
(
-
100180
,
"请及时支付,100280"
);
var
param
=
{
"actionBody"
:
{
parmas
:
parmas
},
"client_ip"
:
client_ip
};
var
qftstr
=
await
this
.
restClient
.
execPost
(
param
,
this
.
centerAppUrl
+
"payment/paymentApi/receiveCallBackNotify"
);
var
qftjson
=
JSON
.
parse
(
qftstr
.
stdout
);
return
qftjson
;
}
catch
(
e
)
{
// await this.cacheManager["ZxPayLocker"].release(getParams.trxid);//测试时放开
this
.
logCtl
.
error
({
optitle
:
"回调业务处理---error异常"
,
op
:
"center-app/app/base/service/impl/utilsSve/utilstlbankSve.js/receiveCallBackNotify"
,
...
...
@@ -369,12 +365,44 @@ class UtilsOrderService extends AppServiceBase {
}
}
async
opBackNotify
(
parmas
,
appInfo
)
{
//操作回调业务逻辑
async
opBackNotify
(
parmas
,
client_ip
)
{
//操作回调业务逻辑
try
{
if
(
!
parmas
.
uappid
)
{
return
system
.
getResult
(
null
,
"uappid参数不能为空,100260"
);
}
//日志记录
this
.
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"回调处理订单参数:,method="
+
parmas
.
trxcode
,
op
:
"center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js/opBackNotify"
,
content
:
JSON
.
stringify
(
parmas
),
clientIp
:
client_ip
||
""
});
//获取充值业务锁
// await this.cacheManager["TlPayLocker"].init(parmas.out_trade_no);//---测试时放开
var
locker
=
await
this
.
cacheManager
[
"TlPayLocker"
].
enter
(
parmas
.
out_trade_no
);
if
(
locker
&&
locker
==
"1"
)
{
var
url
=
this
.
centerAppUrl
+
"payment/paymentApi/getAppInfo"
;
var
opResult
=
await
this
.
restPostUrl
({
uappId
:
parmas
.
uappid
},
url
);
if
(
opResult
.
status
!=
0
)
{
opResult
.
msg
=
opResult
.
msg
+
",100270"
;
return
opResult
;
}
var
appInfo
=
opResult
.
data
;
var
resultSign
=
await
this
.
verifySign
(
parmas
,
appInfo
.
uapp_secret
);
if
(
!
resultSign
||
resultSign
.
status
!=
0
)
{
return
resultSign
;
}
//获取充值业务锁
// await this.cacheManager["TlPayLocker"].init(parmas.out_trade_no);//---测试时放开
var
locker
=
await
this
.
cacheManager
[
"TlPayLocker"
].
enter
(
parmas
.
out_trade_no
);
if
(
!
locker
||
locker
!=
"1"
)
{
this
.
logCtl
.
info
({
appid
:
appInfo
.
uapp_id
,
appkey
:
appInfo
.
uapp_key
,
op
:
"center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js/opBackNotify"
,
content
:
"参数="
+
JSON
.
stringify
(
parmas
),
clientIp
:
parmas
.
client_ip
||
""
,
optitle
:
"通联回调操作频繁---太频繁了,太频繁了"
});
return
system
.
getResultFail
(
-
200
,
"回调操作频繁---太频繁了,太频繁了"
);
}
if
(
parmas
.
trxcode
==
"VSP501"
)
{
parmas
.
pay_type
=
"wx"
;
}
else
{
...
...
@@ -386,25 +414,26 @@ class UtilsOrderService extends AppServiceBase {
var
url
=
this
.
centerOrderUrl
+
"opaction/opPayOrder/receivePayCallBackNotify"
;
var
opResult
=
await
this
.
restPostUrl
(
parmas
,
url
);
if
(
opResult
.
status
==
0
)
{
opResult
.
data
.
appInfo
=
{
app_code
:
appInfo
.
app_code
,
app_name
:
appInfo
.
app_name
};
await
this
.
utilsPushSve
.
pushInfo
(
opResult
.
data
,
"pushBusiness"
);
await
this
.
utilsPushSve
.
pushInfo
(
opResult
.
data
,
"pushOrder"
);
}
opResult
.
data
=
null
;
//
opResult.data = null;
return
opResult
;
}
else
{
// await this.cacheManager["TlPayLocker"].release(parmas.out_trade_no);//---测试时放开
this
.
logCtl
.
info
({
appid
:
appInfo
.
uapp_id
,
appkey
:
appInfo
.
uapp_key
,
op
:
"center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js/opBackNotify"
,
content
:
"参数="
+
JSON
.
stringify
(
parmas
),
clientIp
:
parmas
.
client_ip
||
""
,
optitle
:
"通联回调操作频繁---太频繁了,太频繁了"
}
catch
(
e
)
{
await
this
.
cacheManager
[
"TlPayLocker"
].
release
(
parmas
.
out_trade_no
);
this
.
logCtl
.
error
({
optitle
:
"回调处理订单---error异常"
,
op
:
"center-app/app/base/service/impl/utilsSve/utilstlbankSve.js/opBackNotify"
,
content
:
"参数="
+
JSON
.
stringify
(
parmas
)
+
",error:"
+
e
.
stack
,
clientIp
:
client_ip
||
""
});
return
system
.
getResultFail
(
-
200
,
"回调操作频繁---太频繁了,太频繁了"
);
return
system
.
getResultFail
(
-
200
,
e
.
stack
);
}
}
}
module
.
exports
=
UtilsOrderService
;
center-channel/app/config/routes/api.js
View file @
89eb3877
...
...
@@ -7,17 +7,48 @@ const utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
module
.
exports
=
function
(
app
)
{
//-----------------------新的模式------------------开始
app
.
use
(
'/tlpay/notify'
,
async
function
(
req
,
res
)
{
var
client_ip
=
system
.
get_client_ip
(
req
);
var
result
=
await
utilsOrderSve
.
receiveCallBackNotify
(
req
.
body
,
client_ip
);
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录回调处理结果:,method="
+
req
.
body
.
trxcode
,
op
:
"center-channel/tlpay/notify"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"回调结果:"
+
JSON
.
stringify
(
result
),
clientIp
:
client_ip
||
""
});
res
.
end
(
result
);
try
{
var
client_ip
=
system
.
get_client_ip
(
req
);
var
result
=
await
utilsOrderSve
.
receiveCallBackNotify
(
req
.
body
,
client_ip
);
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录回调处理结果:,method="
+
req
.
body
.
trxcode
,
op
:
"center-channel/tlpay/notify"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"回调结果:"
+
JSON
.
stringify
(
result
),
clientIp
:
client_ip
||
""
});
if
(
result
.
status
!=
0
)
{
return
res
.
end
(
"FAIL"
);
}
return
res
.
end
(
"success"
);
}
catch
(
error
)
{
logCtl
.
error
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录回调处理结果异常:,method="
+
req
.
body
.
trxcode
,
op
:
"center-channel/tlpay/notify"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"error:"
+
error
.
stack
,
clientIp
:
client_ip
||
""
});
}
});
app
.
use
(
'/tlpay/opBackNotify'
,
async
function
(
req
,
res
)
{
try
{
var
client_ip
=
system
.
get_client_ip
(
req
);
var
result
=
await
utilsOrderSve
.
opBackNotify
(
req
.
body
,
client_ip
);
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"回调处理订单结果:,method="
+
req
.
body
.
trxcode
,
op
:
"center-channel/tlpay/opBackNotify"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"回调处理订单结果:"
+
JSON
.
stringify
(
result
),
clientIp
:
client_ip
||
""
});
res
.
end
(
JSON
.
stringify
(
result
));
}
catch
(
error
)
{
logCtl
.
error
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录回调处理结果异常:,method="
+
req
.
body
.
trxcode
,
op
:
"center-channel/tlpay/opBackNotify"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"error:"
+
error
.
stack
,
clientIp
:
client_ip
||
""
});
}
});
app
.
all
(
"/web/*"
,
async
function
(
req
,
res
,
next
)
{
var
result
=
system
.
getResult
(
null
,
"req method must is post"
);
if
(
req
.
method
!=
"POST"
)
{
...
...
@@ -56,7 +87,7 @@ module.exports = function (app) {
req
.
body
.
actionProcess
=
result
.
data
.
app_code
;
var
lst
=
[
"addOrder"
,
"getH5PayUrl"
,
"getOrderQrCode"
,
"queryOrderStatus"
,
"getOrderInfo"
,
"getOrderDeliveryInfo"
,
"getOrderDeliveryFlowInfo"
,
"getOrderDeliveryFlowList"
,
"getOrderLogInfo"
,
"updateContacts"
,
"updateTmOrder"
,
"getOrderDeliveryFlowInfo"
,
"getOrderDeliveryFlowList"
,
"getOrderLogInfo"
,
"updateContacts"
,
"updateTmOrder"
,
"delOrder"
,
"getNeedInfo"
,
//---暂时没有用到
"tmConfirm"
,
"updateTmInfo"
,
"updateNclInfo"
,
"updateContacts"
,
...
...
center-channel/app/config/settings.js
View file @
89eb3877
...
...
@@ -20,13 +20,27 @@ var settings = {
usertimeout
:
3600
,
//单位秒
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
port
:
process
.
env
.
NODE_PORT
||
4012
,
tlPayNotify
Url
:
function
()
{
qifuPayAfterH5Jump
Url
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
return
"http://
gsb.qifu.gongsibao.com:4012/tlpay/notify
"
;
return
"http://
tm.qifu.gongsibao.com:4012/#/home/indent_list
"
;
}
else
{
return
"http://gsb.qifu.gongsibao.com/tlpay/notify"
;
}
},
qifuPayAfterPcJumpUrl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
return
"http://tm.qifu.gongsibao.com:4012/#/home/indent_list"
;
}
else
{
return
"http://gsb.qifu.gongsibao.com/tlpay/notify"
;
}
},
qifuH5PayNotifyUrl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
return
"http://gsb.qifu.gongsibao.com:4012/tlpay/notify"
;
}
else
{
return
"http://gsb.qifu.gongsibao.com/tlpay/notify"
;
}
},
paasUrl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
return
"http://p.apps.com:4001/"
;
...
...
center-channel/app/front/entry/public/apidoc/platform/order.md
View file @
89eb3877
...
...
@@ -4,6 +4,7 @@
1.
[
下其他订单
](
#addOtherOrder
)
1.
[
获取订单列表信息
](
#getOrderInfo
)
1.
[
获取订单操作日志信息
](
#getOrderLogInfo
)
1.
[
删除订单
](
#delOrder
)
## **<a name="addOrder"> 下商标订单</a>**
...
...
@@ -58,7 +59,7 @@
"colorizedPicUrl"
:
"https://gsb-zc.oss-cn-beijing.aliyuncs.com/zc_word2picb2bc98b9fc564ef2a1f4b3cbe9352f39.jpg"
,
//商标彩色图样
"tmName"
:
"testbiao"
,
//商标名称
"picUrl"
:
"https://gsb-zc.oss-cn-beijing.aliyuncs.com/zc_word2picb2bc98b9fc564ef2a1f4b3cbe9352f39.jpg"
,
//商标图样
"tmFormType"
:
"3"
//商标类型形式:
1: 立体, 3: 字, 4: 图, 5: 字图, 6: 颜色, 7: 彩色
"tmFormType"
:
"3"
//商标类型形式:
"3": 字, "4": 图, "5": 字图
},
"nclones"
:
[
{
...
...
@@ -275,4 +276,32 @@
"requestId"
:
"f21446617c5e46ad889f3fab7bb69456"
}
```
## **<a name="delOrder"> 删除订单</a>**
[
返回到目录
](
#menu
)
##### URL
[
/web/opaction/order/springBoard
]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 请求头中需要增加userpin(用户登录后的凭证)的值
#### 渠道执行的类型 actionType:delOrder
``` javascript
{
"orderNo":"TM26202002271337mkgN"// Y 订单号
}
```
#### 返回结果
```
javascript
{
"status"
:
0
,
// 0为成功,否则失败
"msg"
:
"success"
,
"data"
:
null
,
"requestId"
:
"f21446617c5e46ad889f3fab7bb69456"
}
```
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment