Showing
2 changed files
with
10 additions
and
8 deletions
@@ -9,17 +9,17 @@ const helpers = global.yoho.helpers; | @@ -9,17 +9,17 @@ const helpers = global.yoho.helpers; | ||
9 | 9 | ||
10 | module.exports = (req, res, next) => { | 10 | module.exports = (req, res, next) => { |
11 | if (!req.user.uid) { | 11 | if (!req.user.uid) { |
12 | - if (req.yoho.isApp) { | ||
13 | - return next({ | ||
14 | - code: 401, | ||
15 | - message: 'weblogin' | ||
16 | - }); | ||
17 | - } else if (req.xhr) { | 12 | + if (req.xhr) { |
18 | return res.json({ | 13 | return res.json({ |
19 | code: 400, | 14 | code: 400, |
20 | message: '抱歉,您暂未登录!', | 15 | message: '抱歉,您暂未登录!', |
21 | redirect: '/signin.html' | 16 | redirect: '/signin.html' |
22 | }); | 17 | }); |
18 | + } else if (req.yoho.isApp) { | ||
19 | + return next({ | ||
20 | + code: 401, | ||
21 | + message: 'weblogin' | ||
22 | + }); | ||
23 | } else { | 23 | } else { |
24 | return res.redirect(helpers.urlFormat('/signin.html', { | 24 | return res.redirect(helpers.urlFormat('/signin.html', { |
25 | refer: req.originalUrl, | 25 | refer: req.originalUrl, |
@@ -367,7 +367,9 @@ seckillObj = { | @@ -367,7 +367,9 @@ seckillObj = { | ||
367 | 367 | ||
368 | event.stopPropagation(); | 368 | event.stopPropagation(); |
369 | 369 | ||
370 | - if (!yoho.isLogin()) { | 370 | + let uid = yoho.isLogin(); |
371 | + | ||
372 | + if (!uid || uid === '0') { | ||
371 | yoho.invokeMethod('go.login'); | 373 | yoho.invokeMethod('go.login'); |
372 | return; | 374 | return; |
373 | } | 375 | } |
@@ -417,7 +419,7 @@ seckillObj = { | @@ -417,7 +419,7 @@ seckillObj = { | ||
417 | }; | 419 | }; |
418 | 420 | ||
419 | yoho.invokeMethod(action, params, function() { | 421 | yoho.invokeMethod(action, params, function() { |
420 | - let uid = yoho.isLogin(); | 422 | + uid = yoho.isLogin(); |
421 | 423 | ||
422 | if (uid && uid !== '0') { | 424 | if (uid && uid !== '0') { |
423 | onsuccess({uid}); | 425 | onsuccess({uid}); |
-
Please register or login to post a comment