...
|
...
|
@@ -10,6 +10,8 @@ const mRoot = '../models'; |
|
|
const headerModel = require('../../../doraemon/models/header');
|
|
|
const listModel = require(`${mRoot}/list`);
|
|
|
const _ = require('lodash');
|
|
|
const md5 = require('yoho-md5');
|
|
|
const co = Promise.coroutine;
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const productProcess = require(`${utils}/product-process`);
|
|
|
const searchModel = require(`${mRoot}/search`);
|
...
|
...
|
@@ -17,6 +19,7 @@ const shopModel = require(`${mRoot}/shop`); |
|
|
const searchProcess = require(`${utils}/search-process`);
|
|
|
const stringProcess = require(`${utils}/string-process`);
|
|
|
const listParamsProcess = require(`${utils}/list-params-process`);
|
|
|
const redis = require(`${utils}/redis`);
|
|
|
|
|
|
/**
|
|
|
* 封面图
|
...
|
...
|
@@ -320,8 +323,10 @@ const listNew = (req, res, next) => { |
|
|
if (uid) {
|
|
|
initialData.uid = uid;
|
|
|
}
|
|
|
co(function* () {
|
|
|
let result = yield req.ctx(searchModel).getCategoryGoods(initialData);
|
|
|
let categoryIntro = '';
|
|
|
|
|
|
req.ctx(searchModel).getCategoryGoods(initialData).then(result => {
|
|
|
let responseResult = {
|
|
|
list: productProcess.processProductList(result.data.product_list || [], {
|
|
|
isApp: params.isApp || (params.appVersion && params.appVersion !== 'false'),
|
...
|
...
|
@@ -330,7 +335,13 @@ const listNew = (req, res, next) => { |
|
|
})
|
|
|
};
|
|
|
|
|
|
let seoTitle = _.get(result, 'data.filter.group_sort[0].sub[0].category_name', '商品列表');
|
|
|
let seoTitle = _.get(result, 'data.filter.group_sort[0].sub[0].category_name');
|
|
|
|
|
|
if (seoTitle) {
|
|
|
categoryIntro = yield redis.getAsync(`category:description:${md5(seoTitle)}`);
|
|
|
} else {
|
|
|
seoTitle = '商品列表';
|
|
|
}
|
|
|
|
|
|
if (params.sort_name) {
|
|
|
seoTitle = decodeURIComponent(params.sort_name);
|
...
|
...
|
@@ -353,9 +364,9 @@ const listNew = (req, res, next) => { |
|
|
category: true,
|
|
|
localCss: true,
|
|
|
appPath: appPath,
|
|
|
introText: req.query.intro_text
|
|
|
categoryIntro: categoryIntro
|
|
|
}, searchProcess.getListSeoData(req.query.gender, seoTitle)));
|
|
|
}).catch(next);
|
|
|
})().catch(next);
|
|
|
};
|
|
|
|
|
|
/**
|
...
|
...
|
|