|
|
'use strict';
|
|
|
const api = global.yoho.ServiceAPI;
|
|
|
const api = global.yoho.API;
|
|
|
const Promise = require('bluebird');
|
|
|
const co = Promise.coroutine;
|
|
|
const _ = require('lodash');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
|
|
|
/**
|
|
|
* 处理用户个人详情数据
|
...
|
...
|
@@ -12,7 +14,7 @@ const co = Promise.coroutine; |
|
|
const _getUserProfileData = (uid) => {
|
|
|
return co(function*() {
|
|
|
// 调用接口获取个人详情
|
|
|
const data = {}
|
|
|
const data = {};
|
|
|
return data;
|
|
|
|
|
|
// return api.get('operations/api/v5/resource/get', {
|
...
|
...
|
@@ -40,12 +42,68 @@ const _getInfoNumData = (uid) => { |
|
|
product_favorite_total: 5,
|
|
|
brand_favorite_total: 6,
|
|
|
yoho_coin_num: 7
|
|
|
}
|
|
|
};
|
|
|
return data;
|
|
|
})();
|
|
|
|
|
|
}
|
|
|
};
|
|
|
|
|
|
exports.getUserHomeData = (uid) => {
|
|
|
return Promise.all([_getUserProfileData(uid), _getInfoNumData(uid)]);
|
|
|
} |
|
|
\ No newline at end of file |
|
|
};
|
|
|
|
|
|
const helpListDataProc = (helpData) => {
|
|
|
const formatData = [];
|
|
|
|
|
|
helpData = helpData || [];
|
|
|
_.forEach(helpData, (item) => {
|
|
|
formatData.push({
|
|
|
name: item.caption,
|
|
|
code: item.code,
|
|
|
url: helpers.urlFormat('/home/helpDetail', {
|
|
|
code: item.code,
|
|
|
caption: item.caption,
|
|
|
})
|
|
|
});
|
|
|
});
|
|
|
return formatData;
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 帮助中心
|
|
|
*
|
|
|
* @param req
|
|
|
* @param res
|
|
|
* @param next
|
|
|
*/
|
|
|
|
|
|
let home = {
|
|
|
getHelpInfo(data) {
|
|
|
var defaultParam = {
|
|
|
method: 'app.help.li'
|
|
|
},
|
|
|
infoData = Object.assign(defaultParam, data);
|
|
|
|
|
|
return api.get('', infoData).then(result => {
|
|
|
|
|
|
return helpListDataProc(result.data);
|
|
|
});
|
|
|
},
|
|
|
|
|
|
getHelpDetail(data) {
|
|
|
var defaultParam = {
|
|
|
method: 'app.help.detail',
|
|
|
return_type: 'html'
|
|
|
},
|
|
|
detailData = Object.assign(defaultParam, data);
|
|
|
|
|
|
return api.get('', detailData).then(result => {
|
|
|
console.log(result);
|
|
|
return result;
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
module.exports = home; |
...
|
...
|
|