Authored by htoooth

健壮性处理。

... ... @@ -500,7 +500,7 @@ function _getSortNavAsync(smallSortId, gender) {
let data = yield searchAPI.getSortByConditionAsync({sort: smallSortId});
if (data.data) {
let sort = _.head(data.data.sort);
let sort = _.head(data.data.sort) || {};
// 一级分类
navs.push({
... ... @@ -511,7 +511,7 @@ function _getSortNavAsync(smallSortId, gender) {
if (sort.sub) {
// 二级分类
let subSort = _.head(sort.sub);
let subSort = _.head(sort.sub) || {};
navs.push({
href: helpers.urlFormat('', {msort: sort.sort_id, misort: subSort.sort_id, gender: gender}, 'list'),
... ... @@ -1212,6 +1212,10 @@ const _getSizeAttrByMaxSortId = (maxSortId, sizeList) => {
let attributeNames = {};
if(_.isEmpty(sizeList)){
return sizeInfos;
}
// 获取属性名称
sizeList.sizeAttributeBos.forEach(size => {
attributeNames[size.id] = size.attributeName;
... ... @@ -1309,12 +1313,15 @@ const _getSeoByGoodsInfo = function(goodsInfo, navs) {
let sortName = '';
let description = '';
goodsInfo = goodsInfo || {};
navs = navs || [];
if (!_.isEmpty(goodsInfo.brandName)) {
title = goodsInfo.brandName + ' ';
brandName = goodsInfo.brandName;
}
if (!_.isEmpty(navs) && navs[1].name) {
if (!_.isEmpty(navs) && navs[1] && navs[1].name) {
sortName = navs[1].name;
title += navs[1].name + '|';
}
... ...