...
|
...
|
@@ -13,6 +13,17 @@ const seoHandler = require('./seo-handler'); |
|
|
const utils = '../../../utils';
|
|
|
const productProcess = require(`${utils}/product-process-simple`);
|
|
|
|
|
|
const _handleImageUrl = (url) => {
|
|
|
if (url) {
|
|
|
let imgArr = _.split(url, '?', 1);
|
|
|
|
|
|
imgArr.push('imageView2/1/w/{width}/h/{height}/q/90');
|
|
|
url = imgArr.join('?');
|
|
|
}
|
|
|
|
|
|
return url;
|
|
|
}
|
|
|
|
|
|
const _setHotKeywordData = (result, params, channel) => {
|
|
|
let changeQuery = Object.assign({}, params);
|
|
|
let finalResult = {
|
...
|
...
|
@@ -137,17 +148,19 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
params.query = keyword.name;
|
|
|
|
|
|
return this.getSearchProduct(params, channel).then(result => {
|
|
|
const keyNum = 10;
|
|
|
let hotKeys = (keyword.data || []).map(val => {
|
|
|
val.href = helpers.urlFormat(`/hot/${val.id}.html`);
|
|
|
return val;
|
|
|
});
|
|
|
let seoTDK = seoHandler.getHotKeywordsSeo(keyword.name, _.get(result, 'product.totalCount', '多'));
|
|
|
|
|
|
keyword.list = _.take(hotKeys, 6);
|
|
|
keyword.goods_img = _handleImageUrl(keyword.goods_img);
|
|
|
keyword.list = _.take(hotKeys, keyNum);
|
|
|
keyword.describe = keyword.describe || seoTDK.description;
|
|
|
|
|
|
Object.assign(result, {
|
|
|
hotKeys: _.drop(hotKeys, 6),
|
|
|
hotKeys: _.drop(hotKeys, keyNum),
|
|
|
keyword: keyword
|
|
|
}, seoTDK);
|
|
|
|
...
|
...
|
|