...
|
...
|
@@ -54,25 +54,25 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
result.data.shopId = _.get(result, 'data.shop_id', null);
|
|
|
|
|
|
let finalResult = detailProcess.prodessDetailData(result.data);
|
|
|
let smallSort = _.get(result, 'data.smallSortId');
|
|
|
let midSort = _.get(result, 'data.middleSortId');
|
|
|
|
|
|
if (!smallSort) {
|
|
|
if (!midSort) {
|
|
|
return finalResult;
|
|
|
}
|
|
|
|
|
|
return this.getRecomdKeywords(smallSort).then(res => {
|
|
|
return this.getRecomdKeywords(midSort).then(res => {
|
|
|
let recomdKeywords = [];
|
|
|
|
|
|
try {
|
|
|
res = res ? JSON.parse(res) : [];
|
|
|
} catch (e) {
|
|
|
logger.error(`smallSort: ${smallSort}, message: ${e.message}`);
|
|
|
logger.error(`middleSort: ${midSort}, message: ${e.message}`);
|
|
|
res = [];
|
|
|
}
|
|
|
|
|
|
_.forEach(_.slice(_.shuffle(res), 0, 12), val => {
|
|
|
recomdKeywords.push({
|
|
|
url: helpers.urlFormat(`/chanpin/${val.id}.html`),
|
|
|
url: helpers.urlFormat(`/mip/hot/${val.id}.html`),
|
|
|
keyword: val.keyword
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -86,8 +86,8 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
});
|
|
|
}
|
|
|
|
|
|
getRecomdKeywords(smallSort) {
|
|
|
return redis.all([['get', `global:yoho:seo:keywords:sortId:${smallSort}:page:1`]]).then(res => {
|
|
|
getRecomdKeywords(midSort) {
|
|
|
return redis.all([['get', `global:yoho:seo:hot:keywords:${midSort}:page:1`]]).then(res => {
|
|
|
return res[0];
|
|
|
});
|
|
|
}
|
...
|
...
|
|