Authored by 毕凯

Merge branch 'feature/shareBuy' into release/5.7

... ... @@ -250,9 +250,10 @@ router.get('/couponSend', couponFloor.couponSend); // 获取优惠券
router.get('/birthday', auth, birthday.index); // 生日卷活动
router.get('/getCoupon', birthday.getCoupon); // 获取生日卷状态
router.get('/share-buy', update, shareBuy.index); // 分享购首页
router.get('/share-buy/detail', auth, update, shareBuy.detail); // 分享购详情页
router.get('/share-buy/my-rebeat', auth, update, shareBuy.myRebeat); // 我的返利
router.get('/share-buy', update('5.7.0'), shareBuy.index); // 分享购首页
router.get('/share-buy/detail', update('5.7.0'), auth, shareBuy.detail); // 分享购详情页
router.get('/share-buy/my-rebeat', update('5.7.0'), auth, shareBuy.myRebeat); // 我的返利
module.exports = router;
... ...
... ... @@ -3,18 +3,20 @@
* @date: 2017/5/10
*/
'use strict';
const semver = require('semver');
module.exports = (req, res, next) => {
let versionArr,
appVersion = req.yoho.isApp;
module.exports = (version) => {
return (req, res, next) => {
if (req.yoho.isApp && req.query.app_version) {
let appVersion = req.query.app_version.split('.');
if (appVersion) {
versionArr = appVersion.split('.');
appVersion = `${appVersion[0]}.${appVersion[1]}.${appVersion[2]}`;
if (versionArr[0] < 5 || versionArr[1] < 7 || versionArr[1] < 1) {
return res.redirect('http://m.yohobuy.com/passport/update?openby:yohobuy={"action":"go.h5","params":{"islogin":"N", "url":"http://m.yohobuy.com/passport/update"}}');
if (semver.lt(appVersion, version)) {
return res.redirect('http://m.yohobuy.com/passport/update');
}
}
}
next();
return next();
};
};
... ...
... ... @@ -47,6 +47,7 @@
"passport-weixin": "^0.1.0",
"request": "^2.81.0",
"request-promise": "^4.2.1",
"semver": "^5.3.0",
"uuid": "^3.0.1",
"xml2js": "^0.4.17",
"yoho-express-session": "^2.0.0",
... ...