Authored by 郭成尧

Merge branch 'release/newSearch'

... ... @@ -19,7 +19,7 @@ router.get('/girls', channel.switchChannel, channel.girls);
router.get('/kids', channel.switchChannel, channel.kids);
router.get('/lifestyle', channel.switchChannel, channel.lifestyle);
router.get('/channel/bottomBanner', channel.bottomBanner);
router.get('/(:channel)/bottomBanner', channel.bottomBanner);
router.get('/cate', cate.index);
... ...
... ... @@ -192,7 +192,7 @@ const brand = (req, res, next) => {
return;
}
listModel.getBrandLogoByDomain(domain).then((result) => {
listModel.getBrandLogoByDomain(domain).then(result => {
brandLogo = result;
title = brandLogo.name;
... ... @@ -209,7 +209,7 @@ const brand = (req, res, next) => {
if (brandLogo.type === '2' && brandLogo.shopId) {
_shop(req, res, brandLogo.shopId);
} else { // 获取品牌店铺信息
listModel.getBrandShops(brandId).then((brandShop) => {
listModel.getBrandShops(brandId).then(brandShop => {
if (brandId === 0) {
params.query = domain;
}
... ... @@ -281,7 +281,7 @@ const shopIntro = (req, res, next) => {
let params = {};
if (shopId) {
listModel.getShopIntro(shopId).then((result) => {
listModel.getShopIntro(shopId).then(result => {
if (appVersion) {
params = {
title: '店铺简介'
... ... @@ -294,7 +294,10 @@ const shopIntro = (req, res, next) => {
};
}
res.render('shop/intro', _.assign(params, result));
res.render('shop/intro', _.assign(params, result, {
module: 'product',
page: 'intro'
}));
}).catch(next);
} else {
res.redirect('/?go=1');
... ... @@ -431,8 +434,6 @@ module.exports = {
brand,
favoriteBrand,
shopIntro,
// pagecache新增
brandFav,
shopAppCookie,
shopFav,
... ...
... ... @@ -7,7 +7,6 @@
const utils = '../../../utils';
const logger = global.yoho.logger;
const crypto = global.yoho.crypto;
const camelCase = global.yoho.camelCase;
const _ = require('lodash');
const helpers = global.yoho.helpers;
const api = global.yoho.API;
... ... @@ -27,16 +26,13 @@ const yhChannel = {
/* 多品牌店铺列表数据信息处理*/
const _processBrandShops = (list) => {
const formatDat = [];
let formatDat = [];
list = list || [];
list = camelCase(list);
_.forEach(list, (item) => {
if (item.shopId) {
_.forEach(list, item => {
if (item.shop_id) {
formatDat.push({
url: helpers.urlFormat('/product/index/brand/', {
shop_id: item.brandId
shop_id: item.shop_id
}),
thumb: helpers.image(item.brandIco, 75, 40),
name: item.brandName
... ... @@ -98,11 +94,7 @@ const _getShopDecorator = (shopId) => {
cache: true,
code: 200
}).then((result) => {
if (result.data) {
return camelCase(result.data);
} else {
return '';
}
return result.data;
});
};
... ... @@ -118,11 +110,7 @@ const _getShopInfo = (shopId, uid) => {
shop_id: shopId,
uid: uid || 0
}, {code: 200}).then((result) => {
if (result.data) {
return camelCase(result.data);
} else {
return {};
}
return result.data;
});
};
... ... @@ -139,11 +127,7 @@ const _getShopCategory = (shopId, channel, gender) => {
gender: gender || '1,3',
shop_id: shopId
}, {code: 200}).then(result => {
if (result && result.code === 200) {
return camelCase(result.data);
} else {
return {};
}
return result.data;
});
};
... ... @@ -212,11 +196,8 @@ const getShopBrands = (shopId) => {
method: 'app.shops.getShopsBrands',
shop_id: shopId
}, {code: 200}).then((result) => {
if (result && result.code === 200) {
result = camelCase(result.data);
return result[0].brandId;
} else {
return {};
if (result[0]) {
return result[0].brand_id;
}
});
};
... ... @@ -256,10 +237,10 @@ const _formShopData = (data, shopId, isApp) => {
if (data.decorator) {
_.forEach(data.decorator.list, floor => {
let resData = JSON.parse(floor.resourceData);
let resData = JSON.parse(floor.resource_data);
if (floor.resourceName) {
floor[_.camelCase(floor.resourceName)] = true;
if (floor.resource_name) {
floor[_.camelCase(floor.resource_name)] = true;
}
// 店铺banner
... ... @@ -382,10 +363,11 @@ const _formShopData = (data, shopId, isApp) => {
};
formatData = _.assign({
shopIntro: data.shopInfo.shopIntro,
logoImg: data.shopInfo.shopLogo,
storeName: (data.shopInfo.isShowShopName === 'Y') ? data.shopInfo.shopName : '',
collect: data.shopInfo.isFavorite === 'Y',
shopIntro: _.get(data, 'shopInfo.shop_intro', ''),
logoImg: _.get(data, 'shopInfo.shop_logo', ''),
storeName: (_.get(data, 'shopInfo.is_show_shop_name', '') === 'Y') ?
_.get(data, 'shopInfo.shop_name', '') : '',
collect: _.get(data, 'shopInfo.is_favorite', '') === 'Y',
url: helpers.urlFormat('', {
shop_id: shopId
}, 'search'), // 搜索链接
... ... @@ -434,14 +416,14 @@ const _formShopData = (data, shopId, isApp) => {
shop_id: shopId
});
} else {
_.forEach(data.shopCategory, (item) => {
_.forEach(data.shopCategory, item => {
shopCategory.list.push({
url: helpers.urlFormat('', {
shop_id: shopId,
sort: item.relationParameter.sort
sort: item.relation_parameter.sort
}, 'search'),
categoryId: item.categoryId,
name: item.categoryName
categoryId: item.category_id,
name: item.category_name
});
});
}
... ... @@ -477,8 +459,8 @@ const getBaseShopData = (params, shopInfo) => {
if (result[0] && _.has(result[0], 'list')) {
_.forEach(result[0].list, item => {
if (item.resourceName === 'shopTopBanner_base') {
let banner = JSON.parse(item.resourceData);
if (item.resource_name === 'shopTopBanner_base') {
let banner = JSON.parse(item.resource_data);
finalResult = _.assign(finalResult, {
baseShopHome: {
... ... @@ -521,7 +503,7 @@ const getShopData = (req, shopId, uid, isApp) => {
return _getShopInfo(shopId, uid).then(shopInfoResult => {
/* 基础店铺返回程序内的跳转信号,跳转到基础店铺 */
if (shopInfoResult.shopTemplateType && parseInt(shopInfoResult.shopTemplateType, 10) === 1) {
if (shopInfoResult.shop_template_type && parseInt(shopInfoResult.shop_template_type, 10) === 1) {
return {
goBrand: shopInfoResult
};
... ... @@ -556,7 +538,8 @@ const getShopData = (req, shopId, uid, isApp) => {
let shopCoupons = result[2] || [];
// 店铺分类
return _getShopCategory(shopId, channel).then((shopCategory) => {
return _getShopCategory(shopId, channel).then(shopCategory => {
shopData = _.assign({
shopCategory: shopCategory
}, shopData);
... ... @@ -597,31 +580,27 @@ const getShopFav = (req, shopId, uid) => {
* @return array banner数据
*/
const getBrandIntro = (brandId, uid) => {
let param = {};
param = {
uid: uid,
let param = {
uid: uid
};
return api.get('', _.assign({
method: 'app.brand.getBrandIntro',
brand_id: brandId
}, param), {
code: 200,
cache: true
}).then((result) => {
if (result && result.code === 200) {
let list = camelCase(result.data) || {};
}).then(result => {
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 : ''
};
return {
id: list.brandId,
intro: list.brandIntro,
collected: (list.isFavorite && list.isFavorite === 'Y') ? true : false,
title: list.brandName ? list.brandName : ''
};
} else {
logger.error('get brand introduction api return code is not 200');
return {};
}
});
};
... ... @@ -660,26 +639,22 @@ const getBrandLogoByDomain = (domain) => {
method: 'web.brand.byDomain',
domain: domain
}, {
code: 200,
cache: true
}).then((result) => {
if (result && result.code === 200) {
if (result.data) {
let formatData = camelCase(result.data);
return {
id: formatData.id,
url: helpers.urlFormat('', null, formatData.brandDomain),
thumb: helpers.image(formatData.brandIco, 75, 40),
name: formatData.brandName,
shopId: formatData.shopId ? formatData.shopId : 0, // 店铺id
type: formatData.type ? formatData.type : 0
};
} else {
return false;
}
}).then(result => {
if (result.data) {
let formatData = result.data;
return {
id: formatData.id,
url: helpers.urlFormat('', null, formatData.brandDomain),
thumb: helpers.image(formatData.brandIco, 75, 40),
name: formatData.brand_name,
shopId: formatData.shop_id ? formatData.shop_id : 0, // 店铺id
type: formatData.type ? formatData.type : 0
};
} else {
logger.error('get brand logo by domain api return code is not 200');
return {};
return false;
}
});
};
... ... @@ -694,12 +669,12 @@ const getBrandShops = (brandId) => {
method: 'app.shop.queryShopsByBrandId',
brand_id: brandId
}, {
code: 200,
cache: true
}).then((result) => {
if (result && result.code === 200) {
}).then(result => {
if (result.data) {
return _processBrandShops(result.data);
} else {
logger.error('get shop list by brandId api return code is not 200');
return {};
}
});
... ... @@ -748,13 +723,8 @@ const getShopIntro = (shopId) => {
return api.get('', {
method: 'app.shops.getIntro',
shop_id: shopId
}).then((result) => {
if (result && result.code === 200) {
return camelCase(result.data);
} else {
logger.error('get shop intro api return code is not 200');
return {};
}
}, {code: 200, cache: true}).then(result => {
return result.data;
});
};
... ... @@ -779,7 +749,7 @@ const getShopCategory = (params) => {
_.forEach(value.sub, (subValue, subKey) => {
value.sub[subKey].url = helpers.urlFormat('/product/search/list', {
shop_id: params.shopId,
sort: _.get(value, 'relationParameter.sort', ''),
sort: _.get(value, 'relation_parameter.sort', ''),
title: subValue.categoryName,
query: subValue.categoryName
});
... ...
<div class="shop-introduce-page">
<a class="banner">
<img src="{{image shopLogo 640 480}}">
<img src="{{image shop_logo 640 480}}">
</a>
<div class="descripition">
{{shopIntro}}
{{shop_intro}}
</div>
<p class="sign-icon">
... ...
... ... @@ -16,15 +16,15 @@ module.exports = {
siteUrl: '//m.yohobuy.com',
assetUrl: '//localhost:5001',
domains: {
api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
liveApi: 'http://api.live.yoho.cn/',
singleApi: 'http://single.yoho.cn/'
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/',
// api: 'http://api-test1.yohops.com:9999/',
// service: 'http://service-test1.yohops.com:9999/',
// liveApi: 'http://testapi.live.yohops.com:9999/',
// singleApi: 'http://api-test1.yohops.com:9999/'
api: 'http://api-test1.yohops.com:9999/',
service: 'http://service-test1.yohops.com:9999/',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test1.yohops.com:9999/',
},
subDomains: {
host: '.m.yohobuy.com',
... ...
... ... @@ -125,15 +125,16 @@ module.exports = function(specificGender) {
page: page + 1
},
success: function(data) {
// console.log(data)
var PRDID = [];
if (data === ' ') {
console.log(data);
if (data === ' ' || data === '') {
searching = false;
loading.hideLoadingMask();
// 有货币页面不加载底部
if (gender && !specificGender) {
gender = gender.substr(0, 3);
if (gender === '1,3') {
url = '/boys/bottomBanner';
} else {
... ...
/**
* Created by yoho on 2016/10/9.
*/
require('../common');
... ...