Authored by ccbikai(👎🏻🍜)

搜索子域名优化

... ... @@ -16,10 +16,15 @@ module.exports = {
siteUrl: '//m.yohobuy.com',
assetUrl: '//localhost:5001',
domains: {
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.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/'
},
subDomains: {
host: '.m.yohobuy.com',
... ... @@ -83,7 +88,7 @@ if (isProduction) {
api: 'http://api.yoho.yohoops.org/',
service: 'http://service.yoho.yohoops.org/',
liveApi: 'http://api.live.yoho.cn/',
singleApi: 'http://singleapi.yoho.cn/'
singleApi: 'http://single.yoho.cn/'
},
memcache: {
master: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'],
... ...
... ... @@ -5,6 +5,7 @@
*/
'use strict';
const querystring = require('querystring');
const _ = require('lodash');
const helpers = global.yoho.helpers;
module.exports = () => {
... ... @@ -21,8 +22,17 @@ module.exports = () => {
}
break;
case 'search': // search
if (req.path === '/') {
if (req.path === '/' && _.keys(req.query).length) {
// 有查询关键字
req.url = `/product/search/list?${querystring.stringify(req.query)}`;
} else {
// 无查询关键字
req.url = `/product/search/index?${querystring.stringify(req.query)}`;
}
if (req.path === '/search') {
req.url = `/product/search/index?${querystring.stringify(req.query)}`;
}
break;
... ...