Showing
3 changed files
with
15 additions
and
12 deletions
@@ -242,8 +242,8 @@ router.get('/app-downloads', appDownloads.index); | @@ -242,8 +242,8 @@ router.get('/app-downloads', appDownloads.index); | ||
242 | 242 | ||
243 | router.get('/couponSend', couponFloor.couponSend); // 获取优惠券 | 243 | router.get('/couponSend', couponFloor.couponSend); // 获取优惠券 |
244 | 244 | ||
245 | -router.get('/share-buy', update, shareBuy.index); // 分享购首页 | ||
246 | -router.get('/share-buy/detail', auth, update, shareBuy.detail); // 分享购详情页 | ||
247 | -router.get('/share-buy/my-rebeat', auth, update, shareBuy.myRebeat); // 我的返利 | 245 | +router.get('/share-buy', update('5.7.0'), shareBuy.index); // 分享购首页 |
246 | +router.get('/share-buy/detail', update('5.7.0'), auth, shareBuy.detail); // 分享购详情页 | ||
247 | +router.get('/share-buy/my-rebeat', update('5.7.0'), auth, shareBuy.myRebeat); // 我的返利 | ||
248 | 248 | ||
249 | module.exports = router; | 249 | module.exports = router; |
@@ -3,18 +3,20 @@ | @@ -3,18 +3,20 @@ | ||
3 | * @date: 2017/5/10 | 3 | * @date: 2017/5/10 |
4 | */ | 4 | */ |
5 | 'use strict'; | 5 | 'use strict'; |
6 | +const semver = require('semver'); | ||
6 | 7 | ||
7 | -module.exports = (req, res, next) => { | ||
8 | - let versionArr, | ||
9 | - appVersion = req.yoho.isApp; | 8 | +module.exports = (version) => { |
9 | + return (req, res, next) => { | ||
10 | + if (req.yoho.isApp && req.query.app_version) { | ||
11 | + let appVersion = req.query.app_version.split('.'); | ||
10 | 12 | ||
11 | - if (appVersion) { | ||
12 | - versionArr = appVersion.split('.'); | 13 | + appVersion = `${appVersion[0]}.${appVersion[1]}.${appVersion[2]}`; |
13 | 14 | ||
14 | - if (versionArr[0] < 5 || versionArr[1] < 7 || versionArr[1] < 1) { | ||
15 | - return res.redirect('http://m.yohobuy.com/passport/update?openby:yohobuy={"action":"go.h5","params":{"islogin":"N", "url":"http://m.yohobuy.com/passport/update"}}'); | 15 | + if (semver.lt(appVersion, version)) { |
16 | + return res.redirect('http://m.yohobuy.com/passport/update'); | ||
17 | + } | ||
16 | } | 18 | } |
17 | - } | ||
18 | 19 | ||
19 | - next(); | 20 | + return next(); |
21 | + }; | ||
20 | }; | 22 | }; |
@@ -46,6 +46,7 @@ | @@ -46,6 +46,7 @@ | ||
46 | "passport-weixin": "^0.1.0", | 46 | "passport-weixin": "^0.1.0", |
47 | "request": "^2.81.0", | 47 | "request": "^2.81.0", |
48 | "request-promise": "^4.2.0", | 48 | "request-promise": "^4.2.0", |
49 | + "semver": "^5.3.0", | ||
49 | "uuid": "^3.0.1", | 50 | "uuid": "^3.0.1", |
50 | "xml2js": "^0.4.17", | 51 | "xml2js": "^0.4.17", |
51 | "yoho-express-session": "^2.0.0", | 52 | "yoho-express-session": "^2.0.0", |
-
Please register or login to post a comment