Authored by 郭成尧

店铺商品列表

@@ -5,11 +5,14 @@ @@ -5,11 +5,14 @@
5 * Time: 13:51 5 * Time: 13:51
6 */ 6 */
7 'use strict'; 7 'use strict';
  8 +const path = require('path');
8 const api = global.yoho.API; 9 const api = global.yoho.API;
9 const helpers = global.yoho.helpers; 10 const helpers = global.yoho.helpers;
10 const brandApi = require('./brand-api'); 11 const brandApi = require('./brand-api');
11 const logger = global.yoho.logger; 12 const logger = global.yoho.logger;
12 const _ = require('lodash'); 13 const _ = require('lodash');
  14 +const processProductList = require(path.join(global.utils, '/beautify/product')).processProductList;
  15 +const camelCase = global.yoho.camelCase;
13 16
14 /** 17 /**
15 * 处理品牌一览品牌列表数据 18 * 处理品牌一览品牌列表数据
@@ -111,13 +114,18 @@ const getBrandData = params => { @@ -111,13 +114,18 @@ const getBrandData = params => {
111 const getBrandShopGoodsData = params => { 114 const getBrandShopGoodsData = params => {
112 let finalResult = {}; 115 let finalResult = {};
113 116
114 - /* TODO 获取店铺商品暂时没有接口 */  
115 return api.all([brandApi.getBrandShopGoodsOriginData(params)]).then(result => { 117 return api.all([brandApi.getBrandShopGoodsOriginData(params)]).then(result => {
116 if (result[0].code === 200) { 118 if (result[0].code === 200) {
117 - return finalResult; 119 + Object.assign(finalResult, {
  120 + data: {
  121 + productList: processProductList(result[0].data.productList)
  122 + }
  123 + });
118 } else { 124 } else {
119 logger.error('getBrandShopGoodsOriginData api code no 200'); 125 logger.error('getBrandShopGoodsOriginData api code no 200');
120 } 126 }
  127 +
  128 + return camelCase(finalResult);
121 }); 129 });
122 }; 130 };
123 131
@@ -127,8 +135,6 @@ const getBrandShopGoodsData = params => { @@ -127,8 +135,6 @@ const getBrandShopGoodsData = params => {
127 * @returns {*|Promise.<TResult>} 135 * @returns {*|Promise.<TResult>}
128 */ 136 */
129 const collectShopData = params => { 137 const collectShopData = params => {
130 -  
131 - /* TODO 收藏店铺接口返回状态处理 */  
132 return api.all([brandApi.collectShopOriginData(params)]).then(result => { 138 return api.all([brandApi.collectShopOriginData(params)]).then(result => {
133 return result[0]; 139 return result[0];
134 }); 140 });