|
@@ -10,7 +10,7 @@ const helpers = global.yoho.helpers; |
|
@@ -10,7 +10,7 @@ const helpers = global.yoho.helpers; |
10
|
const logger = global.yoho.logger;
|
10
|
const logger = global.yoho.logger;
|
11
|
const _ = require('lodash');
|
11
|
const _ = require('lodash');
|
12
|
|
12
|
|
13
|
-// const handleFilterUrl = require(`${global.utils}/parameter`).fullParamToMinPath;
|
13
|
+const handleFilterUrl = require(`${global.utils}/parameter`).fullParamToMinPath;
|
14
|
|
14
|
|
15
|
// 搜索相关接口
|
15
|
// 搜索相关接口
|
16
|
const searchApi = require('../models/search-api');
|
16
|
const searchApi = require('../models/search-api');
|
|
@@ -26,14 +26,14 @@ exports.index = (req, res, next) => { |
|
@@ -26,14 +26,14 @@ exports.index = (req, res, next) => { |
26
|
let resData = {};
|
26
|
let resData = {};
|
27
|
let qs = '';
|
27
|
let qs = '';
|
28
|
|
28
|
|
29
|
- // if (req.originalUrl && req.originalUrl.indexOf('.html') < 0 &&
|
|
|
30
|
- // req.originalUrl.indexOf('?') < 0 && !_.isEmpty(req.query)) {
|
|
|
31
|
- // let rUrl = handleFilterUrl('/list', req.query);
|
29
|
+ if (req.originalUrl &&
|
|
|
30
|
+ req.originalUrl.indexOf('.html') < 0 &&
|
|
|
31
|
+ req.originalUrl.indexOf('?') < 0 &&
|
|
|
32
|
+ req.yoho.seoParse) {
|
|
|
33
|
+ let rUrl = handleFilterUrl('/list', req.query);
|
32
|
|
34
|
|
33
|
- // if (rUrl !== req.originalUrl) {
|
|
|
34
|
- // return res.redirect(301, helpers.urlFormat(rUrl));
|
|
|
35
|
- // }
|
|
|
36
|
- // }
|
35
|
+ return res.redirect(301, helpers.urlFormat(rUrl));
|
|
|
36
|
+ }
|
37
|
|
37
|
|
38
|
try {
|
38
|
try {
|
39
|
qs = decodeURIComponent(req._parsedOriginalUrl.query || '');
|
39
|
qs = decodeURIComponent(req._parsedOriginalUrl.query || '');
|