index.js 656 Bytes
/**
 * 频道页controller
 * @author: 赵彪
 * @date: 2016/07/13
 */

'use strict';

const model = require('../models');
const config = global.yoho.config;

exports.index = (req, res, next) => {
    const channelType = req.path.substring(1) || 'men';

    model.getContent(channelType).then(result => {

        // 设置当前频道
        res.cookie('_Channel', channelType, {
            domain: config.cookieDomain
        });

        req.yoho.channel = channelType;

        res.display('index', Object.assign({
            module: 'channel',
            page: 'home',
            dataPage: channelType
        }, result));
    }).catch(next);
};