search.js
524 Bytes
/**
* 产品搜索 controller
* @author 陈轩 <xuan.chen@yoho.cn>
*/
'use strict';
const model = require('../models/search.js');
/* 搜索 页面 */
exports.index = (req, res) => {
const view = {
module: 'product',
page: 'search'
};
res.render('search', view);
};
/* 查询 产品列表 */
exports.fetchProducts = (req, res, next) => {
const params = req.query;
params.gender = '';
model.products(params)
.then(result => res.json(result))
.catch(next);
};