Authored by 郭成尧

searchProductBySkn-to-searchModel

... ... @@ -124,7 +124,7 @@ const _shop = (req, res, shopId) => {
/* 若店铺使用基础模板跳转基础模板 */
_baseShop(req, res, result.goBrand, shopId);
} else {
listModel.searchProductBySkn(result.hotListproductSkn).then(hotList => {
searchModel.searchProductBySkn(result.hotListproductSkn).then(hotList => {
result = _.assign(result, pageHeader, {
hotList: productProcess.processProductList(hotList, {isApp: isApp})
});
... ...
... ... @@ -5,7 +5,6 @@
'use strict';
const mRoot = '../models';
const utils = '../../../utils';
const listModel = require(`${mRoot}/list`);
const shopModel = require(`${mRoot}/shop`);
const searchModel = require(`${mRoot}/search`);
const redsShopModel = require(`${mRoot}/popular-shop`);
... ... @@ -91,7 +90,7 @@ const shop = {
let skns = req.query.skns;
let isApp = req.query.app_version || req.query.appVersion || false;
return listModel.searchProductBySkn(skns).then(hotList => {
return searchModel.searchProductBySkn(skns).then(hotList => {
hotList = productProcess.processProductList(hotList, {isApp: isApp});
_.forEach(hotList, (value, key) => {
hotList[key].tags = {};
... ... @@ -181,7 +180,7 @@ const shop = {
let decoratorsAll = redShopPrcs.floor(_.get(decoratorsData, 'data.modules', []));
let category = redShopPrcs.category(_.get(categoryData, 'data', []), shopId);
let goodsListBySkn = yield listModel.searchProductBySkn(decoratorsAll.skns);
let goodsListBySkn = yield searchModel.searchProductBySkn(decoratorsAll.skns);
let decorators = redShopPrcs.pushGoodsInfo(decoratorsAll.decorators, goodsListBySkn);
res.render('newshop/shop-reds', {
... ...
... ... @@ -303,21 +303,6 @@ const getShopBrands = (shopId) => {
});
};
/**
* 通过 skn 搜索商品
* @param productSkn
* @returns {*|Promise.<TResult>}
* @private
*/
const searchProductBySkn = (productSkn) => {
return api.get('', {
method: 'h5.product.batch',
productSkn: productSkn
}, {code: 200, cache: true}).then(result => {
return _.get(result, 'data.product_list', []);
});
};
/**
* 组织店铺页面数据
... ... @@ -903,7 +888,6 @@ module.exports = {
shopCouponsList,
brandCouponsList,
getShopFav,
searchProductBySkn,
getBrandFavStatus,
getShopDecorator: _getShopDecorator,
getShopCategoryApi: _getShopCategory,
... ...
... ... @@ -619,6 +619,21 @@ const getSearchKeywordDataById = (id, params, uid) => {
});
};
/**
* 通过 skn 搜索商品
* @param productSkn
* @returns {*|Promise.<TResult>}
* @private
*/
const searchProductBySkn = (productSkn) => {
return api.get('', {
method: 'h5.product.batch',
productSkn: productSkn
}, {code: 200, cache: true}).then(result => {
return _.get(result, 'data.product_list', []);
});
};
module.exports = {
getSearchData,
getFilterData,
... ... @@ -633,5 +648,6 @@ module.exports = {
getSearchKeywordDataById,
getSearchGoods,
getBrandGoods,
getShopGoods
getShopGoods,
searchProductBySkn
};
... ...