Authored by 陈峰

Merge branch 'gray' into 'master'

Gray



See merge request !350
... ... @@ -7,9 +7,14 @@ const simpleHeaderModel = require('../../../doraemon/models/simple-header');
const logger = global.yoho.logger;
const index = (req, res) => {
let remoteIp = req.yoho.clientIp || '';
logger.info(`limit remote ip: ${remoteIp}; ua: ${req.header('User-Agent')}; uid: ${req.user.uid}; reqId: ${req.reqID}`); // eslint-disable-line
return res.render('robot-check', {
module: '3party',
page: 'robot-check',
reqId: req.reqID,
simpleHeader: simpleHeaderModel.setSimpleHeaderData()
});
};
... ...
<div class="robot-check-page yoho-page">
<div class="robot-check-page yoho-page" data-reqid="{{reqId}}">
<div class="captcha">
<div class="title">您的操作太频繁了~请完成以下操作后继续</div>
<div class="captcha-wrap"> </div>
... ...
... ... @@ -88,7 +88,7 @@ module.exports = class extends global.yoho.BaseModel {
ensureHandleModel.handleViewPrice(result.data.promotion_formula_list);
}
result.data = Object.assign(result.data, ensureHandleModel.handleUseYohoCoin(result.data));
result.data = Object.assign(result.data || {}, ensureHandleModel.handleUseYohoCoin(result.data));
}
return result;
... ...
... ... @@ -217,13 +217,25 @@ module.exports = class favorite extends global.yoho.BaseModel {
}
result.brands = _.get(brand, 'data.brand_list', []).map((item) => {
let url = '';
switch (item.brandOrShopType) {
case 'shop':
url = helpers.urlFormat(`/shop/${item.brand_domain}-${item.shop_id}.html`, null);
break;
case 'brand':
url = helpers.urlFormat('/search/', {brand: item.brand_id});
break;
default:
break;
}
return {
id: item.brand_id,
brandOrShopType: item.brandOrShopType || '',
shop_id: item.shop_id || '',
img: helpers.image(item.brand_ico, 100, 100),
url: helpers.urlFormat(`/shop/${item.brand_domain}-${item.shop_id}.html`, null),
url: url,
name: item.brand_name,
naCount: item.new_product_num,
colCount: item.brand_favorite_num
... ...
... ... @@ -406,17 +406,19 @@ function getSaleDiscountData(params, channel) {
}
}
let productPool = _.get(result, '[1].data[0].product_pool');
// 这里把 channel 全都处理掉,因为根据channel查小分类,而传入商品池时,不需要
return Promise.all([
this.saleApi.getSaleGoodsList({
channel: null,
saleType: '3',
limit: '1',
productPool: result[1].data[0].product_pool
productPool: productPool
}),
this.saleApi.getSaleGoodsList(Object.assign({}, params, {
channel: null,
productPool: result[1].data[0].product_pool
productPool: productPool
}))
]).then(subResult => {
// 删除无用参数
... ...
... ... @@ -91,8 +91,6 @@ module.exports = (req, res, next) => {
if (exclusion) {
return next();
} else if (!allPass && policy) {
logger.info(`limit remote ip: ${remoteIp}; ua: ${req.header('User-Agent')}; uid: ${req.user.uid}`);
policy(req, res, next);
} else {
return next();
... ...