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
3d8709e1
Commit
3d8709e1
authored
Oct 14, 2022
by
陈思聪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: repeat send resp exception
parent
1cfb40ac
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
center-channel/app/config/routes/api.js
+9
-2
No files found.
center-channel/app/config/routes/api.js
View file @
3d8709e1
...
...
@@ -233,7 +233,9 @@ module.exports = function (app) {
app
.
all
(
"/web/*"
,
async
function
(
req
,
res
,
next
)
{
const
self
=
this
;
try
{
if
(
"haoming.qifu.gongsibao.com"
!=
req
.
hostname
){
// 好名调用接口,token传参一直错误,不打日志了
console
.
log
(
'[request:web] 【host:】'
+
req
.
hostname
+
',【url:】'
+
req
.
path
+
',【headers:】'
+
(
req
.
headers
?
JSON
.
stringify
(
req
.
headers
):
""
)
+
',【params:】'
+
(
req
.
query
?
JSON
.
stringify
(
req
.
query
):
""
)
+
',【body:】'
+
(
req
.
body
?
JSON
.
stringify
(
req
.
body
):
""
))
}
}
catch
(
e
){
console
.
log
(
'[request:web] 打印请求入口日志报错:'
+
e
.
stack
)
}
...
...
@@ -268,13 +270,18 @@ module.exports = function (app) {
//校验jwt产生的token
const
tokenSecret
=
settings
.
env
==
"localhost"
||
settings
.
env
==
"dev"
?
PDICT
.
token_secret_dev
:
PDICT
.
token_secret_prod
;
let
token_secret_str
=
null
;
jwt
.
verify
(
token
,
tokenSecret
,
function
(
err
,
decoded
)
{
// decoded:指的是token解码后用户信息
let
verifyResult
=
jwt
.
verify
(
token
,
tokenSecret
,
function
(
err
,
decoded
)
{
// decoded:指的是token解码后用户信息
if
(
err
)
{
//如果token过期则会执行err的代码块
return
res
.
send
(
system
.
getResultFail
(
-
88
,
"Failed to authenticate token,error:"
+
err
));
res
.
send
(
system
.
getResultFail
(
-
88
,
"Failed to authenticate token,error:"
+
err
));
return
false
}
else
{
token_secret_str
=
decoded
.
token_secret
;
return
true
}
});
if
(
!
verifyResult
){
return
;
}
let
decryptResult
=
await
utilsAuthSve
.
decryptInfo
(
token_secret_str
);
if
(
decryptResult
.
status
!=
0
)
{
return
res
.
send
(
system
.
getResultFail
(
-
88
,
"Failed to authenticate token,fail:"
+
decryptResult
.
msg
));
...
...
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