Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
htoooth
8 years ago
Commit
9f44aaf70f206ec5701adc4074a554b2c82b20cd
1 parent
60215e2a
fix bug
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
doraemon/middleware/sub-domain.js
doraemon/middleware/sub-domain.js
View file @
9f44aaf
...
...
@@ -4,6 +4,8 @@
* @date: 2016/6/16
*/
'use strict'
;
const
_
=
require
(
'lodash'
);
const
qs
=
require
(
'querystring'
);
module
.
exports
=
()
=>
{
return
(
req
,
res
,
next
)
=>
{
...
...
@@ -67,11 +69,19 @@ module.exports = () => {
}
default
:
// 其它(识别为品牌)
{
// eslint-disable-line
let
queryString
=
(
function
()
{
if
(
!
_
.
isEmpty
(
req
.
query
))
{
return
'&'
+
qs
.
stringify
(
req
.
query
);
}
else
{
return
''
;
}
}());
req
.
query
.
domain
=
req
.
subdomains
[
0
];
if
(
!
req
.
path
||
req
.
path
===
'/'
)
{
req
.
url
=
`
/
product
/
index
/
brand
?
domain
=
$
{
req
.
subdomains
[
0
]}
`
;
req
.
url
=
`
/
product
/
index
/
brand
?
domain
=
$
{
req
.
subdomains
[
0
]}
$
{
queryString
}
`
;
}
else
if
(
req
.
path
===
'/about'
)
{
req
.
url
=
`
/
product
/
index
/
about
?
domain
=
$
{
req
.
subdomains
[
0
]
}
`
;
req
.
url
=
`
/
product
/
index
/
brand
?
domain
=
$
{
req
.
subdomains
[
0
]}
$
{
queryString
}
`
;
}
break
;
}
...
...
Please
register
or
login
to post a comment