Showing
4 changed files
with
5 additions
and
6 deletions
@@ -19,7 +19,7 @@ exports.index = (req, res, next) => { | @@ -19,7 +19,7 @@ exports.index = (req, res, next) => { | ||
19 | let params = { | 19 | let params = { |
20 | page: 1, | 20 | page: 1, |
21 | limit: 10, | 21 | limit: 10, |
22 | - isApp: req.query.app_version || req.query.appVersion ? true : false, | 22 | + isApp: req.yoho.isApp |
23 | }; | 23 | }; |
24 | 24 | ||
25 | if (req.user.uid || req.query.uid) { | 25 | if (req.user.uid || req.query.uid) { |
@@ -43,7 +43,7 @@ exports.moreGoods = (req, res, next) => { | @@ -43,7 +43,7 @@ exports.moreGoods = (req, res, next) => { | ||
43 | let params = { | 43 | let params = { |
44 | page: req.query.page || 1, | 44 | page: req.query.page || 1, |
45 | limit: 10, | 45 | limit: 10, |
46 | - isApp: req.query.isApp | 46 | + isApp: req.yoho.isApp |
47 | }; | 47 | }; |
48 | 48 | ||
49 | if (req.user.uid || req.query.uid) { | 49 | if (req.user.uid || req.query.uid) { |
@@ -123,7 +123,7 @@ module.exports = class extends global.yoho.BaseModel { | @@ -123,7 +123,7 @@ module.exports = class extends global.yoho.BaseModel { | ||
123 | let discount = this.getDiscound(val.sales_price, val.market_price); | 123 | let discount = this.getDiscound(val.sales_price, val.market_price); |
124 | let url = `//m.yohobuy.com/product/${val.product_skn}.html`; | 124 | let url = `//m.yohobuy.com/product/${val.product_skn}.html`; |
125 | 125 | ||
126 | - if (params.isApp === 'true') { | 126 | + if (params.isApp) { |
127 | url += `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"${val.product_skn}"}}`; // eslint-disable-line | 127 | url += `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"${val.product_skn}"}}`; // eslint-disable-line |
128 | } | 128 | } |
129 | 129 |
@@ -50,7 +50,7 @@ module.exports = () => { | @@ -50,7 +50,7 @@ module.exports = () => { | ||
50 | // 判断请求是否来自app | 50 | // 判断请求是否来自app |
51 | yoho.isApp = (req.query.app_version && req.query.app_version !== 'false') || | 51 | yoho.isApp = (req.query.app_version && req.query.app_version !== 'false') || |
52 | (req.query.appVersion && req.query.appVersion !== 'false') || | 52 | (req.query.appVersion && req.query.appVersion !== 'false') || |
53 | - req.cookies.app_version; | 53 | + req.cookies.app_version || /YohoBuy/i.test(req.get('User-Agent') || ''); |
54 | yoho.isWechat = /micromessenger/i.test(req.get('User-Agent') || ''); | 54 | yoho.isWechat = /micromessenger/i.test(req.get('User-Agent') || ''); |
55 | yoho.isWeibo = ua.indexOf('weibo') !== -1; | 55 | yoho.isWeibo = ua.indexOf('weibo') !== -1; |
56 | yoho.isqq = /MQQBrowser/i.test(req.get('User-Agent') || ''); | 56 | yoho.isqq = /MQQBrowser/i.test(req.get('User-Agent') || ''); |
@@ -36,9 +36,8 @@ class ActController extends Controller { | @@ -36,9 +36,8 @@ class ActController extends Controller { | ||
36 | 36 | ||
37 | moreGood(page) { | 37 | moreGood(page) { |
38 | this.loading = true; | 38 | this.loading = true; |
39 | - this.isApp = window.queryString.app_version || window.queryString.appVersion ? true : false; | ||
40 | $('.gdt-c').append('<p class="show-more">加载更多...</p>'); | 39 | $('.gdt-c').append('<p class="show-more">加载更多...</p>'); |
41 | - getMore('//m.yohobuy.com/activity/user-recommend/moreGoods', {page: page, isApp: this.isApp}).then(data => { | 40 | + getMore('//m.yohobuy.com/activity/user-recommend/moreGoods', {page: page}).then(data => { |
42 | if (data.goodList.length > 0) { | 41 | if (data.goodList.length > 0) { |
43 | $('.goods').append(goodContent(data)); | 42 | $('.goods').append(goodContent(data)); |
44 | 43 |
-
Please register or login to post a comment