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
9aa53296
Commit
9aa53296
authored
Jun 23, 2020
by
linboxuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uncommune order api
parent
50df8206
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
167 additions
and
18 deletions
+167
-18
center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js
+110
-7
center-channel/app/base/service/impl/utilsSve/utilsUcommuneSve.js
+57
-11
No files found.
center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js
View file @
9aa53296
...
...
@@ -2,6 +2,8 @@ const system = require("../../../system");
var
settings
=
require
(
"../../../../config/settings"
);
const
querystring
=
require
(
'querystring'
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
axios
=
require
(
'axios'
)
const
md5
=
require
(
'md5'
)
class
UtilsOrderService
extends
AppServiceBase
{
constructor
()
{
super
();
...
...
@@ -578,12 +580,20 @@ class UtilsOrderService extends AppServiceBase {
return
system
.
getResult
(
null
,
"trade_status状态有误,100473"
);
}
// 2020 0621 支付宝验签接口
// var url = this.centerAppUrl + "payment/aliPayment/verifyAliPayReturnSign";
// var url = this.centerAppUrl + "";
// var opResult = await this.restPostUrl(parmas, url);
// if (opResult.status != 0) {
// opResult.msg = opResult.msg + ",100480";
// return opResult;
// var url = "https://yf-api.gongsibao.com/pay/v1/checkAliPaySign";
// let params = {
// "app": "ukgc", //应用名称 固定
// "key": "a1519e2eab53dfb909e4c32a86b2ea2b", //应用 key 固定
// "tData" : params
// }
// var sign = JSON.stringify(params);
// sign += "ab53dfb909e4c32a"
// sign = md5(sign).toUpperCase()
// params.sign = sign
// let res = await axios.post(url, params)
// if (res.status != 0) {
// res.msg = res.msg + ",100480";
// return res;
// }
// 模拟验签结果
var
outTradeInfo
=
parmas
.
out_trade_no
.
split
(
'-'
);
...
...
@@ -600,7 +610,7 @@ class UtilsOrderService extends AppServiceBase {
this
.
logCtl
.
info
({
appid
:
opResult
.
data
.
uappId
,
appkey
:
""
,
op
:
"service/impl/utilsSve/utilsOrderSve.js/
opH5AliDingPayBack
Notify"
,
op
:
"service/impl/utilsSve/utilsOrderSve.js/
aliPay
Notify"
,
content
:
"参数="
+
JSON
.
stringify
(
parmas
),
clientIp
:
parmas
.
client_ip
||
""
,
optitle
:
"阿里回调操作频繁---太频繁了,太频繁了"
...
...
@@ -645,5 +655,98 @@ class UtilsOrderService extends AppServiceBase {
return
system
.
getResultFail
(
-
200
,
e
.
stack
);
}
}
async
wxPayNotify
(
parmas
,
client_ip
)
{
// 微信宝回调
try
{
//日志记录
this
.
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"微信回调参数信息"
,
op
:
"service/impl/utilsSve/utilsOrderSve.js/wxPayNotify"
,
content
:
JSON
.
stringify
(
parmas
),
clientIp
:
client_ip
||
""
});
if
(
!
parmas
.
trade_status
)
{
return
system
.
getResult
(
null
,
"trade_status参数不能为空,100470"
);
}
if
(
parmas
.
trade_status
!=
"TRADE_FINISHED"
&&
parmas
.
trade_status
!=
"TRADE_SUCCESS"
)
{
return
system
.
getResult
(
null
,
"trade_status状态有误,100473"
);
}
// 2020 0621 支付宝验签接口
// var url = "https://yf-api.gongsibao.com/pay/v1/checkAliPaySign";
// let params = {
// "app": "ukgc", //应用名称 固定
// "key": "a1519e2eab53dfb909e4c32a86b2ea2b", //应用 key 固定
// "tData" : params
// }
// var sign = JSON.stringify(params);
// sign += "ab53dfb909e4c32a"
// sign = md5(sign).toUpperCase()
// params.sign = sign
// let res = await axios.post(url, params)
// if (res.status != 0) {
// res.msg = res.msg + ",100480";
// return res;
// }
// 模拟验签结果
var
outTradeInfo
=
parmas
.
out_trade_no
.
split
(
'-'
);
//
var
opResult
=
{}
opResult
.
data
=
{
orderNo
:
outTradeInfo
[
0
],
uappId
:
Number
(
outTradeInfo
[
1
]),
productId
:
outTradeInfo
.
length
==
3
?
Number
(
outTradeInfo
[
2
])
:
0
}
// 拿锁
var
locker
=
await
this
.
cacheManager
[
"TlPayLocker"
].
enter
(
opResult
.
data
.
orderNo
);
if
(
!
locker
||
locker
!=
"1"
)
{
this
.
logCtl
.
info
({
appid
:
opResult
.
data
.
uappId
,
appkey
:
""
,
op
:
"service/impl/utilsSve/utilsOrderSve.js/wxPayNotify"
,
content
:
"参数="
+
JSON
.
stringify
(
parmas
),
clientIp
:
parmas
.
client_ip
||
""
,
optitle
:
"微信回调操作频繁---太频繁了,太频繁了"
});
return
system
.
getResultFail
(
-
200
,
"微信回调操作频繁---太频繁了,太频繁了"
);
}
parmas
.
appInfo
=
{
appInfo
:
{
uapp_id
:
opResult
.
data
.
uappId
}
};
parmas
.
orderNo
=
opResult
.
data
.
orderNo
;
parmas
.
pay_type
=
"alipay"
;
//修改并返回订单支付状态,创建收款单
// 这里修改了order_info的状态(status/paytime等)
var
url
=
this
.
centerOrderUrl
+
"opaction/opPayOrder/receivePayCallBackNotifyByAliDing"
;
var
opOrderResult
=
await
this
.
restPostUrl
(
parmas
,
url
);
if
(
opOrderResult
.
status
!=
0
)
{
opOrderResult
.
data
=
null
;
return
opOrderResult
;
}
opOrderResult
.
data
.
appInfo
=
{
uapp_id
:
opResult
.
data
.
uappId
};
opOrderResult
.
data
.
userInfo
=
{
channel_userid
:
opOrderResult
.
data
.
order_info
.
channelUserId
,
channel_username
:
opOrderResult
.
data
.
order_info
.
channelUserId
,
channel_nickname
:
opOrderResult
.
data
.
order_info
.
channelUserId
};
opOrderResult
.
data
.
orderNo
=
opResult
.
data
.
orderNo
;
var
pobj
=
{
appInfo
:
opOrderResult
.
data
.
appInfo
,
actionBody
:
opOrderResult
.
data
}
this
.
utilsPushSve
.
pushBusInfo
(
pobj
,
"createAliTmApply"
,
1
);
opOrderResult
.
data
=
null
;
return
opOrderResult
;
}
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
,
e
.
stack
);
}
}
}
module
.
exports
=
UtilsOrderService
;
center-channel/app/base/service/impl/utilsSve/utilsUcommuneSve.js
View file @
9aa53296
...
...
@@ -51,6 +51,7 @@ class UtilsUcommuneService extends AppServiceBase {
* @param {*} actionBody
*/
async
ucommuneGetOrderList
(
pobj
,
actionBody
)
{
// ucommuneGetOrderList
var
reqUrl
=
this
.
centerOrderUrl
+
"action/ucommuneOrder/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
console
.
log
(
"-------------ucommuneGetOrderList result start---------------"
)
...
...
@@ -103,9 +104,10 @@ class UtilsUcommuneService extends AppServiceBase {
params
.
sign
=
sign
let
res
=
await
axios
.
post
(
creatPayRequrl
,
params
)
if
(
res
.
status
==
200
&&
res
.
data
.
code
==
200
)
{
await
this
.
cacheManager
[
"TlPayLocker"
].
init
(
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
);
return
system
.
getResultSuccess
(
res
.
data
)
}
return
system
.
getResult
(
null
,
res
.
data
.
msg
);
return
system
.
getResult
(
null
,
res
.
data
);
// let sign = await PayUtil.getSign(null,"1")
// let params = {
// "partner" : "2019022163300183" ,
...
...
@@ -194,18 +196,62 @@ class UtilsUcommuneService extends AppServiceBase {
// console.log(alipayResponse);
}
if
(
actionBody
.
payWay
==
3
)
{
// 微信
let
requrl
=
"
"
;
let
creatPayRequrl
=
"https://yf-api.gongsibao.com/pay/v1/createSign
"
;
let
params
=
{
'body'
:
orderResult
.
data
.
orderProduct
.
channelItemName
,
"outTradeNo"
:
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
+
"-"
+
pobj
.
appInfo
.
uapp_id
.
toString
()
+
"-"
+
orderResult
.
data
.
orderProduct
.
id
.
toString
(),
"totalAmount"
:
Number
(
orderResult
.
data
.
receiptVoucher
.
totalSum
),
"spbill_create_ip"
:
"192.168.2.210"
,
"notifyUrl"
:
this
.
centerChannelUrl
+
"orderNotify/wxPayNotify"
,
"trade_type"
:
"APP"
,
"app"
:
"ukgc"
,
"key"
:
"a1519e2eab53dfb909e4c32a86b2ea2b"
,
"payParam"
:
[
{
"name"
:
"body"
,
"value"
:
orderResult
.
data
.
orderProduct
.
channelItemName
},
{
"name"
:
"outTradeNo"
,
"value"
:
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
+
"-"
+
pobj
.
appInfo
.
uapp_id
.
toString
()
+
"-"
+
orderResult
.
data
.
orderProduct
.
id
.
toString
()
},
{
"name"
:
"totalFee"
,
"value"
:
orderResult
.
data
.
receiptVoucher
.
totalSum
},
{
"name"
:
"spbillCreateIp"
,
"value"
:
'192.168.2.210'
},
{
"name"
:
"notifyUrl"
,
"value"
:
this
.
centerChannelUrl
+
"orderNotify/wxPayNotify"
},
{
"name"
:
"tradeType"
,
"value"
:
"JSAPI"
},
{
"name"
:
"nonceStr"
,
"value"
:
"5K8264ILTKCH16CQ2502SI8ZNMTM67VS"
}
],
"paymentType"
:
"3"
}
let
res
=
await
axios
(
reqUrl
,
params
)
console
.
log
(
res
);
// let params = {
// "app": "ukgc",//固定
// 'body': orderResult.data.orderProduct.channelItemName,
// "key": "a1519e2eab53dfb909e4c32a86b2ea2b",//固定
// "notifyUrl" : this.centerChannelUrl + "orderNotify/aliPayNotify",
// "outTradeNo": orderResult.data.receiptVoucher.sourceOrderNo + "-" + pobj.appInfo.uapp_id.toString() + "-" + orderResult.data.orderProduct.id.toString(),
// "totalFee" : orderResult.data.receiptVoucher.totalSum,
// "spbillCreateIp":'192.168.2.210',
// "tradeType":"JSAPI"
// }
var
sign
=
JSON
.
stringify
(
params
);
sign
+=
"ab53dfb909e4c32a"
sign
=
md5
(
sign
).
toUpperCase
()
params
.
sign
=
sign
let
res
=
await
axios
.
post
(
creatPayRequrl
,
params
)
if
(
res
.
status
==
200
&&
res
.
data
.
code
==
200
)
{
await
this
.
cacheManager
[
"TlPayLocker"
].
init
(
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
);
return
system
.
getResultSuccess
(
res
.
data
)
}
return
system
.
getResult
(
null
,
res
.
data
);
// let sign = await PayUtil.getSign('wx6f3ebe44defe336a',"3")
...
...
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