Authored by OF1706

头部用户更新

... ... @@ -39,23 +39,28 @@ const index = (req, res, next) => {
// 个人信息调用失败返回
if (profile) {
userInfo.result = 1;
// userInfo.result = 1;
console.log(profile);
Object.assign(userInfo, {
let curYearCost = parseInt( _.get(profile, 'vip_info.curYearCost', 0));
let nextVipNeedCost = parseInt( _.get(profile, 'vip_info.nextVipNeedCost', 0));
Object.assign(userInfo, {
// 个人资料
profileName: _.get(profile, 'profile_name', ''),
headIco: !_.get(profile, 'head_ico') ? helpers.image(_.get(profile, 'head_ico'), 63, 63) : '',
curTitle: _.get(profile, 'vip_info.title', 0),
// VIP信息
curYearCost: _.get(profile, 'vip_info.curYearCost', 0),
curYearCost: curYearCost,
nextLevel: _.get(profile, 'vip_info.next_level', 0),
nextVipTitle: _.get(profile, 'vip_info.nextVipTitle', 0),
nextVipNeedCost: _.get(profile, 'vip_info.nextVipNeedCost', 0),
nextVipNeedCost: nextVipNeedCost,
// 升级百分比
curYearCostPer: userInfo.nextVipNeedCost ?
Math.round(profile.curYearCost / profile.nextVipNeedCost * 100) : 0,
curYearCostPer: nextVipNeedCost ?
Math.round(curYearCost / (nextVipNeedCost + curYearCost)* 100): 0,
// 待处理订单
order: _.get(userNum, 'wait_pay_num + wait_cargo_num + send_cargo_num', 0),
... ...