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
47810bfa
Commit
47810bfa
authored
Nov 03, 2020
by
庄冰
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'center-channel' of gitlab.gongsibao.com:jiangyong/zhichan into center-channel
parents
93848d85
494d6dea
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
65 additions
and
82 deletions
+65
-82
center-channel/app/base/api/web.base.js
+9
-4
center-channel/app/base/service/impl/utilsSve/utils360Sve.js
+41
-59
center-channel/app/base/service/impl/utilsSve/utilsAuthSve.js
+11
-11
center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js
+0
-0
center-channel/app/base/utils/execClientNew.js
+1
-0
center-channel/app/config/routes/api.js
+1
-6
center-channel/app/config/settings.js
+2
-2
No files found.
center-channel/app/base/api/web.base.js
View file @
47810bfa
...
...
@@ -4,6 +4,7 @@ const uuidv4 = require('uuid/v4');
const
md5
=
require
(
"MD5"
);
class
WEBBase
{
constructor
()
{
this
.
execClientNew
=
system
.
getObject
(
"util.execClientNew"
);
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
this
.
execClientNew
=
system
.
getObject
(
"util.execClientNew"
);
this
.
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
...
...
@@ -21,20 +22,24 @@ class WEBBase {
async
doexecMethod
(
gname
,
methodname
,
pobj
,
query
,
req
)
{
req
.
requestId
=
this
.
getUUID
();
try
{
var
rtn
=
await
this
[
methodname
](
pobj
,
query
,
req
);
var
result
=
await
this
[
methodname
](
pobj
,
query
,
req
);
if
(
!
result
.
requestId
)
{
result
.
requestId
=
pobj
.
RequestId
?
pobj
.
RequestId
:
pobj
.
requestId
||
req
.
requestId
;
}
this
.
logCtl
.
createDb
({
appid
:
req
.
app
.
id
,
appkey
:
req
.
app
.
uappKey
,
requestId
:
req
.
requestId
,
op
:
req
.
classname
+
"/"
+
methodname
,
content
:
JSON
.
stringify
(
pobj
),
resultInfo
:
JSON
.
stringify
(
r
tn
),
resultInfo
:
JSON
.
stringify
(
r
esult
),
clientIp
:
req
.
clientIp
,
agent
:
req
.
uagent
,
opTitle
:
"api服务提供方appKey:"
+
settings
.
appKey
,
});
rtn
.
requestId
=
req
.
requestId
;
return
rtn
;
var
tmpResult
=
pobj
.
actionType
&&
pobj
.
actionType
.
indexOf
(
"List"
)
<
0
?
result
:
{
status
:
result
.
status
,
message
:
result
.
message
,
requestId
:
result
.
requestId
};
this
.
execClientNew
.
execLogs
(
"reqPath:"
+
req
.
path
,
pobj
,
"center-channel-doexecMethod-web"
,
tmpResult
,
null
);
return
result
;
}
catch
(
e
)
{
console
.
log
(
e
.
stack
,
"api调用出现异常,请联系管理员.........."
)
this
.
logCtl
.
createDb
({
...
...
center-channel/app/base/service/impl/utilsSve/utils360Sve.js
View file @
47810bfa
...
...
@@ -13,63 +13,45 @@ class utils360Sve extends AppServiceBase {
}
//组合参数,由前端传到360
async
getParamsFor360
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
orderNo
)
{
return
system
.
getResult
(
null
,
"actionBody.orderNo can not be empty,100110"
);
}
let
seaUrl
=
this
.
centerOrderUrl
+
'opaction/opPayOrder/getOrderListByOrderServiceNo'
;
let
seaRet
=
await
this
.
restPostUrl
(
pobj
,
seaUrl
);
if
(
seaRet
.
status
!=
0
)
{
return
system
.
getResultFail
(
-
1
,
'获取订单信息失败'
)
}
let
totalSum
=
0
;
let
sku_id
=
''
;
let
amount
=
0
;
let
consignee
=
""
;
let
mobile
=
""
;
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
);
//组合参数,由前端传到360
async
getParamsFor360
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
orderNo
)
{
return
system
.
getResult
(
null
,
"actionBody.orderNo can not be empty,100110"
);
}
pobj
.
actionType
=
"getPayOrderInfo"
;
let
orderUrl
=
settings
.
centerOrderUrl
()
+
"action/order/springBoard"
;
let
orderResult
=
await
this
.
restPostUrl
(
pobj
,
orderUrl
);
if
(
orderResult
.
status
!=
0
)
{
return
orderResult
;
}
pobj
.
actionType
=
"getOrderDeliveryInfo"
;
var
deliveryResult
=
await
this
.
restPostUrl
(
pobj
,
orderUrl
);
if
(
deliveryResult
.
status
!=
0
)
{
return
deliveryResult
;
}
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
async
pushOrderStatus
(
pobj
)
{
...
...
@@ -93,7 +75,7 @@ class utils360Sve extends AppServiceBase {
order_id
,
status
}
let
result
=
await
this
.
restPostUrl
(
pushObj
,
url
);
if
(
result
.
code
==
200
)
{
if
(
result
.
code
==
200
)
{
this
.
pushlogSve
.
createDb
({
op
:
"360-pushOrderStatus"
,
content
:
JSON
.
stringify
(
pushObj
),
//推送的参数信息
...
...
@@ -102,7 +84,7 @@ class utils360Sve extends AppServiceBase {
logLevel
:
'1'
,
opTitle
:
"推送360信息返回成功"
});
}
else
{
}
else
{
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
...
...
@@ -113,7 +95,7 @@ class utils360Sve extends AppServiceBase {
optitle
:
pobj
.
opType
+
"推送操作异常status->pushOrderStatus"
,
});
}
console
.
log
(
result
,
'-------------push360-----------------'
)
console
.
log
(
result
,
'-------------push360-----------------'
)
return
result
;
}
catch
(
e
)
{
this
.
logCtl
.
error
({
...
...
center-channel/app/base/service/impl/utilsSve/utilsAuthSve.js
View file @
47810bfa
...
...
@@ -268,19 +268,19 @@ class UtilsAuthService extends AppServiceBase {
let
result
=
await
this
.
get360Token
();
let
token
=
result
.
access_token
;
//360验证接口
//
let subData = "pin=" + pin + "&token=" + token;
//
let url = settings.requestUrl360() + 'api/v1/VerifyPin';
//
let rtn = await this.restClient.execGet(subData,url);
//
if (!rtn || !rtn.stdout) {
//
return system.getResult(null, "restGet data is empty");
//
}
//
let checkRet = JSON.parse(rtn.stdout);
//
if(checkRet.code != 200){
//
return system.getResultFail(-1,checkRet.msg)
//
}
let
subData
=
"pin="
+
pin
+
"&token="
+
token
;
let
url
=
settings
.
requestUrl360
()
+
'api/v1/VerifyPin'
;
let
rtn
=
await
this
.
restClient
.
execGet
(
subData
,
url
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"restGet data is empty"
);
}
let
checkRet
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
checkRet
.
code
!=
200
){
return
system
.
getResultFail
(
-
1
,
checkRet
.
msg
)
}
//---渠道用户登录,有则返回userpin ,没有则注册用户并返回userpin
actionBody
.
channelUserId
=
pin
;
opResult
=
await
this
.
getLoginByUserName
(
pobj
,
actionBody
);
opResult
=
await
this
.
getLoginByUserName
(
req
,
pobj
,
actionBody
);
return
opResult
;
}
...
...
center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js
View file @
47810bfa
This diff is collapsed.
Click to expand it.
center-channel/app/base/utils/execClientNew.js
View file @
47810bfa
...
...
@@ -92,6 +92,7 @@ class ExecClientNew {
this
.
execLogs
(
execFile
+
"执行execPostTimeOutByBusiness,errorInfo信息为请求的返回结果"
,
params
,
params
.
identifyCode
,
reqResult
,
rtn
);
return
reqResult
;
}
catch
(
error
)
{
console
.
log
(
"执行execPostByTimeOut存在异常"
,
error
.
stack
);
reqResult
=
system
.
getResultFail
(
-
200
,
execFile
+
"执行execPostByTimeOut存在异常"
);
reqResult
.
requestId
=
requestId
||
uuid
.
v1
();
this
.
execLogs
(
execFile
+
"执行execPostByTimeOut存在异常"
,
params
,
params
.
identifyCode
,
reqResult
,
error
.
stack
);
...
...
center-channel/app/config/routes/api.js
View file @
47810bfa
...
...
@@ -205,12 +205,7 @@ module.exports = function (app) {
try
{
var
client_ip
=
system
.
get_client_ip
(
req
);
let
result
=
{};
const
orderNo
=
req
.
body
.
orderNo
;
if
(
orderNo
.
indexOf
(
'CN'
)
==
0
){
result
=
await
utilsOrderSve
.
channelOrdersPayNotify
(
req
.
body
,
client_ip
);
}
else
{
result
=
await
utilsOrderSve
.
channelPayNotify
(
req
.
body
,
client_ip
);
}
result
=
await
utilsOrderSve
.
channelPayNotify
(
req
.
body
,
client_ip
);
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"渠道支付订单通知 api层"
,
op
:
"center-channel/orderNotify/channelPayNotify"
,
...
...
center-channel/app/config/settings.js
View file @
47810bfa
...
...
@@ -239,14 +239,14 @@ var settings = {
if
(
this
.
env
==
"dev"
)
{
return
"https://oauth2.e.360.cn/site/token"
// 360测试环境
}
else
{
return
""
//
return
"
https://oauth2.e.360.cn/site/token
"
//
}
},
requestUrl360
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
return
"http://180.163.239.98:38085/"
// 360测试环境
}
else
{
return
""
//
return
"
http://180.163.239.98:38085/
"
//
}
},
aliUappId
:
function
()
{
...
...
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