Authored by 郝肖肖

'guang分词'

... ... @@ -7,6 +7,7 @@
const serviceAPI = global.yoho.ServiceAPI;
const _ = require('lodash');
const helpers = global.yoho.helpers;
const redis = require('../../../utils/redis');
const URI_PACKAGE_ARTICLE = 'guang/service/v2/article/';
const URI_PACKAGE_AUTHOR = 'guang/service/v1/author/';
... ... @@ -204,6 +205,21 @@ class DetailModel extends global.yoho.BaseModel {
});
}
// 获取逛文章分词内容
_getGuangArticleKeyword(id) {
return redis.all([
['get', `global:yoho:guang:detail:${id}`]
]).then(redisData => {
redisData = JSON.parse(redisData[0] || '{}');
if (!redisData.data) {
return this._getArticleContent(id);
}
return redisData;
});
}
/**
* [逛资讯详情页数据封装]
* @param {[int]} id [内容ID]
... ... @@ -229,7 +245,7 @@ class DetailModel extends global.yoho.BaseModel {
let article = result.getArticle = data && data.data || {};
let promises = [
this._getAuthor(article.author_id),
this._getArticleContent(id),
this._getGuangArticleKeyword(id),
this._getBrand(id)
];
... ...
... ... @@ -85,7 +85,7 @@ module.exports = class extends global.yoho.BaseModel {
syncTypeName: contents.syncTypeName || 'YOHO潮流志',
publishTime: contents.update_time && moment(contents.update_time * 1000).format('MM月DD HH:mm'),
};
let content = newsUtils.filterPhtml(contents.content.replace(/www.yohobuy.com/ig, 'm.yohobuy.com'), [
let content = newsUtils.filterPhtml(contents.content.replace(/www.yohobuy.com\/chanpin/ig, 'm.yohobuy.com/chanpin/'), [
'阅读原文',
'点击这里',
'点这里'
... ...
... ... @@ -37,7 +37,7 @@ const util = {
let $ = cheerio.load(html, {decodeEntities: false});
$('a').removeAttr('style').removeAttr('target').not('.a-anchor').attr('href', 'javascript:void(0);').css({cursor: 'text'});// eslint-disable-line
$('a').removeAttr('style').not('.a-anchor').attr('href', 'javascript:void(0);').css({cursor: 'text'});// eslint-disable-line
$('script,link').remove();
html = $.html();
... ...
... ... @@ -873,6 +873,11 @@ $focus-size: 42px;
overflow: visible;
}
}
.a-anchor {
color: #93b4c5;
text-decoration: underline;
}
}
.guang-detail-page.menu-open {
... ...
... ... @@ -246,7 +246,7 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW
newText = value.text.data.text;
}
finalDetail.push({
text: newText
text: newText.replace(/www.yohobuy.com\/chanpin/ig, 'm.yohobuy.com/chanpin')
});
}
... ...