global.js 1.08 KB
/**
 * 商品促销controller
 * @author: yyq<yanqing.yang@yoho.cn>
 * @date: 2017/4/6
 */

'use strict';

const mRoot = '../models';
const globalModel = require(`${mRoot}/global`); // global model

/**
 * 全球购列表页
 * @param  {[type]} req [description]
 * @param  {[type]} res [description]
 * @return {[type]}     [description]
 */
exports.list = (req, res, next) => {
    req.ctx(globalModel).getGlobalProductListData(req.query, req.yoho).then(result => {
        res.render('list/index', Object.assign({
            page: 'list',
            pageClass: 'global-list-page static-list-page'
        }, result));
    }).catch(next);
};

/**
 * 全球购商品详情页
 * @param  {[type]} req [description]
 * @param  {[type]} res [description]
 * @return {[type]}     [description]
 */
exports.detail = (req, res, next) => {
    req.ctx(globalModel).getGlobalProductDetailData(req.params[0], req.yoho.channelNum,
        req.yoho.channel).then(result => {
            res.render('global/detail', Object.assign({
                page: 'detail'
            }, result));
        }).catch(next);
};