Authored by 周少峰

code comments space

... ... @@ -18,14 +18,16 @@ const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const favicon = require('serve-favicon');
const session = require('express-session');
const memcached = require('connect-memcached');
// const memcached = require('connect-memcached');
const hbs = require('express-handlebars');
const pkg = require('./package.json');
const yohoLib = require('yoho-node-lib');
const app = express();
const MemcachedStore = memcached(session);
// const MemcachedStore = memcached(session);
// 全局注册library
yohoLib.global(config);
... ... @@ -64,10 +66,11 @@ app.use(session({
domain: 'yohobuy.com',
httpOnly: false
}
//store: new MemcachedStore({
// store: new MemcachedStore({
// hosts: config.memcache.session,
// prefix: 'yohobuy_session:'
//})
// })
}));
app.use((req, res, next) => {
... ...
... ... @@ -17,7 +17,7 @@ const search = require(`${mRoot}/search`);
exports.index = (req, res, next) => {
let resData = {};
//req.cookie._channel;//频道
// req.cookie._channel;//频道
search.getSearchData(req.query).then(result => {
Object.assign(resData, result);
res.render('search/index', resData);
... ...
... ... @@ -30,27 +30,6 @@ const handleFilterUrl = (originParam, newParam) => {
return _.trim(dest, '&');
};
/**
* 处理最新降价折扣信息
* @param params 当前 URL 的参数
* @returns {Array|*[]}
*/
const handleSaleNewSaleSortData = (params) => {
return [{
name: '1~3折',
href: handleFilterUrl(params, {p_d: '0.1,0.3'}),
checked: params.p_d === '0.1,0.3'
}, {
name: '4~6折',
href: handleFilterUrl(params, {p_d: '0.4,0.6'}),
checked: params.p_d === '0.4,0.6'
}, {
name: '7折以上',
href: handleFilterUrl(params, {p_d: '0.7,1'}),
checked: params.p_d === '0.7,1'
}];
};
/**
* 处理选中数据
... ... @@ -138,6 +117,7 @@ const handleBrandCheckedData = (params, origin) => {
dest[0].name += '、' + checked.name.substring(0, 3) + '...';
}
checkedCount++;
// 建议保留,需要品牌可以单个删除时放开注释即可
// dest.push(checked);
}
... ... @@ -561,11 +541,13 @@ exports.handlePathNavData = (data, params, page) => {
switch (page) {
case 'search':
//搜索结果提示
// 搜索结果提示
if (params.query || params.keywords) {
params.query = params.query || params.keywords
params.query = params.query || params.keywords;
pathNav.push({
name: '“<span id="nav_keyword">' + params.query + '</span>”&nbsp;&nbsp;共<span id="nav_keyword_count">' + data.total + '</span>个结果',
name: '“<span id="nav_keyword">' +
params.query + '</span>”&nbsp;&nbsp;共<span id="nav_keyword_count">' +
data.total + '</span>个结果'
});
} else {
pathNav.push({
... ... @@ -574,7 +556,7 @@ exports.handlePathNavData = (data, params, page) => {
}
break;
case 'brand':
//品牌
// 品牌
pathNav.push(
{
name: '品牌一览',
... ... @@ -589,7 +571,7 @@ exports.handlePathNavData = (data, params, page) => {
);
break;
default :
//分类
// 分类
_.forEach(data, (sort) => {
if (sort.relation_parameter.sort === params.sort) {
pathNav.push({
... ...
... ... @@ -14,9 +14,10 @@ module.exports = {
port: 6002,
siteUrl: 'http://www.yohobuy.com',
domains: {
//api: 'http://devapi.yoho.cn:58078/',
// api: 'http://devapi.yoho.cn:58078/',
api: 'http://testapi.yoho.cn:28078/',
//service: 'http://devservice.yoho.cn:58077/',
// service: 'http://devservice.yoho.cn:58077/',
service: 'http://testservice.yoho.cn:28077/',
search: 'http://192.168.102.216:8080/yohosearch/'
},
... ...