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) => { @@ -140,7 +140,7 @@ const special = (params) => {
140 return api.get('', sign.apiSign(Object.assign({ 140 return api.get('', sign.apiSign(Object.assign({
141 method: 'app.activity.get', 141 method: 'app.activity.get',
142 sort: 2, 142 sort: 2,
143 - plateform: 2 143 + plateform: 3
144 }, params))); 144 }, params)));
145 }; 145 };
146 146
@@ -204,6 +204,12 @@ const searchSales = (params) => { @@ -204,6 +204,12 @@ const searchSales = (params) => {
204 * @return {[array]} 204 * @return {[array]}
205 */ 205 */
206 const getUserProfile = (uid) => { 206 const getUserProfile = (uid) => {
  207 + if (!uid) {
  208 + return Promise.resolve({
  209 + code: 200,
  210 + data: {}
  211 + });
  212 + }
207 return api.get('', sign.apiSign({ 213 return api.get('', sign.apiSign({
208 method: 'app.passport.profile', 214 method: 'app.passport.profile',
209 uid: uid 215 uid: uid
@@ -211,6 +217,30 @@ const getUserProfile = (uid) => { @@ -211,6 +217,30 @@ const getUserProfile = (uid) => {
211 }; 217 };
212 218
213 /** 219 /**
  220 + * 获取商品数据
  221 + */
  222 +exports.getSearchData = (params, uid) => {
  223 + return Promise.all([
  224 + searchSales(params).then((result) => {
  225 + if (result && result.code === 200) {
  226 + return productProcess.processProductList(result.data.product_list || []);
  227 + } else {
  228 + logger.error('SALE 商品搜索返回 code 不是 200');
  229 + return [];
  230 + }
  231 + }),
  232 + getUserProfile(uid).then((result) => {
  233 + if (result && result.code === 200) {
  234 + return result.data.vip_info ? camelCase(result.data.vip_info) : {};
  235 + } else {
  236 + logger.error('获取用户信息返回 code 不是 200');
  237 + return {};
  238 + }
  239 + })
  240 + ]);
  241 +};
  242 +
  243 +/**
214 * 获取资源位数据 244 * 获取资源位数据
215 * @param {[string]} page 245 * @param {[string]} page
216 * @return {[array]} 246 * @return {[array]}