Authored by 郝肖肖

'news加app字段'

... ... @@ -188,7 +188,7 @@ const guangMap = (req, res, next) => {
const newsMap = (req, res, next) => {
req.ctx(siteMapService).newsList(1, []).then(rdata => {
return _createSitemap(req, res, rdata, 'https://www.yohobuy.com/news/', '.html');
return _createSitemap(req, res, rdata, 'https://www.yohobuy.com/guang/news/', '.html');
}).catch(next);
};
... ...
... ... @@ -47,7 +47,7 @@ module.exports = class extends global.yoho.BaseModel {
}
lres = lres.concat(_.map(artList, (art) => {
return `${art.id}_${art.cid}`;
return `${art.id}_${art.cid}_${art.app}`;
}));
rdata = [];
... ...
... ... @@ -33,10 +33,12 @@ exports.detail = (req, res, next) => {
let channel = req.yoho.channel;
let id = req.params[0] || 0;
let cid = req.params[1] || 0;
let app = req.params[2] || 1;
let query = {
channel: channel,
id: id,
cid: cid,
app: app
};
if (!id || !cid) {
... ...
... ... @@ -82,7 +82,7 @@ module.exports = class extends global.yoho.BaseModel {
lresult = {
id: articleData.id,
classification: _.get(articleData, 'min_category_name', '') || _.get(articleData, 'category_name', ''),
url: helpers.urlFormat(`/guang/news/${articleData.id}_${articleData.cid}.html`),
url: helpers.urlFormat(`/guang/news/${articleData.id}_${articleData.cid}_${articleData.app}.html`),
img: helpers.image(articleData.image, width, height, 1),
title: articleData.title,
pTime: articleData.update_time && moment(articleData.update_time * 1000).format('YYYY年MM月DD HH:mm'),
... ... @@ -189,7 +189,7 @@ module.exports = class extends global.yoho.BaseModel {
// 潮流详情
getContentDetail(newsAPi, params) {
return redis.all([
['get', `global:yoho:news:detail:${params.id}-${params.cid}`]
['get', `global:yoho:news:detail:${params.id}-${params.cid}-${params.app}`]
]).then(redisData => {
redisData = JSON.parse(redisData[0] || '{}');
if (!redisData.data) {
... ... @@ -212,7 +212,8 @@ module.exports = class extends global.yoho.BaseModel {
detail(channel, param) {
let params = {
id: param.id,
cid: param.cid
cid: param.cid,
app: param.app,
};
let newsAPi = new NewsAPi(this.ctx);
let apiMethod = [
... ...
... ... @@ -13,7 +13,7 @@ const newsController = require(`${cRoot}/index`);
const sitemap = require('../3party/controllers/sitemap');
router.get(['/', '/index/index'], newsController.index);
router.get(/\/([\d]+)_([\d]+).html/, newsController.detail);
router.get(/\/([\d]+)_([\d]+)_([\d]+).html/, newsController.detail);
// seo-站点地图
router.get('/sitemap.xml', sitemap.newsMap);
... ...