Authored by 周少峰

Merge branch 'gray'

... ... @@ -233,7 +233,7 @@ exports.detail = (req, res, next) => {
// 判断参数是否有效, 无效会跳转到错误页面
if (!info || !info.title) {
return new Error('文章不存在');
return next();
}
let promises = [
... ... @@ -304,8 +304,8 @@ exports.detail = (req, res, next) => {
description: '潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜',
webNavHeader: channel
}));
}).catch(next);
});
});
}).catch(next);
};
/**
... ...
... ... @@ -39,7 +39,7 @@ const showMain = (req, res, next) => {
module: 'product',
page: 'detail'
}, result.seo, result));
}).catch(next);
}).catch(()=> next());
};
... ...
... ... @@ -143,8 +143,8 @@ const isFavShop = (req, res, next) => {
};
const num = (req, res, next) => {
let bid = _.parseInt(req.query.bid) || 0;
let sid = _.parseInt(req.query.sid) || 0;
let bid = _.parseInt(`0${req.query.bid}`) || 0;
let sid = _.parseInt(`0${req.query.sid}`) || 0;
if (sid) {
return brandService.getShopFavNumAsync(sid).then((result) => {
... ... @@ -157,6 +157,8 @@ const num = (req, res, next) => {
res.json(result);
}).catch(next);
}
res.json({});
};
module.exports = {
... ...
... ... @@ -14,7 +14,7 @@ const cheerio = require('cheerio');
const helpers = global.yoho.helpers;
const config = global.yoho.config;
const crypto = global.yoho.crypto;
const logger = global.yoho.logger;
const videoPlayerTpl = require('../helper/video-player-tpl');
const productAPI = require('./detail-product-api');
... ... @@ -1520,6 +1520,7 @@ const showMainAsync = (data) => {
let productData = yield productAPI.getProductAsync(data.pid, data.uid, data.isStudent, data.vipLevel);
if (_.isEmpty(productData.data)) {
logger.error('app.product.data api wrong');
return Promise.reject({
code: 404,
message: 'app.product.data api wrong'
... ...
... ... @@ -297,7 +297,7 @@ exports.processProductList = (list, options) => {
isfew ? product.is_few = isfew : delete product.is_few;
}
if (options.query && _.isString(product.product_name)) {
let qreg = new RegExp(options.query, 'ig');
let qreg = new RegExp(options.query.replace('\\', '\\\\'), 'ig');
product.product_name = product.product_name.replace(qreg, '<span style="color:#c00;">$&</span>');
}
... ...