Authored by 郭成尧

getBrandIntro-to-shopModel

... ... @@ -322,7 +322,7 @@ const brand = (req, res, next) => {
}, params);
} else if (brandId && brandId !== 0 &&
brandId !== '' && brandId !== 'undefined') { // 品牌一览过来的展示品牌介绍和LOGO
return Promise.all([listModel.getBrandIntro(brandId, uid), listModel.getBrandBanner(brandId)]).then((resData) => { //eslint-disable-line
return Promise.all([shopModel.getBrandIntro(brandId, uid), listModel.getBrandBanner(brandId)]).then((resData) => { //eslint-disable-line
title = resData[0].title;
delete resData[0].title;
... ...
... ... @@ -79,7 +79,7 @@ const shop = {
if (!brandId) {
return res.json({code: 404});
}
return listModel.getBrandIntro(brandId, uid).then(result => {
return shopModel.getBrandIntro(brandId, uid).then(result => {
res.json(result);
}).catch(next);
},
... ... @@ -124,7 +124,7 @@ const shop = {
co(function* () {
let [banner, brandInfo, goodsListApi] = yield Promise.all([
listModel.getBrandBanner(brandId),
listModel.getBrandIntro(brandId, uid),
shopModel.getBrandIntro(brandId, uid),
searchModel.getBrandGoods(searchParam)
]);
... ...
... ... @@ -700,40 +700,6 @@ const getShopFav = (req, shopId, uid) => {
});
};
/**
* 获取品牌信息数据
* @param {int} brandId 品牌ID
* @return array banner数据
*/
const getBrandIntro = (brandId, uid) => {
let param = {
uid: uid
};
if (!brandId || brandId === '' || brandId === 'undefined') {
return Promise.resolve({});
}
return api.get('', _.assign({
method: 'app.brand.getBrandIntro',
brand_id: brandId
}, param), {
code: 200
}).then(result => {
if (result && result.data) {
let list = result.data;
return {
id: list.brand_id,
intro: list.brand_intro,
collected: list.is_favorite && list.is_favorite === 'Y',
title: list.brand_name ? list.brand_name : ''
};
} else {
return false;
}
});
};
/**
* 获取品牌banner数据
... ... @@ -952,7 +918,6 @@ const brandCouponsList = (params) => {
module.exports = {
getBaseShopData,
getShopData,
getBrandIntro,
getBrandShops,
getBrandBanner,
setFavorite,
... ...
... ... @@ -88,8 +88,45 @@ const getBrandLogoByDomain = (domain) => {
});
};
/**
* 获取品牌信息数据
* @param {int} brandId 品牌ID
* @return array banner数据
*/
const getBrandIntro = (brandId, uid) => {
let param = {
uid: uid
};
if (!brandId || brandId === '' || brandId === 'undefined') {
return Promise.resolve({});
}
return api.get('', _.assign({
method: 'app.brand.getBrandIntro',
brand_id: brandId
}, param), {
code: 200
}).then(result => {
if (result && result.data) {
let list = result.data;
return {
id: list.brand_id,
intro: list.brand_intro,
collected: list.is_favorite && list.is_favorite === 'Y',
title: list.brand_name ? list.brand_name : ''
};
} else {
return false;
}
});
};
module.exports = {
getShopBrands,
getShopInfo,
getBrandLogoByDomain
getBrandLogoByDomain,
getBrandIntro
};
... ...