channel.js 578 Bytes
/**
 * 主页
 * @author: Bi Kai<kai.bi@yoho.cn>
 * @date: 2016/05/09
 */
'use strict';
const channelModel = require('../models/channel');

/**
 * 频道选择页
 */
module.exports = {
    index(req, res) {
        let channel = req.path.split('/')[1] || req.yoho.channel;

        res.render('index', {
            module: 'channel',
            page: 'home',
            channel: channel
        });
    },
    resources(req, res, next) {
        channelModel.getResourcesData(req.query).then(result => {
            return res.json(result);
        }).catch(next);
    }
};