Authored by 郝肖肖

'news-app字段'

@@ -38,10 +38,12 @@ exports.detail = (req, res, next) => { @@ -38,10 +38,12 @@ exports.detail = (req, res, next) => {
38 let channel = req.yoho.channel; 38 let channel = req.yoho.channel;
39 let id = req.params[0] || 0; 39 let id = req.params[0] || 0;
40 let cid = req.params[1] || 0; 40 let cid = req.params[1] || 0;
  41 + let app = req.params[2] || 0;
41 let query = { 42 let query = {
42 channel: channel, 43 channel: channel,
43 id: id, 44 id: id,
44 cid: cid, 45 cid: cid,
  46 + app: app,
45 }; 47 };
46 48
47 if (!id || !cid) { 49 if (!id || !cid) {
@@ -26,7 +26,7 @@ module.exports = class extends global.yoho.BaseModel { @@ -26,7 +26,7 @@ module.exports = class extends global.yoho.BaseModel {
26 26
27 lresult = { 27 lresult = {
28 id: articleData.id, 28 id: articleData.id,
29 - url: helpers.urlFormat(`/guang/news/${articleData.id}_${articleData.cid}.html`), 29 + url: helpers.urlFormat(`/guang/news/${articleData.id}_${articleData.cid}_${articleData.app}.html`),
30 img: helpers.image(articleData.image, width, height, 1), 30 img: helpers.image(articleData.image, width, height, 1),
31 title: articleData.title, 31 title: articleData.title,
32 publishTime: articleData.update_time && moment(articleData.update_time * 1000).format('MM月DD HH:mm'), 32 publishTime: articleData.update_time && moment(articleData.update_time * 1000).format('MM月DD HH:mm'),
@@ -102,11 +102,12 @@ module.exports = class extends global.yoho.BaseModel { @@ -102,11 +102,12 @@ module.exports = class extends global.yoho.BaseModel {
102 detail(channel, param) { 102 detail(channel, param) {
103 let params = { 103 let params = {
104 id: param.id, 104 id: param.id,
105 - cid: param.cid 105 + cid: param.cid,
  106 + app: param.app
106 }; 107 };
107 108
108 return redis.all([ 109 return redis.all([
109 - ['get', `global:yoho:news:detail:${params.id}-${params.cid}`] 110 + ['get', `global:yoho:news:detail:${params.id}-${params.cid}-param.app`]
110 ]).then(redisData => { 111 ]).then(redisData => {
111 redisData = JSON.parse(redisData[0] || '{}'); 112 redisData = JSON.parse(redisData[0] || '{}');
112 113
@@ -12,7 +12,7 @@ const cRoot = './controllers'; @@ -12,7 +12,7 @@ const cRoot = './controllers';
12 const newsController = require(`${cRoot}/index`); 12 const newsController = require(`${cRoot}/index`);
13 13
14 router.get(['/', '/index/index'], newsController.index); 14 router.get(['/', '/index/index'], newsController.index);
15 -router.get(/\/([\d]+)_([\d]+).html/, newsController.detail); 15 +router.get(/\/([\d]+)_([\d]+)_([\d]+).html/, newsController.detail);
16 16
17 17
18 // ajax 18 // ajax