...
|
...
|
@@ -65,6 +65,7 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
|
|
|
this.getNewProduct = _cached(this._getNewProduct, this);
|
|
|
this.getGuangArticles = _cached(this._getGuangArticles, this);
|
|
|
this.getRecommendHotKeywords = _cached(this._getRecommendHotKeywords, this);
|
|
|
this.getRecommendKeywords = _cached(this._getRecommendKeywords, this);
|
|
|
this.getShopRecommendAsync = _cached(this._getShopRecommendAsync, this, ONE_DAY);
|
|
|
}
|
...
|
...
|
@@ -235,6 +236,17 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
});
|
|
|
}
|
|
|
|
|
|
// 根据mid_sort从redis获取分类下的hot关键词
|
|
|
_getRecommendHotKeywords(midSort, skn) { // eslint-disable-line
|
|
|
return redis.all([['get', `global:yoho:seo:hot:keywords:${midSort}:page`]]).then(res => {
|
|
|
return redis.all([
|
|
|
['get', `global:yoho:seo:hot:keywords:${midSort}:page:${ _.random(1, res[0]) || 1}`]
|
|
|
]);
|
|
|
}).then(res => {
|
|
|
return this._getKeywordsInfo(JSON.parse(res[0] || '[]'));
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 根据small_sort从redis获取分类下的关键词
|
|
|
_getRecommendKeywords(smallSort, skn) { // eslint-disable-line
|
|
|
return redis.all([['get', `global:yoho:seo:keywords:sortId:${smallSort}:page`]]).then(res => {
|
...
|
...
|
@@ -252,7 +264,7 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
|
|
|
_.forEach(_.slice(_.shuffle(keywords), 0, 18), val => {
|
|
|
res.push({
|
|
|
url: helpers.urlFormat(`/chanpin/${val.id}.html`),
|
|
|
url: helpers.urlFormat(`/${val.is_hot ? 'hot' : 'chanpin'}/${val.id}.html`),
|
|
|
keyword: val.keyword
|
|
|
});
|
|
|
});
|
...
|
...
|
|