Commit 3d8709e1 by 陈思聪

fix: repeat send resp exception

parent 1cfb40ac
...@@ -233,7 +233,9 @@ module.exports = function (app) { ...@@ -233,7 +233,9 @@ module.exports = function (app) {
app.all("/web/*", async function (req, res, next) { app.all("/web/*", async function (req, res, next) {
const self = this; const self = this;
try{ 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):"")) 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){ }catch (e){
console.log('[request:web] 打印请求入口日志报错:'+e.stack) console.log('[request:web] 打印请求入口日志报错:'+e.stack)
} }
...@@ -268,13 +270,18 @@ module.exports = function (app) { ...@@ -268,13 +270,18 @@ module.exports = function (app) {
//校验jwt产生的token //校验jwt产生的token
const tokenSecret = settings.env == "localhost" || settings.env == "dev" ? PDICT.token_secret_dev : PDICT.token_secret_prod; const tokenSecret = settings.env == "localhost" || settings.env == "dev" ? PDICT.token_secret_dev : PDICT.token_secret_prod;
let token_secret_str = null; 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的代码块 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 { } else {
token_secret_str = decoded.token_secret; token_secret_str = decoded.token_secret;
return true
} }
}); });
if(!verifyResult){
return;
}
let decryptResult = await utilsAuthSve.decryptInfo(token_secret_str); let decryptResult = await utilsAuthSve.decryptInfo(token_secret_str);
if (decryptResult.status != 0) { if (decryptResult.status != 0) {
return res.send(system.getResultFail(-88, "Failed to authenticate token,fail:" + decryptResult.msg)); return res.send(system.getResultFail(-88, "Failed to authenticate token,fail:" + decryptResult.msg));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment