...
|
...
|
@@ -10,12 +10,15 @@ const cache = global.yoho.cache; |
|
|
const logger = global.yoho.logger;
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const _ = require('lodash');
|
|
|
const $ = require('cheerio');
|
|
|
|
|
|
const SearchServiceModel = require('./search-api');
|
|
|
const GuangServiceModel = require('../../guang/models/guang-service');
|
|
|
const productProcess = require('../../../utils/product-process');
|
|
|
const uuid = require('uuid');
|
|
|
|
|
|
const specialDescCache = {};
|
|
|
|
|
|
function _cacheGet(key) {
|
|
|
return cache.get(key).then((data) => {
|
|
|
if (data) {
|
...
|
...
|
@@ -236,6 +239,36 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 特别说明
|
|
|
*/
|
|
|
getSpecialDesc(skn) {
|
|
|
let now = new Date().getTime();
|
|
|
|
|
|
if (specialDescCache.time && now - specialDescCache.time < ONE_HOUR * 1000) {
|
|
|
return Promise.resolve(specialDescCache.value);
|
|
|
}
|
|
|
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.product.intro',
|
|
|
product_skn: skn,
|
|
|
app_version: '5.6.0'
|
|
|
},
|
|
|
param: {cache: true}
|
|
|
}).then(result => {
|
|
|
result = _.isString(result) ? result : '';
|
|
|
result = $.load(result);
|
|
|
|
|
|
result = result('.price-description > .price-desc-detail');
|
|
|
|
|
|
specialDescCache.time = now;
|
|
|
specialDescCache.value = result.html() || '';
|
|
|
|
|
|
return specialDescCache.value;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 根据mid_sort从redis获取分类下的hot关键词
|
|
|
_getRecommendHotKeywords(midSort, skn) { // eslint-disable-line
|
|
|
return redis.all([['get', `global:yoho:seo:hot:keywords:${midSort}:page`]]).then(res => {
|
...
|
...
|
|