|
@@ -65,6 +65,7 @@ module.exports = class extends global.yoho.BaseModel { |
|
@@ -65,6 +65,7 @@ module.exports = class extends global.yoho.BaseModel { |
65
|
|
65
|
|
66
|
this.getNewProduct = _cached(this._getNewProduct, this);
|
66
|
this.getNewProduct = _cached(this._getNewProduct, this);
|
67
|
this.getGuangArticles = _cached(this._getGuangArticles, this);
|
67
|
this.getGuangArticles = _cached(this._getGuangArticles, this);
|
|
|
68
|
+ this.getRecommendHotKeywords = _cached(this._getRecommendHotKeywords, this);
|
68
|
this.getRecommendKeywords = _cached(this._getRecommendKeywords, this);
|
69
|
this.getRecommendKeywords = _cached(this._getRecommendKeywords, this);
|
69
|
this.getShopRecommendAsync = _cached(this._getShopRecommendAsync, this, ONE_DAY);
|
70
|
this.getShopRecommendAsync = _cached(this._getShopRecommendAsync, this, ONE_DAY);
|
70
|
}
|
71
|
}
|
|
@@ -235,6 +236,17 @@ module.exports = class extends global.yoho.BaseModel { |
|
@@ -235,6 +236,17 @@ module.exports = class extends global.yoho.BaseModel { |
235
|
});
|
236
|
});
|
236
|
}
|
237
|
}
|
237
|
|
238
|
|
|
|
239
|
+ // 根据mid_sort从redis获取分类下的hot关键词
|
|
|
240
|
+ _getRecommendHotKeywords(midSort, skn) { // eslint-disable-line
|
|
|
241
|
+ return redis.all([['get', `global:yoho:seo:hot:keywords:${midSort}:page`]]).then(res => {
|
|
|
242
|
+ return redis.all([
|
|
|
243
|
+ ['get', `global:yoho:seo:hot:keywords:${midSort}:page:${ _.random(1, res[0]) || 1}`]
|
|
|
244
|
+ ]);
|
|
|
245
|
+ }).then(res => {
|
|
|
246
|
+ return this._getKeywordsInfo(JSON.parse(res[0] || '[]'));
|
|
|
247
|
+ });
|
|
|
248
|
+ }
|
|
|
249
|
+
|
238
|
// 根据small_sort从redis获取分类下的关键词
|
250
|
// 根据small_sort从redis获取分类下的关键词
|
239
|
_getRecommendKeywords(smallSort, skn) { // eslint-disable-line
|
251
|
_getRecommendKeywords(smallSort, skn) { // eslint-disable-line
|
240
|
return redis.all([['get', `global:yoho:seo:keywords:sortId:${smallSort}:page`]]).then(res => {
|
252
|
return redis.all([['get', `global:yoho:seo:keywords:sortId:${smallSort}:page`]]).then(res => {
|
|
@@ -252,7 +264,7 @@ module.exports = class extends global.yoho.BaseModel { |
|
@@ -252,7 +264,7 @@ module.exports = class extends global.yoho.BaseModel { |
252
|
|
264
|
|
253
|
_.forEach(_.slice(_.shuffle(keywords), 0, 18), val => {
|
265
|
_.forEach(_.slice(_.shuffle(keywords), 0, 18), val => {
|
254
|
res.push({
|
266
|
res.push({
|
255
|
- url: helpers.urlFormat(`/chanpin/${val.id}.html`),
|
267
|
+ url: helpers.urlFormat(`/${val.is_hot ? 'hot' : 'chanpin'}/${val.id}.html`),
|
256
|
keyword: val.keyword
|
268
|
keyword: val.keyword
|
257
|
});
|
269
|
});
|
258
|
});
|
270
|
});
|