index.js 897 Bytes
/**
 * 逛列表页 controller
 * @author: jing.li@yoho.cn<jing.li@yoho.cn>
 * @date: 2016/09/05
 */

'use strict';

const headerModel = require('../../../doraemon/models/header'); // 头部model
const indexModel = require('../models/index');

/**
 * 逛列表页
 * @param req
 * @param res
 * @param next
 */

exports.index = (req, res, next) => {
    let headerData = headerModel.setNav({
        navTitle: '逛'
    });

    let responseData = {
        pageHeader: headerData,
        module: 'guang',
        page: 'index',
        title: '逛',
        pageFooter: true
    };

    let param = {
        uid: req.user.uid || 6228593,

        udid: req.user.udid,

        type: req.query.type || 0,

        gender: req.query.gender || '1,3'
    };

    indexModel.getArticle(param).then(result => {
        res.render('index', Object.assign(responseData, result));
    }).catch(next);
};