Authored by 郭成尧

Merge branch 'release/newSearch'

@@ -19,7 +19,7 @@ router.get('/girls', channel.switchChannel, channel.girls); @@ -19,7 +19,7 @@ router.get('/girls', channel.switchChannel, channel.girls);
19 router.get('/kids', channel.switchChannel, channel.kids); 19 router.get('/kids', channel.switchChannel, channel.kids);
20 router.get('/lifestyle', channel.switchChannel, channel.lifestyle); 20 router.get('/lifestyle', channel.switchChannel, channel.lifestyle);
21 21
22 -router.get('/channel/bottomBanner', channel.bottomBanner); 22 +router.get('/(:channel)/bottomBanner', channel.bottomBanner);
23 23
24 router.get('/cate', cate.index); 24 router.get('/cate', cate.index);
25 25
@@ -192,7 +192,7 @@ const brand = (req, res, next) => { @@ -192,7 +192,7 @@ const brand = (req, res, next) => {
192 return; 192 return;
193 } 193 }
194 194
195 - listModel.getBrandLogoByDomain(domain).then((result) => { 195 + listModel.getBrandLogoByDomain(domain).then(result => {
196 brandLogo = result; 196 brandLogo = result;
197 197
198 title = brandLogo.name; 198 title = brandLogo.name;
@@ -209,7 +209,7 @@ const brand = (req, res, next) => { @@ -209,7 +209,7 @@ const brand = (req, res, next) => {
209 if (brandLogo.type === '2' && brandLogo.shopId) { 209 if (brandLogo.type === '2' && brandLogo.shopId) {
210 _shop(req, res, brandLogo.shopId); 210 _shop(req, res, brandLogo.shopId);
211 } else { // 获取品牌店铺信息 211 } else { // 获取品牌店铺信息
212 - listModel.getBrandShops(brandId).then((brandShop) => { 212 + listModel.getBrandShops(brandId).then(brandShop => {
213 if (brandId === 0) { 213 if (brandId === 0) {
214 params.query = domain; 214 params.query = domain;
215 } 215 }
@@ -281,7 +281,7 @@ const shopIntro = (req, res, next) => { @@ -281,7 +281,7 @@ const shopIntro = (req, res, next) => {
281 let params = {}; 281 let params = {};
282 282
283 if (shopId) { 283 if (shopId) {
284 - listModel.getShopIntro(shopId).then((result) => { 284 + listModel.getShopIntro(shopId).then(result => {
285 if (appVersion) { 285 if (appVersion) {
286 params = { 286 params = {
287 title: '店铺简介' 287 title: '店铺简介'
@@ -294,7 +294,10 @@ const shopIntro = (req, res, next) => { @@ -294,7 +294,10 @@ const shopIntro = (req, res, next) => {
294 }; 294 };
295 } 295 }
296 296
297 - res.render('shop/intro', _.assign(params, result)); 297 + res.render('shop/intro', _.assign(params, result, {
  298 + module: 'product',
  299 + page: 'intro'
  300 + }));
298 }).catch(next); 301 }).catch(next);
299 } else { 302 } else {
300 res.redirect('/?go=1'); 303 res.redirect('/?go=1');
@@ -431,8 +434,6 @@ module.exports = { @@ -431,8 +434,6 @@ module.exports = {
431 brand, 434 brand,
432 favoriteBrand, 435 favoriteBrand,
433 shopIntro, 436 shopIntro,
434 -  
435 - // pagecache新增  
436 brandFav, 437 brandFav,
437 shopAppCookie, 438 shopAppCookie,
438 shopFav, 439 shopFav,
@@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
7 const utils = '../../../utils'; 7 const utils = '../../../utils';
8 const logger = global.yoho.logger; 8 const logger = global.yoho.logger;
9 const crypto = global.yoho.crypto; 9 const crypto = global.yoho.crypto;
10 -const camelCase = global.yoho.camelCase;  
11 const _ = require('lodash'); 10 const _ = require('lodash');
12 const helpers = global.yoho.helpers; 11 const helpers = global.yoho.helpers;
13 const api = global.yoho.API; 12 const api = global.yoho.API;
@@ -27,16 +26,13 @@ const yhChannel = { @@ -27,16 +26,13 @@ const yhChannel = {
27 26
28 /* 多品牌店铺列表数据信息处理*/ 27 /* 多品牌店铺列表数据信息处理*/
29 const _processBrandShops = (list) => { 28 const _processBrandShops = (list) => {
30 - const formatDat = []; 29 + let formatDat = [];
31 30
32 - list = list || [];  
33 - list = camelCase(list);  
34 -  
35 - _.forEach(list, (item) => {  
36 - if (item.shopId) { 31 + _.forEach(list, item => {
  32 + if (item.shop_id) {
37 formatDat.push({ 33 formatDat.push({
38 url: helpers.urlFormat('/product/index/brand/', { 34 url: helpers.urlFormat('/product/index/brand/', {
39 - shop_id: item.brandId 35 + shop_id: item.shop_id
40 }), 36 }),
41 thumb: helpers.image(item.brandIco, 75, 40), 37 thumb: helpers.image(item.brandIco, 75, 40),
42 name: item.brandName 38 name: item.brandName
@@ -98,11 +94,7 @@ const _getShopDecorator = (shopId) => { @@ -98,11 +94,7 @@ const _getShopDecorator = (shopId) => {
98 cache: true, 94 cache: true,
99 code: 200 95 code: 200
100 }).then((result) => { 96 }).then((result) => {
101 - if (result.data) {  
102 - return camelCase(result.data);  
103 - } else {  
104 - return '';  
105 - } 97 + return result.data;
106 }); 98 });
107 }; 99 };
108 100
@@ -118,11 +110,7 @@ const _getShopInfo = (shopId, uid) => { @@ -118,11 +110,7 @@ const _getShopInfo = (shopId, uid) => {
118 shop_id: shopId, 110 shop_id: shopId,
119 uid: uid || 0 111 uid: uid || 0
120 }, {code: 200}).then((result) => { 112 }, {code: 200}).then((result) => {
121 - if (result.data) {  
122 - return camelCase(result.data);  
123 - } else {  
124 - return {};  
125 - } 113 + return result.data;
126 }); 114 });
127 }; 115 };
128 116
@@ -139,11 +127,7 @@ const _getShopCategory = (shopId, channel, gender) => { @@ -139,11 +127,7 @@ const _getShopCategory = (shopId, channel, gender) => {
139 gender: gender || '1,3', 127 gender: gender || '1,3',
140 shop_id: shopId 128 shop_id: shopId
141 }, {code: 200}).then(result => { 129 }, {code: 200}).then(result => {
142 - if (result && result.code === 200) {  
143 - return camelCase(result.data);  
144 - } else {  
145 - return {};  
146 - } 130 + return result.data;
147 }); 131 });
148 }; 132 };
149 133
@@ -212,11 +196,8 @@ const getShopBrands = (shopId) => { @@ -212,11 +196,8 @@ const getShopBrands = (shopId) => {
212 method: 'app.shops.getShopsBrands', 196 method: 'app.shops.getShopsBrands',
213 shop_id: shopId 197 shop_id: shopId
214 }, {code: 200}).then((result) => { 198 }, {code: 200}).then((result) => {
215 - if (result && result.code === 200) {  
216 - result = camelCase(result.data);  
217 - return result[0].brandId;  
218 - } else {  
219 - return {}; 199 + if (result[0]) {
  200 + return result[0].brand_id;
220 } 201 }
221 }); 202 });
222 }; 203 };
@@ -256,10 +237,10 @@ const _formShopData = (data, shopId, isApp) => { @@ -256,10 +237,10 @@ const _formShopData = (data, shopId, isApp) => {
256 if (data.decorator) { 237 if (data.decorator) {
257 238
258 _.forEach(data.decorator.list, floor => { 239 _.forEach(data.decorator.list, floor => {
259 - let resData = JSON.parse(floor.resourceData); 240 + let resData = JSON.parse(floor.resource_data);
260 241
261 - if (floor.resourceName) {  
262 - floor[_.camelCase(floor.resourceName)] = true; 242 + if (floor.resource_name) {
  243 + floor[_.camelCase(floor.resource_name)] = true;
263 } 244 }
264 245
265 // 店铺banner 246 // 店铺banner
@@ -382,10 +363,11 @@ const _formShopData = (data, shopId, isApp) => { @@ -382,10 +363,11 @@ const _formShopData = (data, shopId, isApp) => {
382 }; 363 };
383 364
384 formatData = _.assign({ 365 formatData = _.assign({
385 - shopIntro: data.shopInfo.shopIntro,  
386 - logoImg: data.shopInfo.shopLogo,  
387 - storeName: (data.shopInfo.isShowShopName === 'Y') ? data.shopInfo.shopName : '',  
388 - collect: data.shopInfo.isFavorite === 'Y', 366 + shopIntro: _.get(data, 'shopInfo.shop_intro', ''),
  367 + logoImg: _.get(data, 'shopInfo.shop_logo', ''),
  368 + storeName: (_.get(data, 'shopInfo.is_show_shop_name', '') === 'Y') ?
  369 + _.get(data, 'shopInfo.shop_name', '') : '',
  370 + collect: _.get(data, 'shopInfo.is_favorite', '') === 'Y',
389 url: helpers.urlFormat('', { 371 url: helpers.urlFormat('', {
390 shop_id: shopId 372 shop_id: shopId
391 }, 'search'), // 搜索链接 373 }, 'search'), // 搜索链接
@@ -434,14 +416,14 @@ const _formShopData = (data, shopId, isApp) => { @@ -434,14 +416,14 @@ const _formShopData = (data, shopId, isApp) => {
434 shop_id: shopId 416 shop_id: shopId
435 }); 417 });
436 } else { 418 } else {
437 - _.forEach(data.shopCategory, (item) => { 419 + _.forEach(data.shopCategory, item => {
438 shopCategory.list.push({ 420 shopCategory.list.push({
439 url: helpers.urlFormat('', { 421 url: helpers.urlFormat('', {
440 shop_id: shopId, 422 shop_id: shopId,
441 - sort: item.relationParameter.sort 423 + sort: item.relation_parameter.sort
442 }, 'search'), 424 }, 'search'),
443 - categoryId: item.categoryId,  
444 - name: item.categoryName 425 + categoryId: item.category_id,
  426 + name: item.category_name
445 }); 427 });
446 }); 428 });
447 } 429 }
@@ -477,8 +459,8 @@ const getBaseShopData = (params, shopInfo) => { @@ -477,8 +459,8 @@ const getBaseShopData = (params, shopInfo) => {
477 459
478 if (result[0] && _.has(result[0], 'list')) { 460 if (result[0] && _.has(result[0], 'list')) {
479 _.forEach(result[0].list, item => { 461 _.forEach(result[0].list, item => {
480 - if (item.resourceName === 'shopTopBanner_base') {  
481 - let banner = JSON.parse(item.resourceData); 462 + if (item.resource_name === 'shopTopBanner_base') {
  463 + let banner = JSON.parse(item.resource_data);
482 464
483 finalResult = _.assign(finalResult, { 465 finalResult = _.assign(finalResult, {
484 baseShopHome: { 466 baseShopHome: {
@@ -521,7 +503,7 @@ const getShopData = (req, shopId, uid, isApp) => { @@ -521,7 +503,7 @@ const getShopData = (req, shopId, uid, isApp) => {
521 return _getShopInfo(shopId, uid).then(shopInfoResult => { 503 return _getShopInfo(shopId, uid).then(shopInfoResult => {
522 504
523 /* 基础店铺返回程序内的跳转信号,跳转到基础店铺 */ 505 /* 基础店铺返回程序内的跳转信号,跳转到基础店铺 */
524 - if (shopInfoResult.shopTemplateType && parseInt(shopInfoResult.shopTemplateType, 10) === 1) { 506 + if (shopInfoResult.shop_template_type && parseInt(shopInfoResult.shop_template_type, 10) === 1) {
525 return { 507 return {
526 goBrand: shopInfoResult 508 goBrand: shopInfoResult
527 }; 509 };
@@ -556,7 +538,8 @@ const getShopData = (req, shopId, uid, isApp) => { @@ -556,7 +538,8 @@ const getShopData = (req, shopId, uid, isApp) => {
556 let shopCoupons = result[2] || []; 538 let shopCoupons = result[2] || [];
557 539
558 // 店铺分类 540 // 店铺分类
559 - return _getShopCategory(shopId, channel).then((shopCategory) => { 541 + return _getShopCategory(shopId, channel).then(shopCategory => {
  542 +
560 shopData = _.assign({ 543 shopData = _.assign({
561 shopCategory: shopCategory 544 shopCategory: shopCategory
562 }, shopData); 545 }, shopData);
@@ -597,31 +580,27 @@ const getShopFav = (req, shopId, uid) => { @@ -597,31 +580,27 @@ const getShopFav = (req, shopId, uid) => {
597 * @return array banner数据 580 * @return array banner数据
598 */ 581 */
599 const getBrandIntro = (brandId, uid) => { 582 const getBrandIntro = (brandId, uid) => {
600 - let param = {};  
601 -  
602 - param = {  
603 - uid: uid, 583 + let param = {
  584 + uid: uid
604 }; 585 };
605 586
606 return api.get('', _.assign({ 587 return api.get('', _.assign({
607 method: 'app.brand.getBrandIntro', 588 method: 'app.brand.getBrandIntro',
608 brand_id: brandId 589 brand_id: brandId
609 }, param), { 590 }, param), {
  591 + code: 200,
610 cache: true 592 cache: true
611 - }).then((result) => {  
612 - if (result && result.code === 200) {  
613 - let list = camelCase(result.data) || {}; 593 + }).then(result => {
  594 +
  595 + let list = result.data;
  596 +
  597 + return {
  598 + id: list.brand_id,
  599 + intro: list.brand_intro,
  600 + collected: list.is_favorite && list.is_favorite === 'Y',
  601 + title: list.brand_name ? list.brand_name : ''
  602 + };
614 603
615 - return {  
616 - id: list.brandId,  
617 - intro: list.brandIntro,  
618 - collected: (list.isFavorite && list.isFavorite === 'Y') ? true : false,  
619 - title: list.brandName ? list.brandName : ''  
620 - };  
621 - } else {  
622 - logger.error('get brand introduction api return code is not 200');  
623 - return {};  
624 - }  
625 }); 604 });
626 }; 605 };
627 606
@@ -660,26 +639,22 @@ const getBrandLogoByDomain = (domain) => { @@ -660,26 +639,22 @@ const getBrandLogoByDomain = (domain) => {
660 method: 'web.brand.byDomain', 639 method: 'web.brand.byDomain',
661 domain: domain 640 domain: domain
662 }, { 641 }, {
  642 + code: 200,
663 cache: true 643 cache: true
664 - }).then((result) => {  
665 - if (result && result.code === 200) {  
666 - if (result.data) {  
667 - let formatData = camelCase(result.data);  
668 -  
669 - return {  
670 - id: formatData.id,  
671 - url: helpers.urlFormat('', null, formatData.brandDomain),  
672 - thumb: helpers.image(formatData.brandIco, 75, 40),  
673 - name: formatData.brandName,  
674 - shopId: formatData.shopId ? formatData.shopId : 0, // 店铺id  
675 - type: formatData.type ? formatData.type : 0  
676 - };  
677 - } else {  
678 - return false;  
679 - } 644 + }).then(result => {
  645 + if (result.data) {
  646 + let formatData = result.data;
  647 +
  648 + return {
  649 + id: formatData.id,
  650 + url: helpers.urlFormat('', null, formatData.brandDomain),
  651 + thumb: helpers.image(formatData.brandIco, 75, 40),
  652 + name: formatData.brand_name,
  653 + shopId: formatData.shop_id ? formatData.shop_id : 0, // 店铺id
  654 + type: formatData.type ? formatData.type : 0
  655 + };
680 } else { 656 } else {
681 - logger.error('get brand logo by domain api return code is not 200');  
682 - return {}; 657 + return false;
683 } 658 }
684 }); 659 });
685 }; 660 };
@@ -694,12 +669,12 @@ const getBrandShops = (brandId) => { @@ -694,12 +669,12 @@ const getBrandShops = (brandId) => {
694 method: 'app.shop.queryShopsByBrandId', 669 method: 'app.shop.queryShopsByBrandId',
695 brand_id: brandId 670 brand_id: brandId
696 }, { 671 }, {
  672 + code: 200,
697 cache: true 673 cache: true
698 - }).then((result) => {  
699 - if (result && result.code === 200) { 674 + }).then(result => {
  675 + if (result.data) {
700 return _processBrandShops(result.data); 676 return _processBrandShops(result.data);
701 } else { 677 } else {
702 - logger.error('get shop list by brandId api return code is not 200');  
703 return {}; 678 return {};
704 } 679 }
705 }); 680 });
@@ -748,13 +723,8 @@ const getShopIntro = (shopId) => { @@ -748,13 +723,8 @@ const getShopIntro = (shopId) => {
748 return api.get('', { 723 return api.get('', {
749 method: 'app.shops.getIntro', 724 method: 'app.shops.getIntro',
750 shop_id: shopId 725 shop_id: shopId
751 - }).then((result) => {  
752 - if (result && result.code === 200) {  
753 - return camelCase(result.data);  
754 - } else {  
755 - logger.error('get shop intro api return code is not 200');  
756 - return {};  
757 - } 726 + }, {code: 200, cache: true}).then(result => {
  727 + return result.data;
758 }); 728 });
759 }; 729 };
760 730
@@ -779,7 +749,7 @@ const getShopCategory = (params) => { @@ -779,7 +749,7 @@ const getShopCategory = (params) => {
779 _.forEach(value.sub, (subValue, subKey) => { 749 _.forEach(value.sub, (subValue, subKey) => {
780 value.sub[subKey].url = helpers.urlFormat('/product/search/list', { 750 value.sub[subKey].url = helpers.urlFormat('/product/search/list', {
781 shop_id: params.shopId, 751 shop_id: params.shopId,
782 - sort: _.get(value, 'relationParameter.sort', ''), 752 + sort: _.get(value, 'relation_parameter.sort', ''),
783 title: subValue.categoryName, 753 title: subValue.categoryName,
784 query: subValue.categoryName 754 query: subValue.categoryName
785 }); 755 });
1 <div class="shop-introduce-page"> 1 <div class="shop-introduce-page">
2 <a class="banner"> 2 <a class="banner">
3 - <img src="{{image shopLogo 640 480}}"> 3 + <img src="{{image shop_logo 640 480}}">
4 </a> 4 </a>
5 5
6 <div class="descripition"> 6 <div class="descripition">
7 - {{shopIntro}} 7 + {{shop_intro}}
8 </div> 8 </div>
9 9
10 <p class="sign-icon"> 10 <p class="sign-icon">
@@ -16,15 +16,15 @@ module.exports = { @@ -16,15 +16,15 @@ module.exports = {
16 siteUrl: '//m.yohobuy.com', 16 siteUrl: '//m.yohobuy.com',
17 assetUrl: '//localhost:5001', 17 assetUrl: '//localhost:5001',
18 domains: { 18 domains: {
19 - api: 'http://api.yoho.cn/',  
20 - service: 'http://service.yoho.cn/',  
21 - liveApi: 'http://api.live.yoho.cn/',  
22 - singleApi: 'http://single.yoho.cn/' 19 + // api: 'http://api.yoho.cn/',
  20 + // service: 'http://service.yoho.cn/',
  21 + // liveApi: 'http://api.live.yoho.cn/',
  22 + // singleApi: 'http://single.yoho.cn/',
23 23
24 - // api: 'http://api-test1.yohops.com:9999/',  
25 - // service: 'http://service-test1.yohops.com:9999/',  
26 - // liveApi: 'http://testapi.live.yohops.com:9999/',  
27 - // singleApi: 'http://api-test1.yohops.com:9999/' 24 + api: 'http://api-test1.yohops.com:9999/',
  25 + service: 'http://service-test1.yohops.com:9999/',
  26 + liveApi: 'http://testapi.live.yohops.com:9999/',
  27 + singleApi: 'http://api-test1.yohops.com:9999/',
28 }, 28 },
29 subDomains: { 29 subDomains: {
30 host: '.m.yohobuy.com', 30 host: '.m.yohobuy.com',
@@ -125,15 +125,16 @@ module.exports = function(specificGender) { @@ -125,15 +125,16 @@ module.exports = function(specificGender) {
125 page: page + 1 125 page: page + 1
126 }, 126 },
127 success: function(data) { 127 success: function(data) {
128 - // console.log(data) 128 +
129 var PRDID = []; 129 var PRDID = [];
130 - if (data === ' ') {  
131 - console.log(data); 130 + if (data === ' ' || data === '') {
132 searching = false; 131 searching = false;
133 loading.hideLoadingMask(); 132 loading.hideLoadingMask();
134 133
135 // 有货币页面不加载底部 134 // 有货币页面不加载底部
136 if (gender && !specificGender) { 135 if (gender && !specificGender) {
  136 + gender = gender.substr(0, 3);
  137 +
137 if (gender === '1,3') { 138 if (gender === '1,3') {
138 url = '/boys/bottomBanner'; 139 url = '/boys/bottomBanner';
139 } else { 140 } else {
  1 +/**
  2 + * Created by yoho on 2016/10/9.
  3 + */
  4 +require('../common');