Authored by 陈峰

降级开发完成

@@ -72,7 +72,7 @@ app.use(session({ @@ -72,7 +72,7 @@ app.use(session({
72 app.use((req, res, next) => { 72 app.use((req, res, next) => {
73 req.user = {}; // 全局的用户数据 73 req.user = {}; // 全局的用户数据
74 req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等 74 req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等
75 - 75 + req.app.locals.wap = app.locals.wap; //zookeper对象赋值
76 if (!req.session.id) { 76 if (!req.session.id) {
77 req.session.id = uuid.v4(); 77 req.session.id = uuid.v4();
78 } 78 }
@@ -334,8 +334,8 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => { @@ -334,8 +334,8 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => {
334 shareLink: '//guang.m.yohobuy.com/plustar/brandinfo?id=' + id, 334 shareLink: '//guang.m.yohobuy.com/plustar/brandinfo?id=' + id,
335 shareTitle: list.brandName, 335 shareTitle: list.brandName,
336 shareImg: list.brandIco, 336 shareImg: list.brandIco,
337 - shareDesc: htmlProcess.removeHtml(list.brandIntro)  
338 - 337 + shareDesc: htmlProcess.removeHtml(list.brandIntro),
  338 + clientType: clientType
339 }); 339 });
340 340
341 return list; 341 return list;
@@ -6,9 +6,11 @@ @@ -6,9 +6,11 @@
6 <div class="header-content clearfix"> 6 <div class="header-content clearfix">
7 <p class="name-islike-container"> 7 <p class="name-islike-container">
8 <span class="name">{{brand_name}}</span> 8 <span class="name">{{brand_name}}</span>
  9 + {{#unless @root.wap.plustar.removeCollect}}
9 <a id="brand-like" class="brand-islike iconfont" href="{{likeUrl}}"> 10 <a id="brand-like" class="brand-islike iconfont" href="{{likeUrl}}">
10 &#xe605; 11 &#xe605;
11 </a> 12 </a>
  13 + {{/unless}}
12 </p> 14 </p>
13 <div id="more-intro-click-range" class="clearfix"> 15 <div id="more-intro-click-range" class="clearfix">
14 <div id="intro" class="intro"> 16 <div id="intro" class="intro">
@@ -98,9 +100,11 @@ @@ -98,9 +100,11 @@
98 </div> 100 </div>
99 101
100 <input id="jump-to-app" type="hidden" value="{{jumpToApp}}"> 102 <input id="jump-to-app" type="hidden" value="{{jumpToApp}}">
101 - <input id="brandId" type="hidden" value="{{brandId}}"> 103 + <input id="brandId" type="hidden" value="{{brand_id}}">
102 <input id="clientType" type="hidden" value="{{clientType}}"> 104 <input id="clientType" type="hidden" value="{{clientType}}">
103 - 105 + {{#unless @root.wap.plustar.removeRelatedPost}}
  106 + <input id="related-infos-demote" type="hidden" value="1">
  107 + {{/unless}}
104 {{!-- wx-share --}} 108 {{!-- wx-share --}}
105 <input id="shareLink" type="hidden" value="{{shareLink}}"> 109 <input id="shareLink" type="hidden" value="{{shareLink}}">
106 <input id="shareImg" type="hidden" value="{{shareImg}}"> 110 <input id="shareImg" type="hidden" value="{{shareImg}}">
@@ -127,8 +127,9 @@ @@ -127,8 +127,9 @@
127 <span class="iconfont num">&#xe604;</span> 127 <span class="iconfont num">&#xe604;</span>
128 </a> 128 </a>
129 </div> 129 </div>
130 - 130 + {{#unless @root.wap.ucenter.removePrefer}}
131 {{> common/recommend-for-you}} 131 {{> common/recommend-for-you}}
  132 + {{/unless}}
132 {{> common/suspend-cart}} 133 {{> common/suspend-cart}}
133 </div> 134 </div>
134 135
@@ -33,7 +33,9 @@ exports.cart = (req, res, next) => { @@ -33,7 +33,9 @@ exports.cart = (req, res, next) => {
33 uid = req.user.uid || 0, 33 uid = req.user.uid || 0,
34 yhChannel = req.query.yh_channel || '1', 34 yhChannel = req.query.yh_channel || '1',
35 limit = 30; 35 limit = 30;
36 - 36 + if (req.app.locals.wap.cart.removePrefer) {
  37 + return res.send('');
  38 + }
37 recommendForYouModel.getPreference({ 39 recommendForYouModel.getPreference({
38 yh_channel: yhChannel, 40 yh_channel: yhChannel,
39 udid: udid, 41 udid: udid,
@@ -52,4 +54,5 @@ exports.cart = (req, res, next) => { @@ -52,4 +54,5 @@ exports.cart = (req, res, next) => {
52 page: 'recommend' 54 page: 'recommend'
53 }); 55 });
54 }).catch(next); 56 }).catch(next);
  57 +
55 }; 58 };
@@ -132,8 +132,16 @@ const list = (req, res, next) => { @@ -132,8 +132,16 @@ const list = (req, res, next) => {
132 */ 132 */
133 const index = (req, res, next) => { 133 const index = (req, res, next) => {
134 let title = '搜索'; 134 let title = '搜索';
135 - 135 + ((render) => {
  136 + if (req.app.locals.wap.search.removeHotSearch) {
  137 + render([]);
  138 + } else {
136 searchModel.getSearchIndex().then((result) => { 139 searchModel.getSearchIndex().then((result) => {
  140 + render(result);
  141 + }).catch(next);
  142 + }
  143 +
  144 + })((result) => {
137 res.render('search/index', { 145 res.render('search/index', {
138 module: 'product', 146 module: 'product',
139 page: 'search-index', 147 page: 'search-index',
@@ -142,13 +150,14 @@ const index = (req, res, next) => { @@ -142,13 +150,14 @@ const index = (req, res, next) => {
142 }), 150 }),
143 pageFooter: true, 151 pageFooter: true,
144 search: { 152 search: {
145 - defaultTerms: result[0].content || '', 153 + defaultTerms: result.length && result[0].content || '',
146 url: helpers.urlFormat('', null, 'search'), 154 url: helpers.urlFormat('', null, 'search'),
147 hotTerms: result 155 hotTerms: result
148 } 156 }
149 157
150 }); 158 });
151 - }).catch(next); 159 + })
  160 +
152 }; 161 };
153 162
154 /** 163 /**
@@ -125,6 +125,9 @@ @@ -125,6 +125,9 @@
125 <div class="chose-panel"></div> 125 <div class="chose-panel"></div>
126 126
127 <div class="cart-bar data-bind"> 127 <div class="cart-bar data-bind">
  128 + {{#unless @root.wap.common.removeCartCount}}
  129 + <input type="hidden" id="remove-cart-count" value="1">
  130 + {{/unless}}
128 <a href="" class="num-incart iconfont"><span class="num-tag hide"></span>&#xe62c;</a> 131 <a href="" class="num-incart iconfont"><span class="num-tag hide"></span>&#xe62c;</a>
129 <a id="addtoCart" href="javascript:;" class="addto-cart add-to-cart-url data-bind"></a> 132 <a id="addtoCart" href="javascript:;" class="addto-cart add-to-cart-url data-bind"></a>
130 <a id="soldOut" href="javascript:;" class="sold-out data-bind">已售罄</a> 133 <a id="soldOut" href="javascript:;" class="sold-out data-bind">已售罄</a>
@@ -16,15 +16,15 @@ module.exports = { @@ -16,15 +16,15 @@ module.exports = {
16 siteUrl: '//m.yohobuy.com', 16 siteUrl: '//m.yohobuy.com',
17 assetUrl: '//localhost:5001', 17 assetUrl: '//localhost:5001',
18 domains: { 18 domains: {
19 - api: 'http://api-test3.yohops.com:9999/',  
20 - service: 'http://service-test3.yohops.com:9999/',  
21 - liveApi: 'http://testapi.live.yohops.com:9999/',  
22 - singleApi: 'http://api-test3.yohops.com:9999/' 19 + // api: 'http://api-test3.yohops.com:9999/',
  20 + // service: 'http://service-test3.yohops.com:9999/',
  21 + // liveApi: 'http://testapi.live.yohops.com:9999/',
  22 + // singleApi: 'http://api-test3.yohops.com:9999/'
23 23
24 - // api: 'http://api.yoho.cn/',  
25 - // service: 'http://service.yoho.cn/',  
26 - // liveApi: 'http://api.live.yoho.cn/',  
27 - // singleApi: 'http://single.yoho.cn/' 24 + api: 'http://api.yoho.cn/',
  25 + service: 'http://service.yoho.cn/',
  26 + liveApi: 'http://api.live.yoho.cn/',
  27 + singleApi: 'http://single.yoho.cn/'
28 28
29 }, 29 },
30 subDomains: { 30 subDomains: {
@@ -79,7 +79,7 @@ module.exports = { @@ -79,7 +79,7 @@ module.exports = {
79 appSecret: 'ce21ae4a3f93852279175a167e54509b' 79 appSecret: 'ce21ae4a3f93852279175a167e54509b'
80 } 80 }
81 }, 81 },
82 - zookeeperServer: false // '10.66.1.97:2181' 82 + zookeeperServer: '192.168.102.168:2188'
83 }; 83 };
84 84
85 if (isProduction) { 85 if (isProduction) {
@@ -104,7 +104,8 @@ if (isProduction) { @@ -104,7 +104,8 @@ if (isProduction) {
104 interfaceShunt: { 104 interfaceShunt: {
105 open: false, 105 open: false,
106 url: 'http://123.206.2.55/strategy' 106 url: 'http://123.206.2.55/strategy'
107 - } 107 + },
  108 + zookeeperServer: '10.66.1.97:2181'
108 }); 109 });
109 } else if (isTest) { 110 } else if (isTest) {
110 Object.assign(module.exports, { 111 Object.assign(module.exports, {
@@ -4,5 +4,6 @@ @@ -4,5 +4,6 @@
4 </a> 4 </a>
5 {{#unless @root.wap.common.removeCartCount}} 5 {{#unless @root.wap.common.removeCartCount}}
6 <span class="cart-count hide">0</span> 6 <span class="cart-count hide">0</span>
  7 + <input type="hidden" id="remove-cart-count" value="1">
7 {{/unless}} 8 {{/unless}}
8 </div> 9 </div>
@@ -7,8 +7,8 @@ @@ -7,8 +7,8 @@
7 var $ = require('yoho-jquery'); 7 var $ = require('yoho-jquery');
8 8
9 var $cart = $('#suspend-cart'); 9 var $cart = $('#suspend-cart');
10 -  
11 -$.ajax({ 10 +if ($('#remove-cart-count').length) {
  11 + $.ajax({
12 type: 'GET', 12 type: 'GET',
13 url: '/cart/index/count', 13 url: '/cart/index/count',
14 success: function(data) { 14 success: function(data) {
@@ -25,4 +25,6 @@ $.ajax({ @@ -25,4 +25,6 @@ $.ajax({
25 $cart.find('.cart-count').html(count).removeClass('hide'); 25 $cart.find('.cart-count').html(count).removeClass('hide');
26 } 26 }
27 } 27 }
28 -}); 28 + });
  29 +}
  30 +
@@ -5,7 +5,7 @@ var $ = require('yoho-jquery'), @@ -5,7 +5,7 @@ var $ = require('yoho-jquery'),
5 module.exports = function(callback) { 5 module.exports = function(callback) {
6 var brandId = $('#brandId').val(); 6 var brandId = $('#brandId').val();
7 var clientType = $('#clientType').val(); 7 var clientType = $('#clientType').val();
8 - if (brandId) { 8 + if (brandId && $('#related-infos-demote').length) {
9 $.ajax({ 9 $.ajax({
10 type: 'POST', 10 type: 'POST',
11 url: '/guang/plustar/brandinfoAsync', 11 url: '/guang/plustar/brandinfoAsync',
@@ -87,9 +87,10 @@ moreHammer.on('tap', function(e) { @@ -87,9 +87,10 @@ moreHammer.on('tap', function(e) {
87 e.preventDefault(); // 防止收缩后误点到商品产生跳转 87 e.preventDefault(); // 防止收缩后误点到商品产生跳转
88 }); 88 });
89 89
90 -// 品牌收藏  
91 -likeHammer = new Hammer(document.getElementById('brand-like'));  
92 -likeHammer.on('tap', function(e) { 90 +if ($('#brand-like').length) {
  91 + // 品牌收藏
  92 + likeHammer = new Hammer(document.getElementById('brand-like'));
  93 + likeHammer.on('tap', function(e) {
93 var opt = 'ok', 94 var opt = 'ok',
94 $this = $(e.target); 95 $this = $(e.target);
95 96
@@ -127,6 +128,8 @@ likeHammer.on('tap', function(e) { @@ -127,6 +128,8 @@ likeHammer.on('tap', function(e) {
127 tip.show('网络断开连接了~'); 128 tip.show('网络断开连接了~');
128 } 129 }
129 }); 130 });
130 -}); 131 + });
  132 +}
  133 +
131 134
132 // console.log($('.logo').attr('src')) 135 // console.log($('.logo').attr('src'))
@@ -13,8 +13,10 @@ var myImage = new Image(), @@ -13,8 +13,10 @@ var myImage = new Image(),
13 avatar; 13 avatar;
14 14
15 require('../common'); 15 require('../common');
16 -require('./recommend-for-you-user-center');  
17 -require('../product/suspend-cart.js'); 16 +if ($('.recommend-for-you').length) {
  17 + require('./recommend-for-you-user-center');
  18 +}
  19 +require('../common/suspend-cart');
18 require('../common/footer'); 20 require('../common/footer');
19 21
20 // 部分老用户没有头像,显示默认头像 22 // 部分老用户没有头像,显示默认头像
@@ -126,6 +126,7 @@ require('./detail/page-render')(function() { @@ -126,6 +126,7 @@ require('./detail/page-render')(function() {
126 require('./detail/consultform'); 126 require('./detail/consultform');
127 require('./detail/recommend-for-you-product-desc'); 127 require('./detail/recommend-for-you-product-desc');
128 128
  129 + if ($('#remove-cart-count').length) {
129 // 购物车商品数量 130 // 购物车商品数量
130 $.ajax({ 131 $.ajax({
131 type: 'GET', 132 type: 'GET',
@@ -145,6 +146,7 @@ require('./detail/page-render')(function() { @@ -145,6 +146,7 @@ require('./detail/page-render')(function() {
145 } 146 }
146 } 147 }
147 }); 148 });
  149 + }
148 150
149 if ($('.good-detail-page').length > 0) { 151 if ($('.good-detail-page').length > 0) {
150 $('#yoho-footer').css('border-top', '1px solid #e0e0e0'); 152 $('#yoho-footer').css('border-top', '1px solid #e0e0e0');
@@ -128,6 +128,7 @@ require('./detail/page-render')(function() { @@ -128,6 +128,7 @@ require('./detail/page-render')(function() {
128 require('./detail/consultform'); 128 require('./detail/consultform');
129 require('./detail/recommend-for-you-product-desc'); 129 require('./detail/recommend-for-you-product-desc');
130 130
  131 + if ($('#remove-cart-count').length) {
131 // 购物车商品数量 132 // 购物车商品数量
132 $.ajax({ 133 $.ajax({
133 type: 'GET', 134 type: 'GET',
@@ -147,6 +148,7 @@ require('./detail/page-render')(function() { @@ -147,6 +148,7 @@ require('./detail/page-render')(function() {
147 } 148 }
148 } 149 }
149 }); 150 });
  151 + }
150 152
151 if ($('.good-detail-page').length > 0) { 153 if ($('.good-detail-page').length > 0) {
152 $('#yoho-footer').css('border-top', '1px solid #e0e0e0'); 154 $('#yoho-footer').css('border-top', '1px solid #e0e0e0');
@@ -8,7 +8,8 @@ var $ = require('yoho-jquery'); @@ -8,7 +8,8 @@ var $ = require('yoho-jquery');
8 8
9 var $cart = $('#suspend-cart'); 9 var $cart = $('#suspend-cart');
10 10
11 -$.ajax({ 11 +if ($('#remove-cart-count').length) {
  12 + $.ajax({
12 type: 'GET', 13 type: 'GET',
13 url: '/cart/index/count', 14 url: '/cart/index/count',
14 success: function(data) { 15 success: function(data) {
@@ -25,4 +26,5 @@ $.ajax({ @@ -25,4 +26,5 @@ $.ajax({
25 $cart.find('.cart-count').html(count).removeClass('hide'); 26 $cart.find('.cart-count').html(count).removeClass('hide');
26 } 27 }
27 } 28 }
28 -}); 29 + });
  30 +}