Showing
1 changed file
with
10 additions
and
20 deletions
@@ -8,7 +8,6 @@ const library = '../../../library'; | @@ -8,7 +8,6 @@ const library = '../../../library'; | ||
8 | const _ = require('lodash'); | 8 | const _ = require('lodash'); |
9 | const channelModel = require('../models/channel'); | 9 | const channelModel = require('../models/channel'); |
10 | const helpers = require(`${library}/helpers`); | 10 | const helpers = require(`${library}/helpers`); |
11 | -const log = require(`${library}/logger`); | ||
12 | 11 | ||
13 | const renderData = { | 12 | const renderData = { |
14 | module: 'channel', | 13 | module: 'channel', |
@@ -27,11 +26,6 @@ const renderData = { | @@ -27,11 +26,6 @@ const renderData = { | ||
27 | pageFooter: true | 26 | pageFooter: true |
28 | }; | 27 | }; |
29 | 28 | ||
30 | -const channelLogger = (err, res) => { | ||
31 | - log.error('频道页面渲染错误:' + JSON.stringify(err)); | ||
32 | - res.send('error'); | ||
33 | -}; | ||
34 | - | ||
35 | /** | 29 | /** |
36 | * 频道页生成函数 | 30 | * 频道页生成函数 |
37 | * @param {[object]} req | 31 | * @param {[object]} req |
@@ -45,15 +39,13 @@ const channelPage = (req, res, data) => { | @@ -45,15 +39,13 @@ const channelPage = (req, res, data) => { | ||
45 | uid: _.toString(req.user.uid) | 39 | uid: _.toString(req.user.uid) |
46 | }).then(result => { | 40 | }).then(result => { |
47 | res.render('channel', Object.assign({}, renderData, data, result)); | 41 | res.render('channel', Object.assign({}, renderData, data, result)); |
48 | - }).catch((err) => { | ||
49 | - channelLogger(err, res); | ||
50 | }); | 42 | }); |
51 | }; | 43 | }; |
52 | 44 | ||
53 | /** | 45 | /** |
54 | * 频道选择页 | 46 | * 频道选择页 |
55 | */ | 47 | */ |
56 | -exports.index = (req, res) => { | 48 | +exports.index = (req, res, next) => { |
57 | channelModel.getChannelSwitchData().then((result) => { | 49 | channelModel.getChannelSwitchData().then((result) => { |
58 | res.render('index', { | 50 | res.render('index', { |
59 | module: 'channel', | 51 | module: 'channel', |
@@ -64,7 +56,7 @@ exports.index = (req, res) => { | @@ -64,7 +56,7 @@ exports.index = (req, res) => { | ||
64 | channelList: result[0], | 56 | channelList: result[0], |
65 | background: result[1] | 57 | background: result[1] |
66 | }); | 58 | }); |
67 | - }); | 59 | + }).catch(next); |
68 | }; | 60 | }; |
69 | 61 | ||
70 | /** | 62 | /** |
@@ -101,35 +93,35 @@ exports.boys = (req, res, next) => { | @@ -101,35 +93,35 @@ exports.boys = (req, res, next) => { | ||
101 | /** | 93 | /** |
102 | * 女生首页 | 94 | * 女生首页 |
103 | */ | 95 | */ |
104 | -exports.girls = (req, res) => { | 96 | +exports.girls = (req, res, next) => { |
105 | channelPage(req, res, { | 97 | channelPage(req, res, { |
106 | gender: 'girls', | 98 | gender: 'girls', |
107 | title: '女生首页', | 99 | title: '女生首页', |
108 | girlsHomePage: true | 100 | girlsHomePage: true |
109 | - }); | 101 | + }).catch(next); |
110 | }; | 102 | }; |
111 | 103 | ||
112 | /** | 104 | /** |
113 | * 潮童首页 | 105 | * 潮童首页 |
114 | */ | 106 | */ |
115 | 107 | ||
116 | -exports.kids = (req, res) => { | 108 | +exports.kids = (req, res, next) => { |
117 | channelPage(req, res, { | 109 | channelPage(req, res, { |
118 | gender: 'kids', | 110 | gender: 'kids', |
119 | title: '潮童首页', | 111 | title: '潮童首页', |
120 | kidsHomePage: true | 112 | kidsHomePage: true |
121 | - }); | 113 | + }).catch(next); |
122 | }; | 114 | }; |
123 | 115 | ||
124 | /** | 116 | /** |
125 | * 创意生活首页 | 117 | * 创意生活首页 |
126 | */ | 118 | */ |
127 | -exports.lifestyle = (req, res) => { | 119 | +exports.lifestyle = (req, res, next) => { |
128 | channelPage(req, res, { | 120 | channelPage(req, res, { |
129 | gender: 'lifestyle', | 121 | gender: 'lifestyle', |
130 | title: '创意生活首页', | 122 | title: '创意生活首页', |
131 | lifestyleHomePage: true | 123 | lifestyleHomePage: true |
132 | - }); | 124 | + }).catch(next); |
133 | }; | 125 | }; |
134 | 126 | ||
135 | /** | 127 | /** |
@@ -138,12 +130,10 @@ exports.lifestyle = (req, res) => { | @@ -138,12 +130,10 @@ exports.lifestyle = (req, res) => { | ||
138 | * @param {[object]} res | 130 | * @param {[object]} res |
139 | * @return {[type]} | 131 | * @return {[type]} |
140 | */ | 132 | */ |
141 | -exports.bottomBanner = (req, res) => { | 133 | +exports.bottomBanner = (req, res, next) => { |
142 | let gender = req.query.gender || 'boys'; | 134 | let gender = req.query.gender || 'boys'; |
143 | 135 | ||
144 | channelModel.getBottomBannerData(gender).then(result => { | 136 | channelModel.getBottomBannerData(gender).then(result => { |
145 | res.send(result); | 137 | res.send(result); |
146 | - }).catch((err) => { | ||
147 | - channelLogger(err, res); | ||
148 | - }); | 138 | + }).catch(next); |
149 | }; | 139 | }; |
-
Please register or login to post a comment