consult.js 686 Bytes
/**
 * 个人中心---我的咨询
 * @author chenxuan <xuan.chen@yoho.cn>
 */
'use strict';

const logger = global.yoho.logger;
const consultModel = require('../models/consult');


exports.index = (req, res, next) => {
    const uid = req.user.uid;
    const page = req.query.page || 1;

    consultModel.consultList(uid, page /* ,limit=10*/)
        .then(result => {
            let renderData = Object.assign({
                module: 'home',
                page: 'consult'
            }, result);

            res.render('consult', renderData);
        })
        .catch(err => {
            logger.error(`${module} ${page} error: ${err}`);
            next(err);
        });

};