detail.js 739 Bytes
/**
 * 商品详情controller
 * @author: xuqi<qi.xu@yoho.cn>
 * @date: 2016/5/6
 */

'use strict';

const mRoot = '../models';

// 商品详情model
const detail = require(`${mRoot}/detail`);

exports.index = (req, res) => {
    var uid = null, // 需要修改为正式取 UID 的方式
        vipLevel = 0; // 用户等级

    detail({
        id: req.params.id,
        uid: uid,
        vipLevel: vipLevel,
        ua: req.get('user-agent') || ''
    }).then((result) => {
        res.render('detail', {
            resultShow: JSON.stringify(result, null, 4),
            result: result,
            devEnv: true,
            module: 'product',
            page: 'detail',
            title: result.goodsName
        });
    });
};