...
|
...
|
@@ -116,6 +116,11 @@ class familyModel extends global.yoho.BaseModel { |
|
|
if (val) {
|
|
|
val.nickname = key;
|
|
|
|
|
|
if (key === 'now') {
|
|
|
val.isNoOpen = true;
|
|
|
val.name = '敬请期待';
|
|
|
}
|
|
|
|
|
|
if (val.login === true) {
|
|
|
loginList.push(val);
|
|
|
} else {
|
...
|
...
|
@@ -345,6 +350,20 @@ class familyModel extends global.yoho.BaseModel { |
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (val.appName === 'yohobuy') {
|
|
|
singleData = _.assign(singleData, {
|
|
|
loadSrc: 'http://union.yoho.cn/union/app-downloads.html?union_type=100000000000349&openby:yohobuy={"action":"go.h5","params":{"url":"http://union.yoho.cn/union/app-downloads.html?union_type=100000000000349"}}'
|
|
|
});
|
|
|
} else if (val.appName === 'mars') {
|
|
|
singleData = _.assign(singleData, {
|
|
|
loadSrc: 'http://www.yohomars.com/download/index?action=go.index¶ms:yohomars://yohomars.com/goapp&openby:yohobuy={"action":"go.h5","params":{"url": "http://www.yohomars.com/download/index?action=go.index¶ms:yohomars://yohomars.com/goapp"}}'
|
|
|
});
|
|
|
} else if (val.appName === 'now') {
|
|
|
singleData = _.assign(singleData, {
|
|
|
loadSrc: 'http://www.yohogirls.com/download/default/index?act=go.news¶ms=yohoefashion4In1://&openby:yohobuy={"action":"go.h5","params": {"url":"http://www.yohogirls.com/download/default/index?act=go.news¶ms=yohoefashion4In1://"}}'
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return singleData;
|
...
|
...
|
@@ -388,13 +407,15 @@ class familyModel extends global.yoho.BaseModel { |
|
|
return b.proportion - a.proportion;
|
|
|
});
|
|
|
|
|
|
chartsData.total = _.get(result.data, 'total', '');
|
|
|
if (_.get(result.data, 'total', 0)) {
|
|
|
chartsData.total = parseInt(result.data.total, 10) < 99999 ? result.data.total : '99999+';
|
|
|
}
|
|
|
|
|
|
_.forEach(result.data.data, function(data) {
|
|
|
list.push({
|
|
|
value: data.num,
|
|
|
name: data.source,
|
|
|
percent: parseInt(data.proportion, 10) * 100 + '%',
|
|
|
percent: parseFloat(data.proportion).toFixed(2) * 100 + '%',
|
|
|
color: data.colour,
|
|
|
plateType: data.type
|
|
|
});
|
...
|
...
|
@@ -412,7 +433,7 @@ class familyModel extends global.yoho.BaseModel { |
|
|
/**
|
|
|
* family主页
|
|
|
*/
|
|
|
familyIndex(uid, contentCodeOne, contentCodeTwo) {
|
|
|
familyIndex(uid, contentCodeOne, contentCodeTwo, isMarsApp) {
|
|
|
return Promise.all([
|
|
|
this._userData(uid),
|
|
|
this._getCode(uid),
|
...
|
...
|
@@ -450,6 +471,12 @@ class familyModel extends global.yoho.BaseModel { |
|
|
familyIndexData.townContent = result[4];
|
|
|
}
|
|
|
|
|
|
if (isMarsApp) {
|
|
|
familyIndexData.userInfoLink = 'http://m.yohobuy.com/home/family/userInfo?openby:mars={"action":"go.h5","params":{"url":"http://m.yohobuy.com/home/family/userInfo"}}';
|
|
|
} else {
|
|
|
familyIndexData.userInfoLink = 'http://m.yohobuy.com/home/family/userInfo?openby:yohobuy={"action":"go.h5","params":{"url":"http://m.yohobuy.com/home/family/userInfo"}}';
|
|
|
}
|
|
|
|
|
|
return familyIndexData;
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -475,14 +502,14 @@ class familyModel extends global.yoho.BaseModel { |
|
|
};
|
|
|
let _this = this;
|
|
|
|
|
|
if (_.get(result, 'data.coinlist')) {
|
|
|
_.forEach(result.data.coinlist, function(val) {
|
|
|
if (_.get(result, 'data.data')) {
|
|
|
_.forEach(result.data.data, function(val) {
|
|
|
Object.assign(val, {
|
|
|
typeName: _this.checkType(val.iconType),
|
|
|
minus: parseInt(val.num, 10) < 0
|
|
|
});
|
|
|
});
|
|
|
resu.coinList = result.data.coinlist;
|
|
|
resu.coinList = result.data.data;
|
|
|
}
|
|
|
|
|
|
return resu;
|
...
|
...
|
@@ -519,16 +546,16 @@ class familyModel extends global.yoho.BaseModel { |
|
|
let hideTips = true;
|
|
|
|
|
|
|
|
|
result[0].data.gender = (thisGender === '1' ? '男' : '女');
|
|
|
result[0].data.otherGender = (thisGender === '1' ? '女' : '男');
|
|
|
if (result[0].data.gender === '男') {
|
|
|
result[0].data.gender = (thisGender === '1' ? 'BOY' : 'GIRL');
|
|
|
result[0].data.otherGender = (thisGender === '1' ? 'GIRL' : 'BOY');
|
|
|
if (result[0].data.gender === 'BOY') {
|
|
|
result[0].data.genderId = 1;
|
|
|
result[0].data.otherGenderId = 2;
|
|
|
} else {
|
|
|
result[0].data.genderId = 2;
|
|
|
result[0].data.otherGenderId = 1;
|
|
|
}
|
|
|
if (params.isApp) {
|
|
|
if (params.isYohoApp || params.isNowApp) {
|
|
|
result[0].data.qrcodeLink = `http://m.yohobuy.com?openby:yohobuy={"action":"go.h5","params":{
|
|
|
"url":"http://m.yohobuy.com/home/user/qrcode",
|
|
|
"param": {
|
...
|
...
|
@@ -544,6 +571,22 @@ class familyModel extends global.yoho.BaseModel { |
|
|
"hideTips":"${hideTips}"
|
|
|
}
|
|
|
}}`;
|
|
|
} else if (params.isMarsApp) {
|
|
|
result[0].data.qrcodeLink = `http://m.yohobuy.com?openby:mars={"action":"go.h5","params":{
|
|
|
"url":"http://m.yohobuy.com/home/user/qrcode",
|
|
|
"param": {
|
|
|
"token":"${token}",
|
|
|
"icon":"${icon}",
|
|
|
"uname":"${name}",
|
|
|
"vip":"${vip}"
|
|
|
}
|
|
|
}}`;
|
|
|
result[0].data.trendLink = `http://m.yohobuy.com?openby:mars={"action":"go.h5","params":{
|
|
|
"url":"http://m.yohobuy.com/home/tide-command?hideTips=true",
|
|
|
"param": {
|
|
|
"hideTips":"${hideTips}"
|
|
|
}
|
|
|
}}`;
|
|
|
} else {
|
|
|
result[0].data.qrcodeLink = helpers.urlFormat('/home/user/qrcode', {
|
|
|
token: token,
|
...
|
...
|
@@ -613,7 +656,8 @@ class familyModel extends global.yoho.BaseModel { |
|
|
uid: params.uid,
|
|
|
type: params.type,
|
|
|
page: params.page || 1,
|
|
|
limit: params.limit || 10,
|
|
|
limit: params.limit || 20,
|
|
|
city_id: params.cityId
|
|
|
}, {
|
|
|
code: 200
|
|
|
}).then(result => {
|
...
|
...
|
@@ -624,33 +668,56 @@ class familyModel extends global.yoho.BaseModel { |
|
|
if (_.get(result, 'data.list')) {
|
|
|
resu.list = result.data.list;
|
|
|
}
|
|
|
|
|
|
_.forEach(resu.list, function(val) {
|
|
|
if (params.isMarsApp && params.type === 'mars') {
|
|
|
val.usable = true;
|
|
|
}
|
|
|
|
|
|
if (params.isNowApp && params.type === 'now') {
|
|
|
val.usable = true;
|
|
|
}
|
|
|
|
|
|
if (params.type === 'now') {
|
|
|
val.point = val.point.toString();
|
|
|
|
|
|
if (parseInt(val.stock, 10) === 0) {
|
|
|
val.noStore = true;
|
|
|
}
|
|
|
val.stock = val.stock.toString();
|
|
|
}
|
|
|
|
|
|
if (params.type === 'mars') {
|
|
|
val.points = val.points.toString();
|
|
|
|
|
|
if (parseInt(val.num, 10) === 0) {
|
|
|
val.noStore = true;
|
|
|
}
|
|
|
|
|
|
if (parseInt(val.exchangeEndTime, 10) !== 0 && parseInt(val.exchangeStartTime, 10) !== 0) {
|
|
|
if (parseInt(Date.now(), 10) > parseInt(val.exchangeEndTime, 10) || parseInt(Date.now(), 10) < parseInt(val.exchangeStartTime, 10)) { // eslint-disable-line
|
|
|
val.noStore = true;
|
|
|
}
|
|
|
}
|
|
|
val.num = val.num.toString();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return resu;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
coinMall(params) {
|
|
|
return family.get('user/getUserCoin', {
|
|
|
return family.get('user/getTotalCoin', {
|
|
|
uid: params.uid
|
|
|
}, {
|
|
|
code: 200
|
|
|
}).then(result => {
|
|
|
let resu = {
|
|
|
coinNum: {},
|
|
|
isMarsApp: params.isMarsApp,
|
|
|
isNowApp: params.isNowApp
|
|
|
};
|
|
|
|
|
|
if (_.get(result, 'data.data')) {
|
|
|
_.forEach(result.data.data, (val) => {
|
|
|
let name = this.checkType(parseInt(val.type, 10));
|
|
|
|
|
|
resu.coinNum[name] = {
|
|
|
num: val.num,
|
|
|
source: val.source
|
|
|
};
|
|
|
});
|
|
|
if (result && result.code === 200) {
|
|
|
return result.data;
|
|
|
} else {
|
|
|
return {};
|
|
|
}
|
|
|
return resu;
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
|