...
|
...
|
@@ -5,18 +5,33 @@ |
|
|
'use strict';
|
|
|
|
|
|
const searchModel = require('../models/search');
|
|
|
const _ = require('lodash');
|
|
|
|
|
|
|
|
|
/* 搜索 页面 */
|
|
|
exports.index = (req, res, next) => {
|
|
|
const params = req.query;
|
|
|
|
|
|
params.page = 1;
|
|
|
params.limit = 4;
|
|
|
searchModel.products(params).then(result => {
|
|
|
let list = result && result.data ? result.data.product_list : [];
|
|
|
|
|
|
_.forEach(list, d => {
|
|
|
d.goodsList = d.goods_list;
|
|
|
d.productId = d.product_id;
|
|
|
d.goodsId = d.goods_id;
|
|
|
d.cnAlphabet = d.cn_alphabet;
|
|
|
|
|
|
_.forEach(d.goodsList, g => {
|
|
|
g.goodsId = g.goods_id;
|
|
|
});
|
|
|
});
|
|
|
res.render('product-list', {
|
|
|
navTitle: params.title || params.sort_name,
|
|
|
module: 'product',
|
|
|
page: 'list',
|
|
|
list: result && result.data ? result.data.productList : []
|
|
|
list: list
|
|
|
});
|
|
|
}).catch(next);
|
|
|
};
|
...
|
...
|
|