...
|
...
|
@@ -90,12 +90,12 @@ const getBrandViewTop = channel => { |
|
|
brandAds = [],
|
|
|
brandLogos = [];
|
|
|
|
|
|
if (res.code !== 200) {
|
|
|
if (res.data === 'false' || res.code !== 200 ) {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
// 头部10个品牌小图块 url
|
|
|
if (res.data[1].data && res.data[1].data.list) {
|
|
|
if (res.data && res.data instanceof Array && res.data[1].data && res.data[1].data.list) {
|
|
|
_.forEach(res.data[1].data.list, subValue => {
|
|
|
brandAds.push({
|
|
|
name: subValue.name,
|
...
|
...
|
@@ -106,7 +106,7 @@ const getBrandViewTop = channel => { |
|
|
}
|
|
|
|
|
|
// 头部品牌图块,广告位
|
|
|
if (res.data[0].data) {
|
|
|
if (res.data && res.data instanceof Array && res.data[0].data) {
|
|
|
_.forEach(res.data[0].data, (subValue, k) => {
|
|
|
let srcUrl;
|
|
|
|
...
|
...
|
@@ -151,8 +151,11 @@ const getBrandViewList = (channel, start, length) => { |
|
|
let result = [],
|
|
|
navigation = [];
|
|
|
|
|
|
if (res.data === 'false' || res.code !== 200) {
|
|
|
return result;
|
|
|
}
|
|
|
// 品牌list A-Z 0-9
|
|
|
if (res.data.brands) {
|
|
|
if (res.data && res.data.brands) {
|
|
|
|
|
|
_.forEach(res.data.brands, (subValue, key) => {
|
|
|
let listTmp = [];
|
...
|
...
|
@@ -193,9 +196,13 @@ const getBrandViewList = (channel, start, length) => { |
|
|
// 只取部分数据
|
|
|
let begin;
|
|
|
|
|
|
begin = (start - 1) ? (start - 1) : 0;
|
|
|
begin = (begin > 0) ? begin : 0;
|
|
|
result = length ? result.slice(begin, length + begin) : result.slice(begin);
|
|
|
|
|
|
if (start) {
|
|
|
begin = (start - 1) ? (start - 1) : 0;
|
|
|
begin = (begin > 0) ? begin : 0;
|
|
|
result = length ? result.slice(begin, length + begin) : result.slice(begin);
|
|
|
}
|
|
|
|
|
|
result.navigation = navigation;
|
|
|
|
|
|
return result;
|
...
|
...
|
@@ -217,11 +224,17 @@ const getBrandInfo = (brandId, uid) => { |
|
|
// 获取品牌简介
|
|
|
let res = yield brandApi.getBrandIntro(brandId, uid);
|
|
|
|
|
|
if (res.data === 'false' || res.code !== 200) {
|
|
|
return data;
|
|
|
}
|
|
|
if (res.data) {
|
|
|
// 获取品牌下的产品信息
|
|
|
let proInfo = yield brandApi.getProductByBrand(brandId, 3);
|
|
|
|
|
|
let proInfoTmp = proInfo.data.product_list;
|
|
|
if (proInfo.data === 'false' || proInfo.code !== 200) {
|
|
|
return data;
|
|
|
}
|
|
|
let proInfoTmp = proInfo.data.product_list ? proInfo.data.product_list : [];
|
|
|
|
|
|
if (!_.isEmpty(proInfoTmp)) {
|
|
|
_.forEach(proInfoTmp, subValue => {
|
...
|
...
|
@@ -253,12 +266,15 @@ const getBrandInfo = (brandId, uid) => { |
|
|
*/
|
|
|
const getBrandInfoByIds = (brandIds) => {
|
|
|
return co(function*() {
|
|
|
let data = yield brandApi.getBrandInfoByIds(brandIds);
|
|
|
let res = yield brandApi.getBrandInfoByIds(brandIds);
|
|
|
|
|
|
let brandsInfo = {};
|
|
|
|
|
|
if (data.data && data.code === 200) {
|
|
|
_.forEach(data.data, (subValue, k) => {
|
|
|
if (res.data === 'false' || res.code !== 200) {
|
|
|
return brandsInfo;
|
|
|
}
|
|
|
if (res.data && res.code === 200) {
|
|
|
_.forEach(res.data, (subValue, k) => {
|
|
|
subValue.desc = _.trim(subValue.brand_intro.replace('/[\r\n\t ]/g', ''));
|
|
|
subValue.url = subValue.brand_domain;
|
|
|
delete subValue.brand_intro;
|
...
|
...
|
@@ -286,6 +302,9 @@ const getPlusstarBrandListItem = (channel) => { |
|
|
|
|
|
let items = [];
|
|
|
|
|
|
if (resource.data === 'false' || resource.code !== 200) {
|
|
|
return items;
|
|
|
}
|
|
|
if (resource.data && resource.code === 200) {
|
|
|
items[0] = {name: '所有品牌', src: '', url: helpers.urlFormat('/brands', ''), brandType: ''};
|
|
|
items[1] = {name: '设计新潮', src: '', url: '', brandType: 4};
|
...
|
...
|
@@ -327,12 +346,15 @@ const getPlustarList = (brandType, gender) => { |
|
|
|
|
|
let brandList = {},
|
|
|
data = {},
|
|
|
brandsIds = [];
|
|
|
brandsIds = [],
|
|
|
result = {brandsIds: [], data: {}};
|
|
|
|
|
|
if (list.data.data.list) {
|
|
|
if (list.data === 'false' || list.code !== 200 ) {
|
|
|
return result;
|
|
|
}
|
|
|
if (list.data && list.data.data && list.data.data.list) {
|
|
|
brandList = list.data.data.list[0];
|
|
|
}
|
|
|
|
|
|
if (brandList.data) {
|
|
|
_.forEach(brandList.data, brand => {
|
|
|
let src = '';
|
...
|
...
|
@@ -350,9 +372,12 @@ const getPlustarList = (brandType, gender) => { |
|
|
};
|
|
|
brandsIds.push(brand.brand_id);
|
|
|
});
|
|
|
|
|
|
result.brandsIds = brandsIds;
|
|
|
result.data = data;
|
|
|
}
|
|
|
|
|
|
return {brandsIds: brandsIds, data: data};
|
|
|
return result;
|
|
|
})();
|
|
|
};
|
|
|
|
...
|
...
|
|