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
yyq
7 years ago
Commit
a50ad54aa5a81235dc1e94fe412100fcefe9c010
1 parent
a5564a81
fix shop 301 params
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
apps/product/controllers/new-shop.js
apps/product/controllers/new-shop.js
View file @
a50ad54
...
...
@@ -49,30 +49,32 @@ const shop = {
let
brandId
=
_
.
parseInt
(
stringProcess
.
paramsFilter
(
req
.
query
.
brand_id
));
co
(
function
*
()
{
let
params
=
_
.
omit
(
req
.
query
,
[
'shop_id'
,
'domain'
]);
if
(
shopId
&&
domain
)
{
return
res
.
redirect
(
301
,
`
//m.yohobuy.com/shop/${domain}-${shopId}.html`
);
return
res
.
redirect
(
301
,
helpers
.
urlFormat
(
`
/
shop
/
$
{
domain
}
-
$
{
shopId
}.
html
`
,
params
)
);
}
if
(
shopId
)
{
let
shopInfoApi
=
(
yield
req
.
ctx
(
shopModel
).
getShopInfo
(
shopId
))
||
{};
return
res
.
redirect
(
301
,
`
//m.yohobuy.com/shop/${_.get(shopInfoApi, 'data.shop_domain', 'id')}-${shopId}.html`
); // eslint-disable-line
return
res
.
redirect
(
301
,
helpers
.
urlFormat
(
`
/
shop
/
$
{
_
.
get
(
shopInfoApi
,
'data.shop_domain'
,
'id'
)}
-
$
{
shopId
}.
html
`
,
params
)
);
// eslint-disable-line
}
if
(
domain
)
{
let
domainInfo
=
(
yield
req
.
ctx
(
shopModel
).
getBrandLogoByDomain
(
domain
))
||
{};
// 通过域名查询店铺类型,或者品牌信息
if
(
domainInfo
.
shopId
&&
domainInfo
.
type
===
'2'
)
{
return
res
.
redirect
(
301
,
`
//m.yohobuy.com/shop/${domain}-${_.get(domainInfo, 'shopId')}.html`);
return
res
.
redirect
(
301
,
helpers
.
urlFormat
(
`
/
shop
/
$
{
domain
}
-
$
{
_
.
get
(
domainInfo
,
'shopId'
)}.
html
`
,
params
));
// eslint-disable-line
}
else
{
return
res
.
redirect
(
301
,
helpers
.
urlFormat
(
'/product/index/brand'
,
{
return
res
.
redirect
(
301
,
helpers
.
urlFormat
(
'/product/index/brand'
,
Object
.
assign
(
params
,
{
brand_id
:
_
.
get
(
domainInfo
,
'id'
)
}));
}))
)
;
}
}
if
(
brandId
)
{
return
res
.
redirect
(
301
,
helpers
.
urlFormat
(
'/product/index/brand'
,
{
brand_id
:
brandId
}));
return
res
.
redirect
(
301
,
helpers
.
urlFormat
(
'/product/index/brand'
,
Object
.
assign
(
params
,
{
brand_id
:
brandId
})));
// eslint-disable-line
}
})().
catch
(
next
);
},
...
...
@@ -111,7 +113,7 @@ const shop = {
let
apiDomain
=
_
.
get
(
shopInfo
,
'shop_domain'
);
if
(
apiDomain
&&
apiDomain
!==
domain
)
{
return
res
.
redirect
(
301
,
`
//m.yohobuy.com/shop/${apiDomain}-${shopId}.html`);
return
res
.
redirect
(
301
,
helpers
.
urlFormat
(
`
/
shop
/
$
{
apiDomain
}
-
$
{
shopId
}.
html
`
,
_
.
omit
(
req
.
query
,
[
'shop_id'
,
'domain'
])));
// eslint-disable-line
}
// 红人店铺
...
...
Please
register
or
login
to post a comment