Authored by yyq

search TDK

@@ -20,14 +20,7 @@ const config = global.yoho.config; @@ -20,14 +20,7 @@ const config = global.yoho.config;
20 */ 20 */
21 const index = (req, res, next) => { 21 const index = (req, res, next) => {
22 let params = req.query; 22 let params = req.query;
23 -  
24 - let resData = {  
25 - title: '潮流商品搜索 | YOHO!BUY 有货',  
26 - keywords: 'Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,' +  
27 - '品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,' +  
28 - 'new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流',  
29 - description: '潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜'  
30 - }; 23 + let resData = {};
31 24
32 search.getKeyActivity(params.query).then(activityUrl => { 25 search.getKeyActivity(params.query).then(activityUrl => {
33 if (activityUrl) { 26 if (activityUrl) {
@@ -38,12 +31,20 @@ const index = (req, res, next) => { @@ -38,12 +31,20 @@ const index = (req, res, next) => {
38 31
39 return search.getSearchData(Object.assign(params, {uid: req.user.uid, prid: req.user.prid}), 32 return search.getSearchData(Object.assign(params, {uid: req.user.uid, prid: req.user.prid}),
40 req.yoho.channel).then(result => { 33 req.yoho.channel).then(result => {
  34 + let queryKey = req.query.query;
  35 +
41 Object.assign(resData, result); 36 Object.assign(resData, result);
42 37
43 if (!_.get(resData, 'search.goods') || !_.get(resData, 'search.goods').length) { 38 if (!_.get(resData, 'search.goods') || !_.get(resData, 'search.goods').length) {
44 - _.set(resData, 'search.keyWord', req.query.query); 39 + _.set(resData, 'search.keyWord', queryKey);
45 return res.render('search/no-result', resData); 40 return res.render('search/no-result', resData);
46 } 41 }
  42 +
  43 + Object.assign(resData, {
  44 + title: `${queryKey}价格_图片_品牌_怎么样-YOHO!BUY有货`,
  45 + keywords: `${queryKey},${queryKey}价格,${queryKey}图片,${queryKey}怎么样,${queryKey}品牌,YOHO!BUY有货`,
  46 + description: `YOHO!BUY有货网yohobuy.com是国内专业的${queryKey}网上潮流购物商城,为您找到${_.get(resData, 'search.totalCount', 0)}${queryKey}、产品的详细参数,实时报价,价格行情,图片、评价、品牌等信息。买${queryKey},就上YOHO!BUY有货` // eslint-disable-line
  47 + });
47 res.render('search/index', resData); 48 res.render('search/index', resData);
48 49
49 }); 50 });