Authored by 陈峰

merge

@@ -206,14 +206,13 @@ const shop = { @@ -206,14 +206,13 @@ const shop = {
206 206
207 result = _.assign(result, pageHeader); 207 result = _.assign(result, pageHeader);
208 208
209 - console.log(result.hotListproductSkn);  
210 res.render('newshop/shop-classics', { 209 res.render('newshop/shop-classics', {
211 module: 'product', 210 module: 'product',
212 page: 'shop.classics', 211 page: 'shop.classics',
213 shopIndex: result, 212 shopIndex: result,
214 shopHeadHide: true, 213 shopHeadHide: true,
215 gender: req.query.gender, 214 gender: req.query.gender,
216 - channel: req.query.channel, 215 + channel: channel,
217 title: result.seoTitle + '|' + result.seoTitle + '潮流服装服饰-Yoho!Buy有货', 216 title: result.seoTitle + '|' + result.seoTitle + '潮流服装服饰-Yoho!Buy有货',
218 keywords: result.seoTitle + ',' + result.seoTitle + '服装服饰,' + result.seoTitle + '潮流服装服饰', 217 keywords: result.seoTitle + ',' + result.seoTitle + '服装服饰,' + result.seoTitle + '潮流服装服饰',
219 description: result.seoTitle + '|Yoho!Buy有货' + result.seoTitle + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。', 218 description: result.seoTitle + '|Yoho!Buy有货' + result.seoTitle + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',
@@ -223,43 +222,21 @@ const shop = { @@ -223,43 +222,21 @@ const shop = {
223 222
224 }); 223 });
225 } 224 }
226 -  
227 - // if (result.goBrand) {  
228 -  
229 -  
230 - // } else {  
231 - // return listModel.searchProductBySkn(result.hotListproductSkn).then(hotList => {  
232 - // result = _.assign(result, pageHeader, {  
233 - // hotList: productProcess.processProductList(hotList, {isApp: isApp})  
234 - // });  
235 -  
236 - // _.forEach(result.hotList, (value, key) => {  
237 - // result.hotList[key].tags = {};  
238 - // result.hotList[key].is_soon_sold_out = false;  
239 - // result.hotList[key].tags.is_hot = true;  
240 - // });  
241 -  
242 - // // 有领券功能,不缓存  
243 - // res.set('Cache-Control', 'no-cache');  
244 -  
245 - // res.render('shop/index', {  
246 - // module: 'product',  
247 - // page: 'shop',  
248 - // shopIndex: result,  
249 - // shopHeadHide: true,  
250 - // gender: req.query.gender,  
251 - // channel: req.query.channel,  
252 - // title: result.seoTitle + '|' + result.seoTitle + '潮流服装服饰-Yoho!Buy有货',  
253 - // keywords: result.seoTitle + ',' + result.seoTitle + '服装服饰,' + result.seoTitle + '潮流服装服饰',  
254 - // description: result.seoTitle + '|Yoho!Buy有货' + result.seoTitle + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',  
255 - // shopId: shopId,  
256 - // shopPage: true  
257 - // });  
258 -  
259 - // });  
260 - // }  
261 }).catch(next); 225 }).catch(next);
262 }, 226 },
  227 + _getUidFromUserAgent(req) {
  228 + let userAgent = _.split(req.headers['user-agent'], ';');
  229 + let uidString = '';
  230 +
  231 + _.forEach(userAgent, value => {
  232 + if (_.startsWith(value, 'uid')) {
  233 + uidString = value;
  234 + return;
  235 + }
  236 + });
  237 +
  238 + return _.split(uidString, '=')[1];
  239 + },
263 /** 240 /**
264 * TODO TAR 店铺和品牌收藏状态调用新的接口 241 * TODO TAR 店铺和品牌收藏状态调用新的接口
265 * 基础模板收藏 242 * 基础模板收藏
@@ -310,5 +287,23 @@ const shop = { @@ -310,5 +287,23 @@ const shop = {
310 }).catch(next); 287 }).catch(next);
311 } 288 }
312 }; 289 };
  290 +/**
  291 + * 从 useragent 获取 uid
  292 + * @returns {*}
  293 + * @private
  294 + */
  295 +const _getUidFromUserAgent = (req) => {
  296 + let userAgent = _.split(req.headers['user-agent'], ';');
  297 + let uidString = '';
  298 +
  299 + _.forEach(userAgent, value => {
  300 + if (_.startsWith(value, 'uid')) {
  301 + uidString = value;
  302 + return;
  303 + }
  304 + });
  305 +
  306 + return _.split(uidString, '=')[1];
  307 +};
313 308
314 module.exports = shop; 309 module.exports = shop;
@@ -140,6 +140,7 @@ router.get('/new/brand', newShop.index); @@ -140,6 +140,7 @@ router.get('/new/brand', newShop.index);
140 router.get('/new/baseShopFav', newShop.baseShopFav); 140 router.get('/new/baseShopFav', newShop.baseShopFav);
141 router.get('/new/brandFav', newShop.brandFav); 141 router.get('/new/brandFav', newShop.brandFav);
142 router.get('/new/shop/hotlist', newShop.shopHotList); 142 router.get('/new/shop/hotlist', newShop.shopHotList);
  143 +
143 // end- 店铺重构 144 // end- 店铺重构
144 145
145 // 店铺介绍 146 // 店铺介绍