|
@@ -13,6 +13,17 @@ const seoHandler = require('./seo-handler'); |
|
@@ -13,6 +13,17 @@ const seoHandler = require('./seo-handler'); |
13
|
const utils = '../../../utils';
|
13
|
const utils = '../../../utils';
|
14
|
const productProcess = require(`${utils}/product-process-simple`);
|
14
|
const productProcess = require(`${utils}/product-process-simple`);
|
15
|
|
15
|
|
|
|
16
|
+const _handleImageUrl = (url) => {
|
|
|
17
|
+ if (url) {
|
|
|
18
|
+ let imgArr = _.split(url, '?', 1);
|
|
|
19
|
+
|
|
|
20
|
+ imgArr.push('imageView2/1/w/{width}/h/{height}/q/90');
|
|
|
21
|
+ url = imgArr.join('?');
|
|
|
22
|
+ }
|
|
|
23
|
+
|
|
|
24
|
+ return url;
|
|
|
25
|
+}
|
|
|
26
|
+
|
16
|
const _setHotKeywordData = (result, params, channel) => {
|
27
|
const _setHotKeywordData = (result, params, channel) => {
|
17
|
let changeQuery = Object.assign({}, params);
|
28
|
let changeQuery = Object.assign({}, params);
|
18
|
let finalResult = {
|
29
|
let finalResult = {
|
|
@@ -137,17 +148,19 @@ module.exports = class extends global.yoho.BaseModel { |
|
@@ -137,17 +148,19 @@ module.exports = class extends global.yoho.BaseModel { |
137
|
params.query = keyword.name;
|
148
|
params.query = keyword.name;
|
138
|
|
149
|
|
139
|
return this.getSearchProduct(params, channel).then(result => {
|
150
|
return this.getSearchProduct(params, channel).then(result => {
|
|
|
151
|
+ const keyNum = 10;
|
140
|
let hotKeys = (keyword.data || []).map(val => {
|
152
|
let hotKeys = (keyword.data || []).map(val => {
|
141
|
val.href = helpers.urlFormat(`/hot/${val.id}.html`);
|
153
|
val.href = helpers.urlFormat(`/hot/${val.id}.html`);
|
142
|
return val;
|
154
|
return val;
|
143
|
});
|
155
|
});
|
144
|
let seoTDK = seoHandler.getHotKeywordsSeo(keyword.name, _.get(result, 'product.totalCount', '多'));
|
156
|
let seoTDK = seoHandler.getHotKeywordsSeo(keyword.name, _.get(result, 'product.totalCount', '多'));
|
145
|
|
157
|
|
146
|
- keyword.list = _.take(hotKeys, 6);
|
158
|
+ keyword.goods_img = _handleImageUrl(keyword.goods_img);
|
|
|
159
|
+ keyword.list = _.take(hotKeys, keyNum);
|
147
|
keyword.describe = keyword.describe || seoTDK.description;
|
160
|
keyword.describe = keyword.describe || seoTDK.description;
|
148
|
|
161
|
|
149
|
Object.assign(result, {
|
162
|
Object.assign(result, {
|
150
|
- hotKeys: _.drop(hotKeys, 6),
|
163
|
+ hotKeys: _.drop(hotKeys, keyNum),
|
151
|
keyword: keyword
|
164
|
keyword: keyword
|
152
|
}, seoTDK);
|
165
|
}, seoTDK);
|
153
|
|
166
|
|