Blame view

apps/product/controllers/global.js 1.06 KB
yyq authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/**
 * 商品促销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) => {
htoooth authored
19
    req.ctx(globalModel).getGlobalProductListData(req.query, req.yoho).then(result => {
yyq authored
20
        res.render('list/index', Object.assign({
yyq authored
21 22
            page: 'list',
            pageClass: 'global-list-page'
yyq authored
23 24 25 26 27 28 29 30 31 32
        }, result));
    }).catch(next);
};

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