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
5dd9d51a
Commit
5dd9d51a
authored
Nov 02, 2020
by
任晓松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
ca39c0bc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
65 deletions
+42
-65
center-channel/app/base/service/impl/utilsSve/utils360Sve.js
+41
-59
center-channel/app/config/routes/api.js
+1
-6
No files found.
center-channel/app/base/service/impl/utilsSve/utils360Sve.js
View file @
5dd9d51a
...
@@ -13,63 +13,45 @@ class utils360Sve extends AppServiceBase {
...
@@ -13,63 +13,45 @@ class utils360Sve extends AppServiceBase {
}
}
//组合参数,由前端传到360
//组合参数,由前端传到360
async
getParamsFor360
(
pobj
,
actionBody
)
{
async
getParamsFor360
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
orderNo
)
{
if
(
!
actionBody
.
orderNo
)
{
return
system
.
getResult
(
null
,
"actionBody.orderNo can not be empty,100110"
);
return
system
.
getResult
(
null
,
"actionBody.orderNo can not be empty,100110"
);
}
}
let
seaUrl
=
this
.
centerOrderUrl
+
'opaction/opPayOrder/getOrderListByOrderServiceNo'
;
pobj
.
actionType
=
"getPayOrderInfo"
;
let
seaRet
=
await
this
.
restPostUrl
(
pobj
,
seaUrl
);
let
orderUrl
=
settings
.
centerOrderUrl
()
+
"action/order/springBoard"
;
if
(
seaRet
.
status
!=
0
)
{
let
orderResult
=
await
this
.
restPostUrl
(
pobj
,
orderUrl
);
return
system
.
getResultFail
(
-
1
,
'获取订单信息失败'
)
if
(
orderResult
.
status
!=
0
)
{
}
return
orderResult
;
let
totalSum
=
0
;
}
let
sku_id
=
''
;
pobj
.
actionType
=
"getOrderDeliveryInfo"
;
let
amount
=
0
;
var
deliveryResult
=
await
this
.
restPostUrl
(
pobj
,
orderUrl
);
let
consignee
=
""
;
if
(
deliveryResult
.
status
!=
0
)
{
let
mobile
=
""
;
return
deliveryResult
;
let
email
=
""
;
for
(
let
i
=
0
;
i
<
seaRet
.
data
.
length
;
i
++
)
{
let
item
=
seaRet
.
data
[
i
];
if
(
!
mobile
){
pobj
.
actionType
.
orderNo
=
item
.
orderNo
;
pobj
.
actionType
=
"getOrderDeliveryInfo"
;
let
deliveryResult
=
await
this
.
restPostUrl
(
pobj
,
orderUrl
);
consignee
=
deliveryResult
.
data
.
orderContact
.
contactName
;
mobile
=
deliveryResult
.
data
.
orderContact
.
mobile
;
email
=
deliveryResult
.
data
.
orderContact
.
email
}
sku_id
=
item
.
itemCode
;
totalSum
+=
Number
(
item
.
totalSum
);
amount
+=
Number
(
item
.
payTotalSum
);
}
// let sku_id = orderResult.data.orderProduct.itemCode;
// let price = Number(orderResult.data.orderProduct.price)*100;
let
price
=
totalSum
*
100
;
// let quantity = seaRet.data.length;
// let amount = Number(orderResult.data.receiptVoucher.totalSum)*100;
amount
=
amount
*
100
;
let
order_id
=
pobj
.
actionBody
.
orderNo
;
// let consignee = deliveryResult.data.orderContact.contactName;
// let mobile = deliveryResult.data.orderContact.mobile;
// let email = deliveryResult.data.orderContact.email;
let
singStr
=
sku_id
+
price
+
order_id
+
pobj
.
appInfo
.
uapp_secret
;
let
sign
=
md5
(
singStr
).
toUpperCase
();
// 推送参数
let
result
=
{
sku_id
:
sku_id
,
price
:
price
,
quantity
:
seaRet
.
data
.
length
,
amount
:
amount
,
order_id
:
order_id
,
consignee
:
consignee
,
mobile
:
mobile
,
email
:
email
,
sign
:
sign
}
return
system
.
getResult
(
result
);
}
}
let
sku_id
=
orderResult
.
data
.
orderProduct
.
itemCode
;
let
price
=
Number
(
orderResult
.
data
.
orderProduct
.
price
)
*
100
;
let
quantity
=
orderResult
.
data
.
orderProduct
.
quantity
;
let
amount
=
Number
(
orderResult
.
data
.
receiptVoucher
.
totalSum
)
*
100
;
let
order_id
=
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
;
let
consignee
=
deliveryResult
.
data
.
orderContact
.
contactName
;
let
mobile
=
deliveryResult
.
data
.
orderContact
.
mobile
;
let
email
=
deliveryResult
.
data
.
orderContact
.
email
;
let
singStr
=
sku_id
+
price
+
order_id
+
pobj
.
appInfo
.
uapp_secret
;
let
sign
=
md5
(
singStr
).
toUpperCase
();
let
result
=
{
sku_id
,
price
,
quantity
,
amount
,
order_id
,
consignee
,
mobile
,
email
,
sign
}
return
system
.
getResult
(
result
);
}
//更新订单状态到360
//更新订单状态到360
async
pushOrderStatus
(
pobj
)
{
async
pushOrderStatus
(
pobj
)
{
...
@@ -93,7 +75,7 @@ class utils360Sve extends AppServiceBase {
...
@@ -93,7 +75,7 @@ class utils360Sve extends AppServiceBase {
order_id
,
status
order_id
,
status
}
}
let
result
=
await
this
.
restPostUrl
(
pushObj
,
url
);
let
result
=
await
this
.
restPostUrl
(
pushObj
,
url
);
if
(
result
.
code
==
200
)
{
if
(
result
.
code
==
200
)
{
this
.
pushlogSve
.
createDb
({
this
.
pushlogSve
.
createDb
({
op
:
"360-pushOrderStatus"
,
op
:
"360-pushOrderStatus"
,
content
:
JSON
.
stringify
(
pushObj
),
//推送的参数信息
content
:
JSON
.
stringify
(
pushObj
),
//推送的参数信息
...
@@ -102,7 +84,7 @@ class utils360Sve extends AppServiceBase {
...
@@ -102,7 +84,7 @@ class utils360Sve extends AppServiceBase {
logLevel
:
'1'
,
logLevel
:
'1'
,
opTitle
:
"推送360信息返回成功"
opTitle
:
"推送360信息返回成功"
});
});
}
else
{
}
else
{
this
.
logCtl
.
error
({
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
...
@@ -113,7 +95,7 @@ class utils360Sve extends AppServiceBase {
...
@@ -113,7 +95,7 @@ class utils360Sve extends AppServiceBase {
optitle
:
pobj
.
opType
+
"推送操作异常status->pushOrderStatus"
,
optitle
:
pobj
.
opType
+
"推送操作异常status->pushOrderStatus"
,
});
});
}
}
console
.
log
(
result
,
'-------------push360-----------------'
)
console
.
log
(
result
,
'-------------push360-----------------'
)
return
result
;
return
result
;
}
catch
(
e
)
{
}
catch
(
e
)
{
this
.
logCtl
.
error
({
this
.
logCtl
.
error
({
...
...
center-channel/app/config/routes/api.js
View file @
5dd9d51a
...
@@ -205,12 +205,7 @@ module.exports = function (app) {
...
@@ -205,12 +205,7 @@ module.exports = function (app) {
try
{
try
{
var
client_ip
=
system
.
get_client_ip
(
req
);
var
client_ip
=
system
.
get_client_ip
(
req
);
let
result
=
{};
let
result
=
{};
const
orderNo
=
req
.
body
.
orderNo
;
result
=
await
utilsOrderSve
.
channelPayNotify
(
req
.
body
,
client_ip
);
if
(
orderNo
.
indexOf
(
'CN'
)
==
0
){
result
=
await
utilsOrderSve
.
channelOrdersPayNotify
(
req
.
body
,
client_ip
);
}
else
{
result
=
await
utilsOrderSve
.
channelPayNotify
(
req
.
body
,
client_ip
);
}
logCtl
.
info
({
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"渠道支付订单通知 api层"
,
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"渠道支付订单通知 api层"
,
op
:
"center-channel/orderNotify/channelPayNotify"
,
op
:
"center-channel/orderNotify/channelPayNotify"
,
...
...
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