Authored by 毕凯

Merge branch 'feature/userVip' into 'feature/qps'

Feature/user vip



See merge request !1021
@@ -5,7 +5,8 @@ @@ -5,7 +5,8 @@
5 */ 5 */
6 'use strict'; 6 'use strict';
7 const channelModel = require('../models/channel'); 7 const channelModel = require('../models/channel');
8 -const homeModel = require('../../home/models/index'); 8 +
  9 +// const homeModel = require('../../home/models/index');
9 const footerModel = require('../../../doraemon/models/footer_tab'); // 底部tab 10 const footerModel = require('../../../doraemon/models/footer_tab'); // 底部tab
10 11
11 const helpers = global.yoho.helpers; 12 const helpers = global.yoho.helpers;
@@ -213,27 +214,27 @@ exports.shopRecom = (req, res, next) => { @@ -213,27 +214,27 @@ exports.shopRecom = (req, res, next) => {
213 /** 214 /**
214 * 获取用户vip信息 215 * 获取用户vip信息
215 */ 216 */
216 -exports.userVip = (req, res, next) => {  
217 - let uid = req.user.uid;  
218 -  
219 - if (!uid) {  
220 - res.json({  
221 - code: 555,  
222 - msg: '未登录'  
223 - });  
224 - } else {  
225 - req.ctx(homeModel).getGradeGrade(uid, req.query.channel || 1).then(result => {  
226 - if (result.code === 200) {  
227 - res.json({  
228 - code: 200,  
229 - current_vip_level: result.data.current_vip_level,  
230 - });  
231 - } else {  
232 - res.json({  
233 - code: 500,  
234 - msg: '出错了',  
235 - });  
236 - }  
237 - }).catch(next);  
238 - }  
239 -}; 217 +// exports.userVip = (req, res, next) => {
  218 +// let uid = req.user.uid;
  219 +
  220 +// if (!uid) {
  221 +// res.json({
  222 +// code: 555,
  223 +// msg: '未登录'
  224 +// });
  225 +// } else {
  226 +// req.ctx(homeModel).getGradeGrade(uid, req.query.channel || 1).then(result => {
  227 +// if (result.code === 200) {
  228 +// res.json({
  229 +// code: 200,
  230 +// current_vip_level: result.data.current_vip_level,
  231 +// });
  232 +// } else {
  233 +// res.json({
  234 +// code: 500,
  235 +// msg: '出错了',
  236 +// });
  237 +// }
  238 +// }).catch(next);
  239 +// }
  240 +// };
@@ -35,7 +35,7 @@ router.get('/brands/delBrandHistory', brandController.delBrandHistory); // 删 @@ -35,7 +35,7 @@ router.get('/brands/delBrandHistory', brandController.delBrandHistory); // 删
35 35
36 // 5.2新楼层功能 36 // 5.2新楼层功能
37 router.post('/channel/shopRecom', channel.shopRecom); // 店铺推荐收藏状态 37 router.post('/channel/shopRecom', channel.shopRecom); // 店铺推荐收藏状态
38 -router.post('/channel/userVip', channel.userVip); 38 +// router.post('/channel/userVip', channel.userVip);
39 39
40 // 自定义频道,市场推广-智汇 40 // 自定义频道,市场推广-智汇
41 // 此页面做的早,写死发给市场,与自定义的不兼容,所以需要写死 41 // 此页面做的早,写死发给市场,与自定义的不兼容,所以需要写死
@@ -246,7 +246,12 @@ const shop = { @@ -246,7 +246,12 @@ const shop = {
246 }); 246 });
247 } 247 }
248 248
249 - res.render('newshop/shop-reds', finalResult); 249 + // 店铺收藏开关
  250 + let shppFavHide = _.get(req.app.locals.wap, 'shop.removeCollect', false);
  251 +
  252 + res.render('newshop/shop-reds', _.assign(finalResult, {
  253 + shppFavHide: shppFavHide
  254 + }));
250 })().catch(next); 255 })().catch(next);
251 }, 256 },
252 257
@@ -13,7 +13,8 @@ @@ -13,7 +13,8 @@
13 <p class="store-name">{{shopInfo.shop_name}}</p> 13 <p class="store-name">{{shopInfo.shop_name}}</p>
14 <div class="fav-box clearfix"> 14 <div class="fav-box clearfix">
15 <div class="favs pull-left">粉丝数: {{favCount}} </div> 15 <div class="favs pull-left">粉丝数: {{favCount}} </div>
16 - <div class="not-collect pull-left" id="collect" data-bp-id="shop_branner_collect_1"></div> 16 + {{!-- 店铺收藏开关 data-switch --}}
  17 + <div class="not-collect pull-left {{#if shppFavHide}}hide{{/if}}" data-switch="{{shppFavHide}}" id="collect" data-bp-id="shop_branner_collect_1"></div>
17 </div> 18 </div>
18 </div> 19 </div>
19 {{/if}} 20 {{/if}}
@@ -328,24 +328,24 @@ function ajaxResource() { @@ -328,24 +328,24 @@ function ajaxResource() {
328 }); 328 });
329 329
330 // vip专属等级查询 330 // vip专属等级查询
331 - $.ajax({  
332 - method: 'POST',  
333 - url: '/channel/userVip',  
334 - data: {  
335 - channel: 1,  
336 - },  
337 - success: function(data) {  
338 - let vip = $('.vip-only');  
339 -  
340 - if (data.code === 200 && Number(data.current_vip_level) !== 0) {  
341 - vip.show();  
342 - vip.find('.vip' + data.current_vip_level).show();  
343 - }  
344 - },  
345 - error: function() {  
346 - tip.show('网络断开连接了~');  
347 - }  
348 - }); 331 + // $.ajax({
  332 + // method: 'POST',
  333 + // url: '/channel/userVip',
  334 + // data: {
  335 + // channel: 1,
  336 + // },
  337 + // success: function(data) {
  338 + // let vip = $('.vip-only');
  339 +
  340 + // if (data.code === 200 && Number(data.current_vip_level) !== 0) {
  341 + // vip.show();
  342 + // vip.find('.vip' + data.current_vip_level).show();
  343 + // }
  344 + // },
  345 + // error: function() {
  346 + // tip.show('网络断开连接了~');
  347 + // }
  348 + // });
349 349
350 checkShop(); 350 checkShop();
351 351
@@ -85,6 +85,7 @@ $collectShopIcon.on('click', () => { @@ -85,6 +85,7 @@ $collectShopIcon.on('click', () => {
85 85
86 // 获取是否收藏 86 // 获取是否收藏
87 (function() { 87 (function() {
  88 + if ($('.not-collect').data('switch') !== true) {
88 $.ajax({ 89 $.ajax({
89 type: 'GET', 90 type: 'GET',
90 url: location.protocol + '//m.yohobuy.com/product/index/shopFav', 91 url: location.protocol + '//m.yohobuy.com/product/index/shopFav',
@@ -103,4 +104,5 @@ $collectShopIcon.on('click', () => { @@ -103,4 +104,5 @@ $collectShopIcon.on('click', () => {
103 tip.show('网络断开连接了~'); 104 tip.show('网络断开连接了~');
104 } 105 }
105 }); 106 });
  107 + }
106 }()); 108 }());
@@ -65,6 +65,7 @@ let defaultOpt = require('common/query-param'); @@ -65,6 +65,7 @@ let defaultOpt = require('common/query-param');
65 }); 65 });
66 } 66 }
67 67
  68 + if ($('.not-collect').data('switch') !== true) {
68 $.ajax({ 69 $.ajax({
69 type: 'GET', 70 type: 'GET',
70 url: location.protocol + '//m.yohobuy.com/product/index/shopFav', 71 url: location.protocol + '//m.yohobuy.com/product/index/shopFav',
@@ -84,6 +85,7 @@ let defaultOpt = require('common/query-param'); @@ -84,6 +85,7 @@ let defaultOpt = require('common/query-param');
84 tip.show('网络断开连接了~'); 85 tip.show('网络断开连接了~');
85 } 86 }
86 }); 87 });
  88 + }
87 if ($('.popularity-title').data('skns')) { 89 if ($('.popularity-title').data('skns')) {
88 $.ajax({ 90 $.ajax({
89 type: 'GET', 91 type: 'GET',
@@ -24,7 +24,8 @@ lazyLoad($('.lazy'), lazyLoadParams); @@ -24,7 +24,8 @@ lazyLoad($('.lazy'), lazyLoadParams);
24 /** 24 /**
25 * 异步检测是否已经收藏 25 * 异步检测是否已经收藏
26 */ 26 */
27 -$.ajax({ 27 +if ($('.not-collect').data('switch') !== true) {
  28 + $.ajax({
28 type: 'GET', 29 type: 'GET',
29 url: location.protocol + '//m.yohobuy.com/product/index/shopFav', 30 url: location.protocol + '//m.yohobuy.com/product/index/shopFav',
30 xhrFields: { 31 xhrFields: {
@@ -41,7 +42,8 @@ $.ajax({ @@ -41,7 +42,8 @@ $.ajax({
41 error: function() { 42 error: function() {
42 tip.show('网络断开连接了~'); 43 tip.show('网络断开连接了~');
43 } 44 }
44 -}); 45 + });
  46 +}
45 47
46 /** 48 /**
47 * 店铺轮播图 49 * 店铺轮播图
@@ -60,6 +60,7 @@ require('common'); @@ -60,6 +60,7 @@ require('common');
60 }); 60 });
61 } 61 }
62 62
  63 + if ($('.not-collect').data('switch') !== true) {
63 $.ajax({ 64 $.ajax({
64 type: 'GET', 65 type: 'GET',
65 url: location.protocol + '//m.yohobuy.com/product/index/shopFav', 66 url: location.protocol + '//m.yohobuy.com/product/index/shopFav',
@@ -78,6 +79,7 @@ require('common'); @@ -78,6 +79,7 @@ require('common');
78 tip.show('网络断开连接了~'); 79 tip.show('网络断开连接了~');
79 } 80 }
80 }); 81 });
  82 + }
81 }()); 83 }());
82 84
83 // 默认筛选条件 85 // 默认筛选条件