consult.js
727 Bytes
/**
* 个人中心---我的咨询
* @author chenxuan <xuan.chen@yoho.cn>
*/
'use strict';
const cookie = global.yoho.cookie;
const logger = global.yoho.logger;
const consultModel = require('../models/consult');
exports.index = (req, res, next) => {
const uid = cookie.getUid(req);
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);
});
};