Authored by OF1706

header api add channel

@@ -191,11 +191,14 @@ const setHeaderData = (resData, type) => ( @@ -191,11 +191,14 @@ const setHeaderData = (resData, type) => (
191 ); 191 );
192 192
193 193
194 -const getHotSearchAsync = () => {  
195 - return api.get('', {method: 'app.search.getTerms'}, { 194 +const getHotSearchAsync = (channel) => {
  195 +
  196 + return api.get('', {method: 'app.search.getTerms',yh_channel: channel}, {
196 cache: 600, 197 cache: 600,
197 code: 200 198 code: 200
198 }); 199 });
  200 +
  201 +
199 }; 202 };
200 203
201 const getHeaderNavAsync = () => { 204 const getHeaderNavAsync = () => {
@@ -215,9 +218,24 @@ exports.requestHeaderData = (type) => { @@ -215,9 +218,24 @@ exports.requestHeaderData = (type) => {
215 218
216 type = type || 'boys'; 219 type = type || 'boys';
217 220
  221 + let channelNum = (function() {
  222 + switch (type) {
  223 + case 'boys':
  224 + return 1;
  225 + case 'girls':
  226 + return 2;
  227 + case 'kids':
  228 + case 'lifestyle':
  229 + return 3;
  230 + default:
  231 + return 1;
  232 + }
  233 + }());
  234 +
218 return Promise.all([ 235 return Promise.all([
219 getHeaderNavAsync(), 236 getHeaderNavAsync(),
220 - getHotSearchAsync() 237 + getHotSearchAsync(channelNum)
  238 +
221 ]).then(res => { 239 ]).then(res => {
222 resData.headerData = {}; 240 resData.headerData = {};
223 241