Authored by 郭成尧

params-order

... ... @@ -383,7 +383,7 @@ const getCategoryGoods = (req, res, next) => {
delete req.query.currentUrl;
let params = Object.assign({}, req.query, currentUrlParams);
let params = _.assign({}, currentUrlParams, req.query);
let uid = req.user.uid || 0;
if (uid) {
... ...
... ... @@ -13,6 +13,7 @@ const _ = require('lodash');
const helpers = global.yoho.helpers;
const searchProcess = require(`${utils}/search-process`);
const productProcess = require(`${utils}/product-process`);
const listParamsProcess = require(`${utils}/list-params-process`);
const co = require('bluebird').coroutine;
/**
... ... @@ -254,7 +255,17 @@ exports.filter = (req, res, next) => {
res.setHeader('Access-Control-Allow-Origin', allowOrigin);
res.setHeader('Access-Control-Allow-Credentials', 'true');
let params = Object.assign({}, req.query);
let params = {};
let currentUrlParams = {}; // 页面链接伪静态固定参数
if (req.query.currentUrl) {
currentUrlParams = listParamsProcess.getParams(req.query.currentUrl);
delete req.query.currentUrl;
delete req.query.page;
}
_.assign(params, currentUrlParams, req.query);
let uid = req.user.uid || 0;
if (uid) {
... ...
... ... @@ -384,6 +384,8 @@ module.exports = class extends global.yoho.BaseModel {
filterDataResult = yield self.getBrandGoods(params);
} else if (params.isShopList === 'Y') { // 无店铺有店铺 ID 的商品列表
filterDataResult = yield self.getShopGoods(params);
} else if (params.isNewList === 'Y') { // 无店铺有店铺 ID 的商品列表
filterDataResult = yield self.getCategoryGoods(params);
} else {
filterDataResult = yield self._searchGoods(params);
}
... ...
... ... @@ -12,5 +12,6 @@ require('./shop/coupon');
new ProductListWithFilter({
page: 2,
currentUrl: location.pathname
currentUrl: location.pathname,
isNewList: 'Y'
}, 'product/search/category');
... ...