...
|
...
|
@@ -7,6 +7,7 @@ const NewsAPi = require('./news-api'); |
|
|
const utils = require('./utils');
|
|
|
const moment = require('moment');
|
|
|
const searchHandler = require('../../product/models/search-handler');
|
|
|
const redis = global.yoho.redis;
|
|
|
|
|
|
const BOYS = 'boys';
|
|
|
const GIRLS = 'girls';
|
...
|
...
|
@@ -179,6 +180,19 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
return {header: header, content: utils.filterAhtml(content)};
|
|
|
}
|
|
|
|
|
|
// 潮流详情
|
|
|
getContentDetail(newsAPi, params) {
|
|
|
return redis.all([
|
|
|
['get', `global:yoho:news:detail:${params.id}-${params.cid}`]
|
|
|
]).then(redisData => {
|
|
|
redisData = JSON.parse(redisData[0] || '{}');
|
|
|
if (!redisData.data) {
|
|
|
return newsAPi.getContentDetail(params);
|
|
|
}
|
|
|
return redisData;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
detail(channel, param) {
|
|
|
let params = {
|
|
|
id: param.id,
|
...
|
...
|
@@ -196,7 +210,7 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
content_code: ADS_CODE[channel] || ADS_CODE.boys,
|
|
|
isAdDegrade: _.get(this.ctx, 'req.app.locals.pc.guang.removeAd', false)
|
|
|
}),
|
|
|
newsAPi.getContentDetail(params)
|
|
|
this.getContentDetail(newsAPi, params)
|
|
|
];
|
|
|
|
|
|
return Promise.all(apiMethod).then(result => {
|
...
|
...
|
|