product-list.js 527 Bytes
/**
 *  产品列表页 controller
 * @author 陈轩 <xuan.chen@yoho.cn>
 */
'use strict';

const searchModel = require('../models/search');


/* 搜索 页面 */
exports.index = (req, res) => {
    const view = {
        module: 'product',
        page: 'list'
    };

    res.render('product-list', view);
};

/* 查询 产品列表 method:GET */
exports.fetchProducts = (req, res, next) => {
    const params = req.query;

    searchModel.products(params)
        .then(result => res.json(result))
        .catch(next);
};