Authored by ccbikai

修改微信错误处理方法

@@ -30,7 +30,7 @@ function doPassportCallback(openId, nickname, sourceType, req, res) { @@ -30,7 +30,7 @@ function doPassportCallback(openId, nickname, sourceType, req, res) {
30 refer = `${config.siteUrl}/home`; 30 refer = `${config.siteUrl}/home`;
31 } 31 }
32 if (openId && nickname) { 32 if (openId && nickname) {
33 - AuthHelper.signinByOpenID(nickname, openId, sourceType, shoppingKey).then((result) => { 33 + return AuthHelper.signinByOpenID(nickname, openId, sourceType, shoppingKey).then((result) => {
34 if (result.data['is_bind'] && result.data['is_bind'] === 'N') { //eslint-disable-line 34 if (result.data['is_bind'] && result.data['is_bind'] === 'N') { //eslint-disable-line
35 return helpers.urlFormat('/passport/bind/index', { 35 return helpers.urlFormat('/passport/bind/index', {
36 openId: openId, 36 openId: openId,
@@ -44,9 +44,6 @@ function doPassportCallback(openId, nickname, sourceType, req, res) { @@ -44,9 +44,6 @@ function doPassportCallback(openId, nickname, sourceType, req, res) {
44 } 44 }
45 }).then((redirectTo) => { 45 }).then((redirectTo) => {
46 return res.redirect(redirectTo); 46 return res.redirect(redirectTo);
47 - }).catch((e) => {  
48 - log.error('频道页面渲染错误:' + JSON.stringify(e));  
49 - return res.send('error');  
50 }); 47 });
51 } 48 }
52 } 49 }
@@ -77,7 +74,7 @@ const wechat = { @@ -77,7 +74,7 @@ const wechat = {
77 let nickname = user._json.nickname || user.displayName; 74 let nickname = user._json.nickname || user.displayName;
78 let openId = user._json.unionid || user.id; 75 let openId = user._json.unionid || user.id;
79 76
80 - doPassportCallback(openId, nickname, 'wechat', req, res); 77 + doPassportCallback(openId, nickname, 'wechat', req, res).catch(next);
81 })(req, res, next); 78 })(req, res, next);
82 } 79 }
83 }; 80 };
@@ -49,7 +49,7 @@ class Auth { @@ -49,7 +49,7 @@ class Auth {
49 res.cookie('_TOKEN', token, { 49 res.cookie('_TOKEN', token, {
50 domain: 'yohobuy.com' 50 domain: 'yohobuy.com'
51 }); // esline-disable-line 51 }); // esline-disable-line
52 - }).catch(console.log); 52 + });
53 } 53 }
54 } 54 }
55 55