index.js 826 Bytes
/**
 * 个人中心 controller
 * @author: chengyao.guo<chengyao.guo@yoho.cn>
 * @date: 2016/08/10
 */

'use strict';

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

exports.index = (req, res, next) => {
    let params = {
        uid: req.user.uid
    };

    let headerData = headerModel.setNav({
        navTitle: '个人中心'
    });

    indexModel.index(params).then(result => {
        if (result) {
            res.render('index', Object.assign(result, {
                isLogin: params.uid ? true : false,
                module: 'home',
                page: 'index',
                title: 'Yoho!Buy 有货',
                pageHeader: headerData,
                pageFooter: true
            }));
        }
    }).catch(next);

};