...
|
...
|
@@ -6,7 +6,38 @@ |
|
|
*/
|
|
|
'use strict';
|
|
|
const api = global.yoho.API;
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const brandApi = require('./brand-api');
|
|
|
const logger = global.yoho.logger;
|
|
|
const _ = require('lodash');
|
|
|
|
|
|
/**
|
|
|
* 处理品牌一览品牌列表数据
|
|
|
* @param origin
|
|
|
* @returns {Array}
|
|
|
*/
|
|
|
const handleBrandList = origin => {
|
|
|
let dest = [];
|
|
|
|
|
|
_.forEach(origin, (value, key) => {
|
|
|
let brands = [];
|
|
|
|
|
|
_.forEach(value, (subValue) => {
|
|
|
brands.push({
|
|
|
name: subValue.brand_name,
|
|
|
link: helpers.urlFormat('', null, subValue.brand_domain),
|
|
|
logo: subValue.brand_ico
|
|
|
});
|
|
|
});
|
|
|
|
|
|
dest.push({
|
|
|
index: key,
|
|
|
brands: brands
|
|
|
});
|
|
|
});
|
|
|
|
|
|
return dest;
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取品牌店铺数据
|
...
|
...
|
@@ -53,70 +84,13 @@ const getBrandListData = params => { |
|
|
let finalResult = {};
|
|
|
|
|
|
return api.all([brandApi.getBrandListOriginData(params)]).then(result => {
|
|
|
Object.assign(finalResult, {
|
|
|
brandList: [
|
|
|
{
|
|
|
index: 'A',
|
|
|
brands: [
|
|
|
{
|
|
|
name: 'Yohji Yamamoto(eyes wear)',
|
|
|
link: '#',
|
|
|
logo: 'https://img11.static.yhbimg.com/brandLogo/2016/04/13/15/010eb8606c1072fd2e769c62567d3bbe93.png?imageView2/2/w/140/h/140'
|
|
|
},
|
|
|
{
|
|
|
name: 'TEEN TEAM',
|
|
|
link: '#',
|
|
|
logo: 'https://img12.static.yhbimg.com/brandLogo/2015/12/03/14/02d4dba71951e8e971dc85d2eab5fe7a7f.jpg?imageView2/2/w/140/h/140'
|
|
|
},
|
|
|
{
|
|
|
name: 'MYGESMART',
|
|
|
link: '#',
|
|
|
logo: 'https://img11.static.yhbimg.com/brandLogo/2014/01/27/11/01d9dbee4c83e9122bd1fc363ceb85e484.jpg?imageView2/2/w/140/h/140'
|
|
|
},
|
|
|
{
|
|
|
name: 'MYGESMART',
|
|
|
link: '#',
|
|
|
logo: 'https://img11.static.yhbimg.com/brandLogo/2014/01/27/11/01d9dbee4c83e9122bd1fc363ceb85e484.jpg?imageView2/2/w/140/h/140'
|
|
|
},
|
|
|
{
|
|
|
name: 'MYGESMART',
|
|
|
link: '#',
|
|
|
logo: 'https://img11.static.yhbimg.com/brandLogo/2014/01/27/11/01d9dbee4c83e9122bd1fc363ceb85e484.jpg?imageView2/2/w/140/h/140'
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
index: 'B',
|
|
|
brands: [
|
|
|
{
|
|
|
name: 'Yohji Yamamoto(eyes wear)',
|
|
|
link: '#',
|
|
|
logo: 'https://img11.static.yhbimg.com/brandLogo/2016/04/13/15/010eb8606c1072fd2e769c62567d3bbe93.png?imageView2/2/w/140/h/140'
|
|
|
},
|
|
|
{
|
|
|
name: 'TEEN TEAM',
|
|
|
link: '#',
|
|
|
logo: 'https://img12.static.yhbimg.com/brandLogo/2015/12/03/14/02d4dba71951e8e971dc85d2eab5fe7a7f.jpg?imageView2/2/w/140/h/140'
|
|
|
},
|
|
|
{
|
|
|
name: 'MYGESMART',
|
|
|
link: '#',
|
|
|
logo: 'https://img11.static.yhbimg.com/brandLogo/2014/01/27/11/01d9dbee4c83e9122bd1fc363ceb85e484.jpg?imageView2/2/w/140/h/140'
|
|
|
},
|
|
|
{
|
|
|
name: 'MYGESMART',
|
|
|
link: '#',
|
|
|
logo: 'https://img11.static.yhbimg.com/brandLogo/2014/01/27/11/01d9dbee4c83e9122bd1fc363ceb85e484.jpg?imageView2/2/w/140/h/140'
|
|
|
},
|
|
|
{
|
|
|
name: 'MYGESMART',
|
|
|
link: '#',
|
|
|
logo: 'https://img11.static.yhbimg.com/brandLogo/2014/01/27/11/01d9dbee4c83e9122bd1fc363ceb85e484.jpg?imageView2/2/w/140/h/140'
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
if (result[0].code === 200 && result[0].data.all_list) {
|
|
|
Object.assign(finalResult, {
|
|
|
brandList: handleBrandList(result[0].data.all_list)
|
|
|
});
|
|
|
} else {
|
|
|
logger.error('getBrandListOriginData api code no 200 or allList is null');
|
|
|
}
|
|
|
|
|
|
return finalResult;
|
|
|
});
|
...
|
...
|
|