Authored by 郭成尧

Merge branch 'feature/familyData' into 'release/6.3'

data



See merge request !1165
... ... @@ -149,8 +149,8 @@ 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 (_.get(result, 'data.mars.vipLevelList', []).length > 0) {
_.forEach(_.get(result, 'data.mars.vipLevelList', []), function(val) {
val.name = 'Lv.' + val.level;
});
}
... ... @@ -402,16 +402,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 +446,20 @@ class familyModel extends global.yoho.BaseModel {
]).then((result) => {
let familyIndexData = {};
if (result[0] && result[0].data) {
if (_.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
});
}
... ...