...
|
...
|
@@ -79,217 +79,46 @@ class familyModel extends global.yoho.BaseModel { |
|
|
/**
|
|
|
* 获取APP列表
|
|
|
*/
|
|
|
_getAppList() {
|
|
|
let result = {
|
|
|
code: 200,
|
|
|
data: [
|
|
|
{
|
|
|
uid: null,
|
|
|
iconUrl: 'http://img12.static.yhbimg.com/article/2017/08/23/10/02412723632a13bd6ad1eef8fe580095a5.png?imageView/{mode}/w/{width}/h/{height}',
|
|
|
sourceName: 'yohobuy',
|
|
|
source: 1,
|
|
|
login: true
|
|
|
},
|
|
|
{
|
|
|
uid: null,
|
|
|
iconUrl: 'http://img13.static.yhbimg.com/article/2017/08/23/10/0222be3d6a9d8a1617b89fcf35357a3593.png?imageView/{mode}/w/{width}/h/{height}',
|
|
|
sourceName: 'now',
|
|
|
source: 2,
|
|
|
login: true
|
|
|
},
|
|
|
{
|
|
|
uid: null,
|
|
|
iconUrl: 'http://img12.static.yhbimg.com/article/2017/08/23/10/02fe755abdc5d390252cf6df25c01dffae.png?imageView/{mode}/w/{width}/h/{height}',
|
|
|
sourceName: 'mars',
|
|
|
source: 3,
|
|
|
login: true
|
|
|
},
|
|
|
{
|
|
|
uid: null,
|
|
|
iconUrl: 'http://img11.static.yhbimg.com/article/2017/08/23/10/0112f200ab5ae424173fa2df7a490c80bf.png?imageView/{mode}/w/{width}/h/{height}',
|
|
|
sourceName: 'green',
|
|
|
source: 4,
|
|
|
login: true
|
|
|
},
|
|
|
{
|
|
|
uid: null,
|
|
|
iconUrl: 'http://img12.static.yhbimg.com/article/2017/08/23/10/022279d464ee6bd9ef86089c60e2832210.png?imageView/{mode}/w/{width}/h/{height}',
|
|
|
sourceName: 'coffee',
|
|
|
source: 5,
|
|
|
login: true
|
|
|
},
|
|
|
{
|
|
|
uid: null,
|
|
|
iconUrl: 'http://img10.static.yhbimg.com/article/2017/08/23/10/01a1704bc87316008d769443a8ae50ad7e.png?imageView/{mode}/w/{width}/h/{height}',
|
|
|
sourceName: 'little',
|
|
|
source: 6,
|
|
|
login: true
|
|
|
}
|
|
|
]
|
|
|
};
|
|
|
_getAppList(uid) {
|
|
|
return family.get('vip/getUserVipInfo', {
|
|
|
uid: uid
|
|
|
}, {
|
|
|
code: 200
|
|
|
}).then((result => {
|
|
|
if (result && result.data && result.code === 200) {
|
|
|
let loginList = [];
|
|
|
let noLoginList = [];
|
|
|
let appList = [];
|
|
|
|
|
|
let loginList = [];
|
|
|
let noLoginList = [];
|
|
|
let appList = [];
|
|
|
_.forEach(result.data, function(val, key) {
|
|
|
val.nickname = key;
|
|
|
|
|
|
_.forEach(result.data, value => {
|
|
|
if (value.login === true) {
|
|
|
loginList.push(value);
|
|
|
} else {
|
|
|
noLoginList.push(value);
|
|
|
}
|
|
|
});
|
|
|
if (val.login === true) {
|
|
|
loginList.push(val);
|
|
|
} else {
|
|
|
noLoginList.push(val);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
loginList.sort(this._sourceSort('source'));
|
|
|
noLoginList.sort(this._sourceSort('source'));
|
|
|
loginList.sort(this._sourceSort('source'));
|
|
|
noLoginList.sort(this._sourceSort('source'));
|
|
|
|
|
|
appList = loginList.concat(noLoginList);
|
|
|
appList = loginList.concat(noLoginList);
|
|
|
|
|
|
return appList;
|
|
|
return appList;
|
|
|
}
|
|
|
}));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*查询各个体系成长等级信息及等级特权
|
|
|
*/
|
|
|
_getVipInfo(udid) {
|
|
|
return api.get('/yoho-family/vip/getVipInfo.json', {
|
|
|
return family.get('vip/getVipInfo.json', {
|
|
|
udid: udid
|
|
|
}, {
|
|
|
code: 200
|
|
|
}).then((result) => {
|
|
|
// result = {
|
|
|
// code: 200,
|
|
|
// data: {
|
|
|
// mars: {
|
|
|
// vipLevelList: [
|
|
|
// {
|
|
|
// growthValue: 100,
|
|
|
// level: 0,
|
|
|
// levelImg: "http://img01.yohomars.com/mars/2017/01/24/d1f9cb68a1e7aae4a1a6c4eeca7b1b0e.png?imageView/{mode}/w/{width}/h/{height}",
|
|
|
// marsPointDiscount: 100
|
|
|
// },
|
|
|
// {
|
|
|
// growthValue: 400,
|
|
|
// level: 1,
|
|
|
// levelImg: "http://img01.yohomars.com/mars/2017/01/24/5336ef84190a715bd221fca50a9e9e3d.png?imageView/{mode}/w/{width}/h/{height}",
|
|
|
// marsPointDiscount: 100
|
|
|
// },
|
|
|
// {
|
|
|
// growthValue: 1000,
|
|
|
// level: 2,
|
|
|
// levelImg: "http://img01.yohomars.com/mars/2017/01/24/1027321fcaf5311ab21963f925ecb0dd.png?imageView/{mode}/w/{width}/h/{height}",
|
|
|
// marsPointDiscount: 95,
|
|
|
// privilege: "mars points 9.5折兑换"
|
|
|
// },
|
|
|
// {
|
|
|
// growthValue: 2000,
|
|
|
// level: 3,
|
|
|
// levelImg: "http://img01.yohomars.com/mars/2017/01/24/e4512e2c5e78140170bf4967c4368645.png?imageView/{mode}/w/{width}/h/{height}",
|
|
|
// marsPointDiscount: 90,
|
|
|
// privilege: "mars points 9折兑换"
|
|
|
// },
|
|
|
// {
|
|
|
// growthValue: 5000,
|
|
|
// level: 4,
|
|
|
// levelImg: "http://img01.yohomars.com/mars/2017/01/24/312d0b334370eb8a9711065d489451ca.png?imageView/{mode}/w/{width}/h/{height}",
|
|
|
// marsPointDiscount: 85,
|
|
|
// privilege: "mars points 8.5折兑换"
|
|
|
// },
|
|
|
// {
|
|
|
// growthVaue: 10000,
|
|
|
// level: 5,
|
|
|
// levelImg: "http://img01.yohomars.com/mars/2017/01/24/148be1f69f64ebc1872c43b5b4b7e620.png?imageView/{mode}/w/{width}/h/{height}",
|
|
|
// marsPointDiscount: 80,
|
|
|
// privilege: "mars points 8折兑换"
|
|
|
// }
|
|
|
// ]
|
|
|
// },
|
|
|
// yohobuy: {
|
|
|
// privilegeList: [
|
|
|
// {
|
|
|
// description: "在原折扣基础上享受VIP折上折",
|
|
|
// id: 1,
|
|
|
// pic: "http://static.yohobuy.com/images/app/icon_2x_zhekou.png",
|
|
|
// title: "银卡会员购物9.5折"
|
|
|
// },
|
|
|
// {
|
|
|
// description: "在原折扣基础上享受VIP折上折",
|
|
|
// id: 2,
|
|
|
// pic: "http://static.yohobuy.com/images/app/icon_2x_zhekou.png",
|
|
|
// title: "金卡会员购物9.0折"
|
|
|
// },
|
|
|
// {
|
|
|
// description: "在原折扣基础上享受VIP折上折",
|
|
|
// id: 3,
|
|
|
// pic: "http://static.yohobuy.com/images/app/icon_2x_zhekou.png",
|
|
|
// title: "白金卡会员购物8.8折"
|
|
|
// },
|
|
|
// {
|
|
|
// description: "年度级的sale促销活动中,VIP会员可以享受优先购买权",
|
|
|
// id: 4,
|
|
|
// pic: "http://static.yohobuy.com/images/app/icon_2x_niandu.png",
|
|
|
// title: "年度活动优惠"
|
|
|
// },
|
|
|
// {
|
|
|
// description: "白金卡会员的订单将采用最快速度进行免费配送,金卡会员的订单免费配送",
|
|
|
// id: 5,
|
|
|
// pic: "http://static.yohobuy.com/images/app/icon_2x_kssd.png",
|
|
|
// title: "快速送达"
|
|
|
// },
|
|
|
// {
|
|
|
// description: "浏览《YOHO!潮流志》、《YOHO!GIRL》电子版,最新最权威的潮流资讯尽在掌握!",
|
|
|
// id: 6,
|
|
|
// pic: "http://static.yohobuy.com/images/app/icon_2x_zzzy.png",
|
|
|
// title: "电子杂志赠阅"
|
|
|
// },
|
|
|
// {
|
|
|
// description: "赠送生日优惠券",
|
|
|
// id: 8,
|
|
|
// pic: "http://static.yohobuy.com/images/app/icon_2x_sryh.png",
|
|
|
// title: "生日特惠"
|
|
|
// },
|
|
|
// {
|
|
|
// description: "获取大量潮流新品及优惠活动的信息",
|
|
|
// id: 9,
|
|
|
// pic: "http://static.yohobuy.com/images/app/icon_2x_yhxx.png",
|
|
|
// title: "优惠信息"
|
|
|
// },
|
|
|
// {
|
|
|
// description: "参加\"VIP会员限定\"活动",
|
|
|
// id: 10,
|
|
|
// pic: "http://static.yohobuy.com/images/app/icon_2x_vip.png",
|
|
|
// title: "VIP活动优惠"
|
|
|
// }
|
|
|
// ],
|
|
|
// vipLevelLis: [
|
|
|
// {
|
|
|
// growthValue: 0,
|
|
|
// level: 0,
|
|
|
// name: "普通会员",
|
|
|
// privilege: ""
|
|
|
// },
|
|
|
// {
|
|
|
// growthValue: 600,
|
|
|
// level: 1,
|
|
|
// name: "银卡会员",
|
|
|
// privilege: "1,4,10,6,8,9"
|
|
|
// },
|
|
|
// {
|
|
|
// growthValue: 2000,
|
|
|
// level: 2,
|
|
|
// name: "金卡会员",
|
|
|
// privilege: "2,4,10,5,6,8,9"
|
|
|
// },
|
|
|
// {
|
|
|
// growthValue: 5000,
|
|
|
// level: 3,
|
|
|
// name: "白金会员",
|
|
|
// privilege: "3,4,10,5,6,8,9"
|
|
|
// }
|
|
|
// ]
|
|
|
// }
|
|
|
// }
|
|
|
// };
|
|
|
|
|
|
if (result.data.mars && result.data.mars.vipLevelList.length > 0) {
|
|
|
_.forEach(result.data.mars.vipLevelList, function(val) {
|
...
|
...
|
@@ -305,77 +134,24 @@ class familyModel extends global.yoho.BaseModel { |
|
|
*查询当前用户各个体系成长等级信息及等级特权
|
|
|
*/
|
|
|
_getUserVipInfo(udid, uid) {
|
|
|
return api.get('/yoho-family/vip/getUserVipInfo.json', {
|
|
|
return family.get('vip/getUserVipInfo.json', {
|
|
|
udid: udid,
|
|
|
uid: uid
|
|
|
}, {
|
|
|
code: 200
|
|
|
}).then((result) => {
|
|
|
// result = {
|
|
|
// data: {
|
|
|
// mars: {
|
|
|
// growthValue: 2000,
|
|
|
// level: 4,
|
|
|
// nextLevel: 5,
|
|
|
// privilege: "mars points 8.5折兑换",
|
|
|
// valueToNextLevel: 3000
|
|
|
// },
|
|
|
// yohobuy: {
|
|
|
// growthValue: 1500,
|
|
|
// level: 1,
|
|
|
// name: "银卡会员",
|
|
|
// nextLevel: 2,
|
|
|
// valueToNextLevel: 500,
|
|
|
// privilege: [
|
|
|
// {
|
|
|
// description: "在原折扣基础上享受VIP折上折",
|
|
|
// id: 1,
|
|
|
// pic: "http://static.yohobuy.com/images/app/icon_2x_zhekou.png",
|
|
|
// title: "银卡会员购物9.5折"
|
|
|
// },
|
|
|
// {
|
|
|
// description: "年度级的sale促销活动中,VIP会员可以享受优先购买权",
|
|
|
// id: 4,
|
|
|
// pic: "http://static.yohobuy.com/images/app/icon_2x_niandu.png",
|
|
|
// title: "年度活动优惠"
|
|
|
// },
|
|
|
// {
|
|
|
// description: "浏览《YOHO!潮流志》、《YOHO!GIRL》电子版,最新最权威的潮流资讯尽在掌握!",
|
|
|
// id: 6,
|
|
|
// pic: "http://static.yohobuy.com/images/app/icon_2x_zzzy.png",
|
|
|
// title: "电子杂志赠阅"
|
|
|
// },
|
|
|
// {
|
|
|
// description: "赠送生日优惠券",
|
|
|
// id: 8,
|
|
|
// pic: "http://static.yohobuy.com/images/app/icon_2x_sryh.png",
|
|
|
// title: "生日特惠"
|
|
|
// },
|
|
|
// {
|
|
|
// description: "获取大量潮流新品及优惠活动的信息",
|
|
|
// id: 9,
|
|
|
// pic: "http://static.yohobuy.com/images/app/icon_2x_yhxx.png",
|
|
|
// title: "优惠信息"
|
|
|
// },
|
|
|
// {
|
|
|
// description: "参加\"VIP会员限定\"活动",
|
|
|
// id: 10,
|
|
|
// pic: "http://static.yohobuy.com/images/app/icon_2x_vip.png",
|
|
|
// title: "VIP活动优惠"
|
|
|
// }
|
|
|
// ]
|
|
|
// }
|
|
|
// }
|
|
|
// };
|
|
|
|
|
|
return result.data;
|
|
|
if (result && result.data) {
|
|
|
return result.data;
|
|
|
} else {
|
|
|
return {};
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*各个app的会员信息
|
|
|
*/
|
|
|
familyVip(udid, uid) {
|
|
|
familyVip(udid, uid, yohoApp, marsApp) {
|
|
|
return Promise.all([
|
|
|
this._getVipInfo(udid),
|
|
|
this._getUserVipInfo(udid, uid)
|
...
|
...
|
@@ -390,7 +166,15 @@ class familyModel extends global.yoho.BaseModel { |
|
|
});
|
|
|
|
|
|
if (key === 'yohobuy') {
|
|
|
if (val.growthValue <= 0) {
|
|
|
val.showLevel = true;
|
|
|
if (yohoApp) {
|
|
|
val.link = '//m.yohobuy.com/home/grade?openby:yohobuy={"action":"go.vipInfo"}';
|
|
|
} else if (marsApp) {
|
|
|
val.link = '//m.yohobuy.com/home/grade?openby:yohobuy={"action":"go.h5"}';
|
|
|
} else {
|
|
|
val.link = '//m.yohobuy.com/home/grade';
|
|
|
}
|
|
|
if (val.growthValue <= 0 || val.growthValue === null) {
|
|
|
val.percent = 0;
|
|
|
} else if (val.growthValue > 0 && val.growthValue < 800) {
|
|
|
val.percent = 17;
|
...
|
...
|
@@ -407,8 +191,14 @@ class familyModel extends global.yoho.BaseModel { |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
if (key === 'mars') {
|
|
|
if (yohoApp) {
|
|
|
val.link = 'yohomars://yohomars.com/goapp?openby:mars=""';
|
|
|
} else if (marsApp) {
|
|
|
val.link = '//m.yohobuy.com/home/grade?openby:yohobuy={"action":"go.h5"}';
|
|
|
} else {
|
|
|
val.link = 'yohomars://yohomars.com/goapp?openby:mars=""';
|
|
|
}
|
|
|
if (val.growthValue <= 100) {
|
|
|
val.percent = 0;
|
|
|
} else if (val.growthValue > 100 && val.growthValue < 400) {
|
...
|
...
|
@@ -497,9 +287,8 @@ class familyModel extends global.yoho.BaseModel { |
|
|
val.percent = 100;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
return result[1];
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -565,24 +354,45 @@ class familyModel extends global.yoho.BaseModel { |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 积分乐园数据
|
|
|
*/
|
|
|
integralCharts(uid) {
|
|
|
return family.get('user/getUserCoin', {
|
|
|
uid: uid
|
|
|
}, {
|
|
|
code: 200
|
|
|
}).then((result) => {
|
|
|
// if(result && result.data) {
|
|
|
// _.forEach(result.data, function(data) {
|
|
|
|
|
|
// });
|
|
|
// }
|
|
|
// console.log(result);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* family主页
|
|
|
*/
|
|
|
familyIndex(uid, contentCodeOne, contentCodeTwo) {
|
|
|
return Promise.all([
|
|
|
this._userData(uid),
|
|
|
this._getCode(uid),
|
|
|
this._getAppList(),
|
|
|
this._getAppList(uid),
|
|
|
this._getTrendPop(contentCodeOne),
|
|
|
this._getTrendPop(contentCodeTwo)
|
|
|
this._getTrendPop(contentCodeTwo),
|
|
|
this.integralCharts(uid)
|
|
|
]).then((result) => {
|
|
|
let familyIndexData = {};
|
|
|
|
|
|
if (result[0] && result[0].data) {
|
|
|
familyIndexData = _.assign(familyIndexData, {
|
|
|
head_ico: result[0].data.head_ico,
|
|
|
nickname: result[0].data.nickname,
|
|
|
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') : ''
|
|
|
birthday: result[0].data.birthday ? moment(result[0].data.birthday).format('MM-DD') : '',
|
|
|
province: result[0].data.province,
|
|
|
city: result[0].data.city
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
|