Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
ufo-app-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
yyq
6 years ago
Commit
421d9da64fbaea936a8f12f81a7690d4cfc58d10
1 parent
e3d46273
add api access log
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
2 deletions
config/api-map.js
doraemon/middleware/ssr-api.js
doraemon/middleware/ssr.js
config/api-map.js
View file @
421d9da
...
...
@@ -33,6 +33,7 @@ module.exports = {
params
:
{}
},
'/api/ufo/seller/entryGoodsSizeList'
:
{
accessLog
:
true
,
checkSign
:
true
,
ufo
:
true
,
api
:
'ufo.seller.entryGoodsSizeList'
,
...
...
@@ -43,6 +44,7 @@ module.exports = {
}
},
'/api/ufo/sellerOrder/computeAdjustPrice'
:
{
accessLog
:
true
,
checkSign
:
true
,
ufo
:
true
,
api
:
'ufo.sellerOrder.computeAdjustPrice'
,
...
...
@@ -55,6 +57,7 @@ module.exports = {
}
},
'/api/ufo/sellerOrder/batchAdjustPrice'
:
{
accessLog
:
true
,
checkSign
:
true
,
ufo
:
true
,
api
:
'ufo.sellerOrder.batchAdjustPrice'
,
...
...
@@ -67,6 +70,7 @@ module.exports = {
}
},
'/api/ufo/sellerOrder/batchDownShelf'
:
{
accessLog
:
true
,
checkSign
:
true
,
ufo
:
true
,
api
:
'ufo.sellerOrder.batchDownShelf'
,
...
...
doraemon/middleware/ssr-api.js
View file @
421d9da
...
...
@@ -30,7 +30,7 @@ module.exports = async(req, res, next) => {
}
let
baseParams
;
let
reqParams
=
Object
.
assign
({},
req
.
query
,
req
.
body
);
req
.
route
=
{
path
:
req
.
path
};
...
...
@@ -41,6 +41,10 @@ module.exports = async(req, res, next) => {
Expires
:
(
new
Date
(
1900
,
0
,
1
,
0
,
0
,
0
,
0
)).
toUTCString
()
});
if
(
apiInfo
.
accessLog
)
{
logger
.
info
(
`
[
request
access
log
]
$
{
req
.
yoho
.
clientIp
}
|
$
{
req
.
url
}
|
uid
:
$
{
req
.
user
.
uid
}
|
User
-
Agent
:
$
{
req
.
get
(
'User-Agent'
)}
|
$
{
new
Date
()}
`
);
}
if
(
apiInfo
.
checkSign
)
{
if
(
!
checkSign
(
Object
.
assign
({},
reqParams
),
reqParams
.
s
))
{
logger
.
error
(
`验签失败!
uid
:
$
{
_
.
get
(
req
,
'user.uid'
,
''
).
toString
()},
params
:
$
{
JSON
.
stringify
(
reqParams
)},
ip
:
$
{
req
.
yoho
.
clientIp
}
`
);
...
...
doraemon/middleware/ssr.js
View file @
421d9da
...
...
@@ -119,7 +119,7 @@ const render = (route) => {
const
isDegrade
=
_
.
get
(
req
.
app
.
locals
.
wap
,
'webapp.degrade'
,
false
);
if
(
route
.
accessLog
)
{
logger
.
info
(
`
$
{
req
.
yoho
.
clientIp
}
|
$
{
req
.
url
}
|
uid
:
$
{
req
.
user
.
uid
}
|
$
{
new
Date
()}
`
);
logger
.
info
(
`
[
request
access
log
]
$
{
req
.
yoho
.
clientIp
}
|
$
{
req
.
url
}
|
uid
:
$
{
req
.
user
.
uid
}
|
User
-
Agent
:
$
{
req
.
get
(
'User-Agent'
)
}
|
$
{
new
Date
()}
`
);
}
if
(
isDegrade
)
{
...
...
Please
register
or
login
to post a comment