cart.js 609 Bytes
/**
 * Created by TaoHuang on 2016/10/19.
 */

'use strict';

const service = require('../models/cart-service');

const getProductInfo = (req, res, next) => {
    let pid = req.query.productId || '';

    service.getProductInfoAsync(pid).then((result) => {
        return res.render('goods-detail', Object.assign({
            layout: false
        }, result));
    }).catch(next);
};

// 获取优惠券列表
const getCoupons = (req, res, next) => {
    service.getCoupons(req.user.uid).then(data => {
        res.send(data);
    }).catch(next);
};

module.exports = {
    getProductInfo,
    getCoupons
};