Authored by 郝肖肖

'chanpin截取12个'

... ... @@ -8,6 +8,7 @@ const bundle = require('./bundle');
const utils = '../../../utils';
const detailProcess = require(`${utils}/detail-process`);
const redis = require(`${utils}/redis`);
const logger = global.yoho.logger;
// const api = global.yoho.API;
const helpers = global.yoho.helpers;
... ... @@ -62,7 +63,12 @@ module.exports = class extends global.yoho.BaseModel {
return this.getRecomdKeywords(smallSort).then(res => {
let recomdKeywords = [];
res = res ? JSON.parse(res) : [];
try {
res = res ? JSON.parse(res) : [];
} catch (e) {
logger.error(`smallSort: ${smallSort}, message: ${e.message}`);
res = [];
}
_.forEach(_.slice(_.shuffle(res), 0, 12), val => {
recomdKeywords.push({
... ...
... ... @@ -612,7 +612,7 @@ const getSearchKeywordDataById = (id, params, uid) => {
});
});
_.set(result, 'fuzzyWord', redisData.data);
_.set(result, 'fuzzyWord', tdata);
}
return result;
... ...