...
|
...
|
@@ -5,7 +5,9 @@ const moment = require('moment'); |
|
|
const camelCase = global.yoho.camelCase;
|
|
|
const api = global.yoho.API;
|
|
|
const service = global.yoho.ServiceAPI;
|
|
|
const resourcesProcess = require(`${utils}/resources-process`);
|
|
|
const resourcesProcess = require(`${global.utils}/resources-process`);
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const crypto = global.yoho.crypto;
|
|
|
|
|
|
class familyModel extends global.yoho.BaseModel {
|
|
|
constructor(ctx) {
|
...
|
...
|
@@ -454,32 +456,37 @@ class familyModel extends global.yoho.BaseModel { |
|
|
}
|
|
|
|
|
|
userInfo(params) {
|
|
|
let options = {
|
|
|
data: {
|
|
|
method: 'app.passport.profile',
|
|
|
uid: params.uid
|
|
|
},
|
|
|
param: {
|
|
|
code: 200
|
|
|
}
|
|
|
};
|
|
|
|
|
|
return this.get(options).then(result => {
|
|
|
return Promise.all([
|
|
|
this._userData(params.uid),
|
|
|
this._getCode(params.uid)
|
|
|
]).then(result => {
|
|
|
let resu = {};
|
|
|
|
|
|
if (_.get(result, 'data')) {
|
|
|
let thisGender = result.data.gender;
|
|
|
if (_.get(result, '[0].data')) {
|
|
|
let thisGender = result[0].data.gender;
|
|
|
|
|
|
result.data.gender = (thisGender === '1' ? '男' : '女');
|
|
|
result.data.otherGender = (thisGender === '1' ? '女' : '男');
|
|
|
if (result.data.gender === '男') {
|
|
|
result.data.genderId = 1;
|
|
|
result.data.otherGenderId = 2;
|
|
|
result[0].data.gender = (thisGender === '1' ? '男' : '女');
|
|
|
result[0].data.otherGender = (thisGender === '1' ? '女' : '男');
|
|
|
if (result[0].data.gender === '男') {
|
|
|
result[0].data.genderId = 1;
|
|
|
result[0].data.otherGenderId = 2;
|
|
|
} else {
|
|
|
result.data.genderId = 2;
|
|
|
result.data.otherGenderId = 1;
|
|
|
result[0].data.genderId = 2;
|
|
|
result[0].data.otherGenderId = 1;
|
|
|
}
|
|
|
result[0].data.qrcodeLink = helpers.urlFormat('/home/user/qrcode', {
|
|
|
token: _.get(result[0], 'data.uid', null) ?
|
|
|
crypto.encryption('yoho9646yoho9646', _.get(result, 'data.uid', null) + '') : '',
|
|
|
icon: _.get(result[0], 'data.head_ico', ''),
|
|
|
uname: _.get(result[0], 'data.nickname', ''),
|
|
|
vip: _.get(result[0], 'data.vip_info.cur_level')
|
|
|
});
|
|
|
resu = camelCase(result[0].data);
|
|
|
}
|
|
|
resu = camelCase(result.data);
|
|
|
if (_.get(result, '[1].data')) {
|
|
|
Object.assign(resu, {
|
|
|
trendWord: result[1].data.trendWord
|
|
|
});
|
|
|
}
|
|
|
return resu;
|
|
|
});
|
...
|
...
|
@@ -492,7 +499,9 @@ class familyModel extends global.yoho.BaseModel { |
|
|
uid: params.uid,
|
|
|
nick_name: params.nickName,
|
|
|
gender: params.gender,
|
|
|
birthday: params.birthday
|
|
|
birthday: params.birthday,
|
|
|
height: params.height,
|
|
|
weight: params.weight
|
|
|
},
|
|
|
param: {
|
|
|
code: 200
|
...
|
...
|
@@ -500,6 +509,7 @@ class familyModel extends global.yoho.BaseModel { |
|
|
};
|
|
|
|
|
|
return this.get(options).then(result => {
|
|
|
console.log(result);
|
|
|
return result;
|
|
|
});
|
|
|
}
|
...
|
...
|
|