...
|
...
|
@@ -2,7 +2,6 @@ |
|
|
const api = global.yoho.API;
|
|
|
const serviceAPI = global.yoho.ServiceAPI;
|
|
|
const Promise = require('bluebird');
|
|
|
const _ = require('lodash');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -15,6 +14,8 @@ const _getUserProfileData = exports.getUserProfileData = (uid) => { |
|
|
return api.get('', {
|
|
|
uid: uid,
|
|
|
method: 'app.passport.profile'
|
|
|
}, {
|
|
|
code: 200
|
|
|
}).then(result => {
|
|
|
return result.data;
|
|
|
});
|
...
|
...
|
@@ -30,9 +31,13 @@ const _getInfoNumData = (uid) => { |
|
|
return api.all([api.get('', {
|
|
|
uid: uid,
|
|
|
method: 'app.home.getInfoNum' // 收藏及订单数目数据
|
|
|
}, {
|
|
|
code: 200
|
|
|
}), api.get('', {
|
|
|
uid: uid,
|
|
|
method: 'app.address.gethidden' // 用户地址的数据
|
|
|
}, {
|
|
|
code: 200
|
|
|
})]).then(data => {
|
|
|
let res = {
|
|
|
wait_pay_num: '',
|
...
|
...
|
@@ -44,22 +49,18 @@ const _getInfoNumData = (uid) => { |
|
|
yoho_coin_num: ''
|
|
|
};
|
|
|
|
|
|
if (data[0].data) {
|
|
|
for (let k in data[0].data) {
|
|
|
if (res[k] !== null) {
|
|
|
res[k] = data[0].data[k] ? data[0].data[k] : '';
|
|
|
if (k !== 'yoho_coin_num' && res[k] > 99) {
|
|
|
res[k] = '99+';
|
|
|
}
|
|
|
for (let k in data[0].data) {
|
|
|
if (res[k] !== null) {
|
|
|
res[k] = data[0].data[k] ? data[0].data[k] : '';
|
|
|
if (k !== 'yoho_coin_num' && res[k] > 99) {
|
|
|
res[k] = '99+';
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (data[1].data) {
|
|
|
res = _.merge(res, {
|
|
|
address_num: data[1].data.length ? data[1].data.length : ''
|
|
|
});
|
|
|
}
|
|
|
return res;
|
|
|
|
|
|
return Object.assign(res, {
|
|
|
address_num: data[1].data.length ? data[1].data.length : ''
|
|
|
});
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
@@ -86,12 +87,14 @@ exports.getHelpInfo = (data) => { |
|
|
},
|
|
|
infoData = Object.assign(defaultParam, data);
|
|
|
|
|
|
return api.get('', infoData).then(result => {
|
|
|
return api.get('', infoData, {
|
|
|
code: 200
|
|
|
}).then(result => {
|
|
|
var helpData = result.data;
|
|
|
var formatData = [];
|
|
|
|
|
|
helpData = helpData || [];
|
|
|
_.forEach(helpData, (item) => {
|
|
|
helpData.forEach(function(item) {
|
|
|
formatData.push({
|
|
|
name: item.caption,
|
|
|
code: item.code,
|
...
|
...
|
@@ -117,9 +120,9 @@ exports.getHelpDetail = (data) => { |
|
|
},
|
|
|
detailData = Object.assign(defaultParam, data);
|
|
|
|
|
|
return api.get('', detailData).then(result => {
|
|
|
return result;
|
|
|
});
|
|
|
return api.get('', detailData, {
|
|
|
code: 200
|
|
|
}).then(result => result);
|
|
|
};
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -149,7 +152,5 @@ exports.saveMydetails = (params) => { |
|
|
},
|
|
|
data = Object.assign(defaultParam, params);
|
|
|
|
|
|
return api.get('', data).then(result => {
|
|
|
return result;
|
|
|
});
|
|
|
return api.get('', data).then(result => result);
|
|
|
}; |
...
|
...
|
|