Authored by 陈峰

Merge branch 'master' of http://git.yoho.cn/fe/yohobuywap-node

... ... @@ -526,6 +526,7 @@ const getBaseShopData = (params, shopInfo) => {
const getShopData = (req, shopId, uid, isApp) => {
let shopData = {};
let channel = req.yoho.channel;
let brandData = [];
return _getShopInfo(shopId, uid).then(shopInfoResult => {
... ... @@ -536,56 +537,73 @@ const getShopData = (req, shopId, uid, isApp) => {
};
}
return Promise.all([
_getShopDecorator(shopId),
searchModel.getFilterSearchData({
shop_id: shopId,
channel: channel
}),
_shopCouponsList(shopId, uid)
]).then((result) => {
shopData = {
decorator: result[0], // 店铺装修资源数据
shopInfo: shopInfoResult // 店铺信息
};
return _getShopDecorator(shopId).then(shopDeco => {
return shopDeco;
}).then(shopDeco => {
let brandBrowseData;
// 取店铺下的brand, id
_.forEach(shopDeco.list, floor => {
if (floor.resource_name === 'brandBrowse') {
brandBrowseData = JSON.parse(floor.resource_data);
_.forEach(brandBrowseData, brandBrowse => {
brandData.push(brandBrowse.id);
});
}
});
/* 获取一次分类和商品数据 */
let shopFilterSearchData = {
filter: [],
goods: []
};
return Promise.all([
searchModel.getFilterSearchData({
shop_id: shopId,
brand: brandData.join(','),
order: '0',
channel: channel
}),
_shopCouponsList(shopId, uid)
]).then((result) => {
shopData = {
decorator: shopDeco, // 店铺装修资源数据
shopInfo: shopInfoResult // 店铺信息
};
if (result[1]) {
shopFilterSearchData.filter = productProcess.processFilter(result[1].filter || []);
shopFilterSearchData.goods = productProcess.processProductList(result[1].product_list || [], {isApp: isApp});
}
/* 获取一次分类和商品数据 */
let shopFilterSearchData = {
filter: [],
goods: []
};
/* 店鋪優惠券 */
let shopCoupons = result[2] || [];
// 店铺分类
return _getShopCategory(shopId, channel).then(shopCategory => {
shopData = _.assign({
shopCategory: shopCategory
}, shopData);
// noinspection JSCheckFunctionSignatures
return Object.assign(
_formShopData(shopData, shopId, isApp),
shopFilterSearchData,
{
shopId: shopId,
uid: uid ? crypto.encryption('', uid + '') : '',
coverChannel: channel,
shopCoupons: shopCoupons,
shopCouponsOne: shopCoupons.length === 1
}
);
if (result[0]) {
shopFilterSearchData.filter = productProcess.processFilter(result[0].filter || []);
shopFilterSearchData.goods = productProcess.processProductList(result[0].product_list || [], {isApp: isApp});
}
/* 店铺优惠券 */
let shopCoupons = result[1] || [];
// 店铺分类
return _getShopCategory(shopId, channel).then(shopCategory => {
shopData = _.assign({
shopCategory: shopCategory
}, shopData);
// noinspection JSCheckFunctionSignatures
return Object.assign(
_formShopData(shopData, shopId, isApp),
shopFilterSearchData,
{
shopId: shopId,
uid: uid ? crypto.encryption('', uid + '') : '',
coverChannel: channel,
shopCoupons: shopCoupons,
shopCouponsOne: shopCoupons.length === 1
}
);
});
});
});
});
};
/**
... ...
... ... @@ -26,7 +26,8 @@ const cachePage = {
'/guang/author/index': 1 * MINUTE,
'/guang/tags/index': 1 * MINUTE,
'/guang/plustar': 1 * MINUTE,
'/guang/plustar/brandinfo': 1 * MINUTE,
// '/guang/plustar/brandinfo': 1 * MINUTE,
'/guang/star': 1 * MINUTE,
... ...
/**
* OneAPM agent configuration
*/
const commonConfig = require('./config/common');
exports.config = {
app_name: [commonConfig.appName],
license_key: 'BwEGA1dRDlQ6357HHQ1AD1xJVkbc9fNfWRtQUwhQG41c5QFWGFIDSQoHc0e8AgMaUlcUVw0=',
logging: {
level: 'info'
},
transaction_events: {
enabled: true
}
};
... ... @@ -39,7 +39,7 @@
"request-promise": "^3.0.0",
"serve-favicon": "^2.3.0",
"uuid": "^2.0.3",
"yoho-node-lib": "0.1.28",
"yoho-node-lib": "0.1.29",
"yoho-zookeeper": "^1.0.3"
},
"devDependencies": {
... ...
... ... @@ -101,7 +101,7 @@ var $listNav = $('#list-nav'),
end: false
},
newest: {
order: 1,
order: 0,
reload: true,
page: 0,
end: false
... ...