Authored by 姜枫

handle merge

/**
* 品牌
* @author: zxr<xiaoru.zhang@yoho.cn>
* @date: 2016/7/8
*/
/**
* 品牌一览
* @author: zxr
* @date: 2016/07/13
... ... @@ -19,8 +13,17 @@ const brand = require('../models/brand');
* @param res
*/
const index = (req, res, next) => {
let channel = req.query.brand || 1;
let contentCode = 'd0149783b8dd2adaf083fd10556c39a9';
let channel = req.cookies._Channel || 'men';
let contentCode = '';
if(channel === 'women') {
contentCode = '527079e6c46d0f125eb46b835968971b';
} else if (channel === 'lifestyle'){
contentCode = '94b5ed607b6d565ffc29c2c04be121dc';
} else {
contentCode = '81886aaa5e82e3741bc1ba1e04ec7706';
}
let appType = 1;
brand.getListData(contentCode, channel, appType).then((result) => {
... ...
... ... @@ -24,25 +24,31 @@ const _processListData = (list) => {
list = list || [];
list = camelCase(list);
let listKey = [];
_.forEach(list.data.allList, function(value, index) {
_.forEach(value, function(data) {
data.brandDomain = `${config.siteUrl}/product/shop/${data.brandDomain}`;
});
if (index === '0~9') {
index = '0-9';
} else {
listKey.push(index)
}
listData.push(
{
key: index,
brands: value
}
);
});
console.log(listData)
listKey.sort();
listKey.push('0-9');
_.forEach(listKey, function(key) {
listData.push({
key: key,
brands: list.data.allList[key]
});
});
return listData;
};
... ... @@ -59,11 +65,11 @@ const _processTabData = (list) => {
_.forEach(list, function(value, index) {
if (index === 0) {
if (index === 1) {
_.forEach(value.data, function(data) {
tabData.push(
{
url: data.url,
url: `${config.siteUrl}/product/list`,
name: data.title,
src: data.src
}
... ...
... ... @@ -210,10 +210,10 @@ const _processFloorData = d => {
floorData = floorMap.slider(data.data);
// 判断标题类型
} else if (_isObjectTitle(data.data.title)) {
} else if (_isObjectTitle(data.data.title) && floorMap[floorTitle]) {
floorTitle = _getKey(data.data.title.title);
floorData = floorMap[floorTitle](data.data.list);
} else {
} else if (floorMap[floorTitle]) {
floorTitle = _getKey(data.data.title);
floorData = floorMap[floorTitle](data.data.list);
}
... ...
... ... @@ -260,12 +260,15 @@ const _processHeadData = (list) => {
};
// 推荐商品
const _getRelatedData = (sknList) => {
// console.log(id);
/**
* 推荐商品
* @param id
* @returns {*}
*/
const _getRelatedData = () => {
// console.log(idList);
return api.get('', {
// query: '51152761,51178582,51146105,51149561,51149414,51082157,51079256,',
qurey: sknList,
qurey: '51162882',
method: 'app.search.li'
}).then((result) => {
let productList = [];
... ... @@ -273,15 +276,16 @@ const _getRelatedData = (sknList) => {
if (result && result.code === 200) {
_.forEach(result.data.product_list, function(data) {
productList.push({
name: data.product_name,
price: data.sales_price,
id: data.product_id,
cnAlphabet: data.cn_alphabet
});
console.log(data.product_name)
// productList.push({
// name: data.product_name,
// price: data.sales_price,
// id: data.product_id,
// cnAlphabet: data.cn_alphabet
// });
});
// console.log(productList)
console.log(productList)
return productList;
} else {
logger.error('推荐商品 cood 不是 200');
... ... @@ -320,7 +324,7 @@ const _processContentData = (list) => {
contentData.contents = list;
// let idList = '';
let idList = '';
let sknList = '';
let formatData = [];
... ... @@ -330,11 +334,12 @@ const _processContentData = (list) => {
_.forEach(value.goods.data, function(data) {
// idList += data.id + ',';
idList += data.id + ',';
// idList = '51152761';
formatData.push(data);
});
}
//console.log(idList)
if (value.goodsGroup) {
... ... @@ -349,8 +354,10 @@ const _processContentData = (list) => {
// });
}
});
// console.log(idList)
_getRelatedData(sknList).then((result) => {
_getRelatedData().then((result) => {
//console.log(result)
_.forEach(formatData, function(data, index) {
// console.log(formatData)
... ...
... ... @@ -42,7 +42,7 @@
</div>
{{/ text}}
{{!-- {{# goods}}
{{# goods}}
<div class="related-reco">
<div class="article-title">
<div class="title-line"></div>
... ... @@ -61,7 +61,7 @@
</div>
{{/ goods}}
{{# goodsGroup}}
{{!-- {{# goodsGroup}}
<div class="related-reco">
<div class="article-title">
<div class="title-line"></div>
... ...