Authored by 张孝茹

data

... ... @@ -149,8 +149,9 @@ class familyModel extends global.yoho.BaseModel {
code: 200
}).then((result) => {
if (result.data && result.data.mars && result.data.mars.vipLevelList.length > 0) {
_.forEach(result.data.mars.vipLevelList, function(val) {
if (result.data && _.get(result, 'data.mars', '') &&
_.get(result, 'data.mars.vipLevelList', []).length > 0) {
_.forEach(_.get(result, 'data.mars.vipLevelList', []), function(val) {
val.name = 'Lv.' + val.level;
});
}
... ... @@ -402,16 +403,18 @@ class familyModel extends global.yoho.BaseModel {
let list = [];
let colorList = [];
if (result && result.data) {
result.data.data.sort(function(a, b) {
if (result && result.data && result.code === 200) {
let integralData = _.get(result, 'data', {});
integralData.data.sort(function(a, b) {
return b.proportion - a.proportion;
});
if (_.get(result.data, 'total', 0)) {
if (integralData.total) {
chartsData.total = parseInt(result.data.total, 10) < 99999 ? result.data.total : '99999+';
}
_.forEach(result.data.data, function(data) {
_.forEach(integralData.data, function(data) {
list.push({
value: data.num,
name: data.source,
... ... @@ -444,19 +447,20 @@ class familyModel extends global.yoho.BaseModel {
]).then((result) => {
let familyIndexData = {};
if (result[0] && result[0].data) {
if (result[0] && result[0].data && _.get(result, '[0].code', '') === 200) {
let perInfo = _.get(result, '[0].data', {});
if (result[0].data.headIco) {
if (perInfo.headIco) {
result[0].data.headIco = result[0].data.headIco.replace('img01.yohomars.com', 'imgmars.yohobuy.com').replace('img02.yohomars.com', 'imgmars.yohobuy.com'); // eslint-disable-line
}
familyIndexData = _.assign(familyIndexData, {
head_ico: result[0].data.headIco,
nickname: result[0].data.nickName,
gender: parseInt(result[0].data.gender, 10),
birthday: result[0].data.birthday ? moment(result[0].data.birthday).format('MM-DD') : '',
province: result[0].data.province,
city: result[0].data.city
head_ico: perInfo.headIco,
nickname: perInfo.nickName,
gender: parseInt(perInfo.gender, 10),
birthday: perInfo.birthday ? moment(perInfo.birthday).format('MM-DD') : '',
province: perInfo.province,
city: perInfo.city
});
}
... ...