Authored by htoooth

detail

... ... @@ -14,6 +14,7 @@ const YohoAction = require('./lib/yoho-action');
const moment = require('moment');
const camelCase = global.yoho.camelCase;
const DEFAULT_AVATAR_ICO = 'http://static.yohobuy.com/images/v3/boy.jpg';
const _ = require('lodash');
class DetailAction extends YohoAction {
/**
... ... @@ -80,20 +81,22 @@ class CommentAction extends YohoAction {
let size = req.query.size || 10;
return service.getShareOrderListAsync(pid, page, size).then((result) => {
let pageResponse = _.get(result, 'data.pageResponse', {});
this.response.json({
code: result.code,
data: camelCase(result.data.pageResponse.list).map((item)=> {
data: camelCase(_.get(pageResponse, 'list', [])).map((item)=> {
return {
avatar: item.userInfo && item.userInfo.headIco ?
helpers.image(item.userInfo.headIco, 30, 30) :
DEFAULT_AVATAR_ICO,
userName: item.userInfo.nickName,
avatar: _.get(item, 'userInfo.headIco', '') ?
helpers.image(item.userInfo.headIco, 30, 30) :
DEFAULT_AVATAR_ICO,
userName: _.get(item, 'userInfo.nickName', ''),
date: moment(item.createTime, 'X').format('YYYY-MM-DD HH:mm:ss'),
color: item.goods.colorName,
size: item.goods.sizeName,
color: _.get(item, 'goods.colorName', ''),
size: _.get(item, 'goods.sizeName', ''),
comment: item.content,
total: result.data.pageResponse.totalCount
total: pageResponse.totalCount
};
})
});
... ...
... ... @@ -641,7 +641,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => {
// 是否收藏
result.isCollect = favoriteData.product;
if (origin.isLimitBuy === 'y') {
if (origin.isLimitBuy === 'Y') {
// 是否开售
let isBeginSale = !!(origin.saleStatus && origin.saleStatus === 1);
... ... @@ -739,19 +739,19 @@ const _detailDataPkg = (origin, uid, vipLevel) => {
if (domainBrand.type && domainBrand.shopId) {
switch (parseInt(domainBrand.type, 10)) {
case 1:
{
{
// 多品店不显示
banner = [];
break;
}
banner = [];
break;
}
case 2:
{
{
// 单品店显示新版的店铺banner
let basisData = yield shopService.basisTemplateAsync(domainBrand.shopId);
let basisData = yield shopService.basisTemplateAsync(domainBrand.shopId);
banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;
break;
}
banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;
break;
}
}
}
}
... ... @@ -764,7 +764,7 @@ const _detailDataPkg = (origin, uid, vipLevel) => {
return {
goodsInfo: result,
consultComment: consultComment,
banner: banner,
banner: _.isEmpty(banner) ? null : banner,
statGoodsInfo: statGoodsInfo
};
})();
... ...
... ... @@ -32,9 +32,9 @@ module.exports = {
useOneapm: false,
useCache: false,
memcache: {
master: ['192.168.102.222:11213'],
slave: ['192.168.102.222:11213'],
session: ['192.168.102.222:11213'],
master: ['127.0.0.1:11211'],
slave: ['127.0.0.1:11211'],
session: ['127.0.0.1:11211'],
timeout: 1000,
retries: 0
},
... ...