Authored by 王水玲

Merge branch 'feature/sale' of http://git.dev.yoho.cn/web/yohobuywap-node into feature/sale

... ... @@ -140,7 +140,7 @@ const special = (params) => {
return api.get('', sign.apiSign(Object.assign({
method: 'app.activity.get',
sort: 2,
plateform: 2
plateform: 3
}, params)));
};
... ... @@ -204,6 +204,12 @@ const searchSales = (params) => {
* @return {[array]}
*/
const getUserProfile = (uid) => {
if (!uid) {
return Promise.resolve({
code: 200,
data: {}
});
}
return api.get('', sign.apiSign({
method: 'app.passport.profile',
uid: uid
... ... @@ -211,6 +217,30 @@ const getUserProfile = (uid) => {
};
/**
* 获取商品数据
*/
exports.getSearchData = (params, uid) => {
return Promise.all([
searchSales(params).then((result) => {
if (result && result.code === 200) {
return productProcess.processProductList(result.data.product_list || []);
} else {
logger.error('SALE 商品搜索返回 code 不是 200');
return [];
}
}),
getUserProfile(uid).then((result) => {
if (result && result.code === 200) {
return result.data.vip_info ? camelCase(result.data.vip_info) : {};
} else {
logger.error('获取用户信息返回 code 不是 200');
return {};
}
})
]);
};
/**
* 获取资源位数据
* @param {[string]} page
* @return {[array]}
... ...