|
@@ -120,13 +120,22 @@ const sortParams = (req, res, next) => { |
|
@@ -120,13 +120,22 @@ const sortParams = (req, res, next) => { |
120
|
*/
|
120
|
*/
|
121
|
const resolvePathParams = (req, res, next) => {
|
121
|
const resolvePathParams = (req, res, next) => {
|
122
|
let queryParams = req.query;
|
122
|
let queryParams = req.query;
|
|
|
123
|
+ let pathParams = req.params.pathParams;
|
123
|
|
124
|
|
124
|
// 1. 取 path 的参数
|
125
|
// 1. 取 path 的参数
|
125
|
- req.query = listParamsProcess.getParams(req.path);
|
126
|
+ req.query = listParamsProcess.getParams(pathParams);
|
126
|
|
127
|
|
127
|
// 2. 取查询字符串参数
|
128
|
// 2. 取查询字符串参数
|
128
|
_.assign(req.query, queryParams);
|
129
|
_.assign(req.query, queryParams);
|
129
|
|
130
|
|
|
|
131
|
+ // 3. 取 params 参数
|
|
|
132
|
+ if (req.params) {
|
|
|
133
|
+ if (req.params.pathParams) {
|
|
|
134
|
+ delete req.params.pathParams;
|
|
|
135
|
+ }
|
|
|
136
|
+ _.assign(req.query, req.params);
|
|
|
137
|
+ }
|
|
|
138
|
+
|
130
|
if (req.query) {
|
139
|
if (req.query) {
|
131
|
_.forEach(req.query, (perParam, index) => {
|
140
|
_.forEach(req.query, (perParam, index) => {
|
132
|
req.query[index] = stringProcess.paramsFilter(perParam);
|
141
|
req.query[index] = stringProcess.paramsFilter(perParam);
|
|
@@ -139,7 +148,8 @@ const resolvePathParams = (req, res, next) => { |
|
@@ -139,7 +148,8 @@ const resolvePathParams = (req, res, next) => { |
139
|
* 解析 Path 类型泛商品列表异步请求中 URL 的参数
|
148
|
* 解析 Path 类型泛商品列表异步请求中 URL 的参数
|
140
|
*/
|
149
|
*/
|
141
|
const resolvePathParamsAjax = (req, res, next) => {
|
150
|
const resolvePathParamsAjax = (req, res, next) => {
|
142
|
- let currentUrlParams = listParamsProcess.getParams(req.query.currentUrl);
|
151
|
+ let pathParams = _.last(_.split(req.query.currentUrl, '/'));
|
|
|
152
|
+ let currentUrlParams = listParamsProcess.getParams(pathParams);
|
143
|
|
153
|
|
144
|
delete req.query.currentUrl;
|
154
|
delete req.query.currentUrl;
|
145
|
|
155
|
|