Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
ccbikai(👎🏻🍜)
8 years ago
Commit
1b0d994fc3f43628a5229cdcd5028edc075c0b20
1 parent
57e48fa3
搜索子域名优化
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
6 deletions
config/common.js
doraemon/middleware/sub-domain.js
config/common.js
View file @
1b0d994
...
...
@@ -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://single
api
.yoho.cn/'
singleApi
:
'http://single.yoho.cn/'
},
memcache
:
{
master
:
[
'memcache1.yohoops.org:12111'
,
'memcache2.yohoops.org:12111'
,
'memcache3.yohoops.org:12111'
],
...
...
doraemon/middleware/sub-domain.js
View file @
1b0d994
...
...
@@ -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
;
...
...
Please
register
or
login
to post a comment