...
|
...
|
@@ -8,7 +8,6 @@ const library = '../../../library'; |
|
|
const _ = require('lodash');
|
|
|
const channelModel = require('../models/channel');
|
|
|
const helpers = require(`${library}/helpers`);
|
|
|
const log = require(`${library}/logger`);
|
|
|
|
|
|
const renderData = {
|
|
|
module: 'channel',
|
...
|
...
|
@@ -27,11 +26,6 @@ const renderData = { |
|
|
pageFooter: true
|
|
|
};
|
|
|
|
|
|
const channelLogger = (err, res) => {
|
|
|
log.error('频道页面渲染错误:' + JSON.stringify(err));
|
|
|
res.send('error');
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 频道页生成函数
|
|
|
* @param {[object]} req
|
...
|
...
|
@@ -45,15 +39,13 @@ const channelPage = (req, res, data) => { |
|
|
uid: _.toString(req.user.uid)
|
|
|
}).then(result => {
|
|
|
res.render('channel', Object.assign({}, renderData, data, result));
|
|
|
}).catch((err) => {
|
|
|
channelLogger(err, res);
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 频道选择页
|
|
|
*/
|
|
|
exports.index = (req, res) => {
|
|
|
exports.index = (req, res, next) => {
|
|
|
channelModel.getChannelSwitchData().then((result) => {
|
|
|
res.render('index', {
|
|
|
module: 'channel',
|
...
|
...
|
@@ -64,7 +56,7 @@ exports.index = (req, res) => { |
|
|
channelList: result[0],
|
|
|
background: result[1]
|
|
|
});
|
|
|
});
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -101,35 +93,35 @@ exports.boys = (req, res, next) => { |
|
|
/**
|
|
|
* 女生首页
|
|
|
*/
|
|
|
exports.girls = (req, res) => {
|
|
|
exports.girls = (req, res, next) => {
|
|
|
channelPage(req, res, {
|
|
|
gender: 'girls',
|
|
|
title: '女生首页',
|
|
|
girlsHomePage: true
|
|
|
});
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 潮童首页
|
|
|
*/
|
|
|
|
|
|
exports.kids = (req, res) => {
|
|
|
exports.kids = (req, res, next) => {
|
|
|
channelPage(req, res, {
|
|
|
gender: 'kids',
|
|
|
title: '潮童首页',
|
|
|
kidsHomePage: true
|
|
|
});
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 创意生活首页
|
|
|
*/
|
|
|
exports.lifestyle = (req, res) => {
|
|
|
exports.lifestyle = (req, res, next) => {
|
|
|
channelPage(req, res, {
|
|
|
gender: 'lifestyle',
|
|
|
title: '创意生活首页',
|
|
|
lifestyleHomePage: true
|
|
|
});
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -138,12 +130,10 @@ exports.lifestyle = (req, res) => { |
|
|
* @param {[object]} res
|
|
|
* @return {[type]}
|
|
|
*/
|
|
|
exports.bottomBanner = (req, res) => {
|
|
|
exports.bottomBanner = (req, res, next) => {
|
|
|
let gender = req.query.gender || 'boys';
|
|
|
|
|
|
channelModel.getBottomBannerData(gender).then(result => {
|
|
|
res.send(result);
|
|
|
}).catch((err) => {
|
|
|
channelLogger(err, res);
|
|
|
});
|
|
|
}).catch(next);
|
|
|
}; |
...
|
...
|
|