...
|
...
|
@@ -51,7 +51,11 @@ const _processBrandShops = (list) => { |
|
|
*/
|
|
|
const _modifyWapUrl = (origin, shopId) => {
|
|
|
if (parseInt(_.get(origin, 'linkType', 0), 10) === 1) {
|
|
|
return helpers.urlFormat('', {filter_poolId: origin.categoryId, shop_id: shopId, title: origin.categoryName}, 'search'); //eslint-disable-line
|
|
|
return helpers.urlFormat('', {
|
|
|
filter_poolId: origin.categoryId,
|
|
|
shop_id: shopId,
|
|
|
title: origin.categoryName
|
|
|
}, 'search'); //eslint-disable-line
|
|
|
} else {
|
|
|
if (_.has(origin, 'url')) {
|
|
|
return origin.url;
|
...
|
...
|
@@ -135,7 +139,71 @@ const _getShopCategory = (shopId, channel, gender) => { |
|
|
};
|
|
|
|
|
|
/**
|
|
|
* TODO TAR 店铺和品牌收藏状态调用新的接口
|
|
|
* 处理店铺或者品牌 seo 数据
|
|
|
* @param channel
|
|
|
* @param info
|
|
|
* @param qs
|
|
|
* @returns {{}}
|
|
|
* @private
|
|
|
*/
|
|
|
const _getBrandShopSeo = (channel, info, qs) => {
|
|
|
|
|
|
let resData = {},
|
|
|
ctype = {
|
|
|
boys: {fashionType: '男装', brandType: '男生品牌'},
|
|
|
girls: {fashionType: '女装', brandType: '女生品牌'},
|
|
|
kids: {fashionType: '童装', brandType: '潮童品牌'},
|
|
|
lifestyle: {fashionType: '创意生活', brandType: '创意生活品牌'}
|
|
|
};
|
|
|
let params = {
|
|
|
nameEn: '',
|
|
|
name: ''
|
|
|
};
|
|
|
|
|
|
|
|
|
if (info) {
|
|
|
Object.assign(params, {
|
|
|
nameEn: _.get(info, 'brand_name_en', ''),
|
|
|
nameCn: _.get(info, 'brand_name_cn', ''),
|
|
|
name: _.get(info, 'brand_name', '')
|
|
|
});
|
|
|
params.name = `${params.nameEn} ${params.nameCn} ${params.name}`;
|
|
|
if (info.shop_name) {
|
|
|
Object.assign(params, {
|
|
|
nameEn: info.shop_name,
|
|
|
name: info.shop_name
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (qs && qs.gender) {
|
|
|
if (qs.gender === '1,3') {
|
|
|
channel = 'boys';
|
|
|
} else if (qs.gender === '2,3') {
|
|
|
channel = 'girls';
|
|
|
}
|
|
|
|
|
|
Object.assign(params, ctype[channel] || ctype.boys);
|
|
|
Object.assign(resData, {
|
|
|
title: `${params.nameEn} | ${params.name} ${params.brandType}`,
|
|
|
keywords: `${params.nameEn}, ${params.name} ${params.fashionType},${params.nameEn} ${params.brandType}`,
|
|
|
description: `${params.nameEn}正品网购。${params.name}官方授权!`
|
|
|
});
|
|
|
} else {
|
|
|
Object.assign(resData, {
|
|
|
title: `${params.nameEn} | ${params.name}官网`,
|
|
|
keywords: `${params.nameEn}, ${params.name}官网`,
|
|
|
description: `${params.nameEn}正品网购。${params.name}官方授权!`
|
|
|
});
|
|
|
}
|
|
|
|
|
|
resData.title += resData.title ? ' | YOHO!有货 100%正品保证' : '';
|
|
|
resData.description += resData.description ? ' YOHO! 有货中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。' : ''; // eslint-disable-line
|
|
|
return resData;
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* 调用接口获取品牌或者店铺的收藏状态
|
|
|
* @private
|
|
|
*/
|
...
|
...
|
@@ -436,8 +504,11 @@ const _formShopData = (data, shopId, isApp) => { |
|
|
*/
|
|
|
const getBaseShopData = (params, shopInfo) => {
|
|
|
|
|
|
/* tar add 161109 seo-info */
|
|
|
let seoResult = _getBrandShopSeo(params.channel, shopInfo, params);
|
|
|
let finalResult = {
|
|
|
cartUrl: helpers.urlFormat('/cart/index/index')
|
|
|
cartUrl: helpers.urlFormat('/cart/index/index'),
|
|
|
seoResult: seoResult
|
|
|
};
|
|
|
|
|
|
let shopId = params.shop_id || shopInfo.shops_id;
|
...
|
...
|
@@ -490,6 +561,8 @@ const getShopData = (req, shopId, uid, isApp) => { |
|
|
|
|
|
return _getShopInfo(shopId, uid).then(shopInfoResult => {
|
|
|
|
|
|
let seoResult = _getBrandShopSeo(channel, shopInfoResult, req.query);
|
|
|
|
|
|
/* 基础店铺返回程序内的跳转信号,跳转到基础店铺 */
|
|
|
if (shopInfoResult && shopInfoResult.shop_template_type && parseInt(shopInfoResult.shop_template_type, 10) === 1) {
|
|
|
return {
|
...
|
...
|
@@ -515,7 +588,7 @@ const getShopData = (req, shopId, uid, isApp) => { |
|
|
return Promise.all([
|
|
|
searchModel.getFilterSearchData({
|
|
|
shop_id: shopId,
|
|
|
type: 'default',//默认
|
|
|
type: 'default', // 默认
|
|
|
brand: brandData.join(','),
|
|
|
order: '0',
|
|
|
channel: channel
|
...
|
...
|
@@ -551,7 +624,8 @@ const getShopData = (req, shopId, uid, isApp) => { |
|
|
{
|
|
|
shopId: shopId,
|
|
|
uid: uid ? crypto.encryption('', uid + '') : '',
|
|
|
coverChannel: channel
|
|
|
coverChannel: channel,
|
|
|
seoResult: seoResult
|
|
|
}
|
|
|
);
|
|
|
});
|
...
|
...
|
@@ -662,9 +736,10 @@ const getBrandLogoByDomain = (domain) => { |
|
|
/**
|
|
|
* 根据brandId 获取相关店铺列表
|
|
|
* @param brandId
|
|
|
* @param req
|
|
|
* @return array
|
|
|
*/
|
|
|
const getBrandShops = (brandId) => {
|
|
|
const getBrandShops = (brandId, req) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.shop.queryShopsByBrandId',
|
|
|
brand_id: brandId
|
...
|
...
|
@@ -673,7 +748,9 @@ const getBrandShops = (brandId) => { |
|
|
cache: true
|
|
|
}).then(result => {
|
|
|
if (_.isArray(result.data)) {
|
|
|
return _processBrandShops(result.data);
|
|
|
let seoResult = _getBrandShopSeo(req.channel, result.data[0], req.query);
|
|
|
|
|
|
return Object.assign(_processBrandShops(result.data), {seoResult: seoResult});
|
|
|
} else {
|
|
|
return [];
|
|
|
}
|
...
|
...
|
@@ -784,9 +861,8 @@ const getShopCategory = (params) => { |
|
|
|
|
|
/**
|
|
|
* 获取店铺优惠券列表
|
|
|
* @param {[int]} shop_id 店铺id
|
|
|
* @param {[int]} uid 当前用户id,空则不传
|
|
|
* @return {[array]}
|
|
|
* @param params
|
|
|
*/
|
|
|
const shopCouponsList = (params) => {
|
|
|
return api.get('', Object.assign({
|
...
|
...
|
|