Authored by biao

update for get by contentcode

@@ -24,8 +24,9 @@ exports.index = (req, res) => { @@ -24,8 +24,9 @@ exports.index = (req, res) => {
24 let headerData = headerModel.setNavHeader('OUTLET', channel, true, '', null); 24 let headerData = headerModel.setNavHeader('OUTLET', channel, true, '', null);
25 let categoryId = req.query.category_id; 25 let categoryId = req.query.category_id;
26 let yhChannel = req.query.yh_channel || 1; 26 let yhChannel = req.query.yh_channel || 1;
  27 + let contentcode = req.query.content_code;
27 28
28 - outletModel.getContent(categoryId, yhChannel).then(result => { 29 + outletModel.getContent(categoryId, yhChannel, contentcode).then(result => {
29 res.render('outlet', Object.assign({ 30 res.render('outlet', Object.assign({
30 page: 'outlet', 31 page: 'outlet',
31 pageHeader: headerData, 32 pageHeader: headerData,
@@ -22,9 +22,10 @@ const serviceApi = new ServiceAPI(); @@ -22,9 +22,10 @@ const serviceApi = new ServiceAPI();
22 const api = new API(); 22 const api = new API();
23 23
24 24
25 -const getOutletResource = (channel) => { 25 +const getOutletResource = (channel, contentcode) => {
  26 + console.log(contentcode);
26 const params = { 27 const params = {
27 - content_code: 'c19ffa03f053f4cac3690b22c8da26b7', 28 + content_code: contentcode || 'c19ffa03f053f4cac3690b22c8da26b7',
28 limit: 25, 29 limit: 25,
29 yh_channel: channel || '', 30 yh_channel: channel || '',
30 debug: 'XYZ' 31 debug: 'XYZ'
@@ -58,8 +59,7 @@ const convertNavData = (list) => { @@ -58,8 +59,7 @@ const convertNavData = (list) => {
58 const getNavData = (categoryId) => { 59 const getNavData = (categoryId) => {
59 const params = { 60 const params = {
60 v: 7, 61 v: 7,
61 - parent_id: categoryId,  
62 - debug: 'XYZ' 62 + parent_id: categoryId
63 }; 63 };
64 64
65 return serviceApi.get('operations/api/v6/category/getCategory', sign.apiSign(params)).then(result => { 65 return serviceApi.get('operations/api/v6/category/getCategory', sign.apiSign(params)).then(result => {
@@ -137,7 +137,6 @@ const getHomeActivity = (data) => { @@ -137,7 +137,6 @@ const getHomeActivity = (data) => {
137 var params = { 137 var params = {
138 method: 'app.outlets.activityGet', 138 method: 'app.outlets.activityGet',
139 platform: 2, 139 platform: 2,
140 - size: 0,  
141 sort: 2, 140 sort: 2,
142 client_type: 'h5' 141 client_type: 'h5'
143 }; 142 };
@@ -147,19 +146,16 @@ const getHomeActivity = (data) => { @@ -147,19 +146,16 @@ const getHomeActivity = (data) => {
147 }); 146 });
148 }; 147 };
149 148
150 -exports.getContent = (categoryId, channel) => { 149 +exports.getContent = (categoryId, channel, code) => {
151 let floorsData = {}, 150 let floorsData = {},
152 params = { 151 params = {
153 type: 0, 152 type: 0,
154 id: 0 153 id: 0
155 }; 154 };
156 155
157 - if (channel === 'boys') {  
158 - params.yh_channel = 1;  
159 - }  
160 - const promises = [getNavData(categoryId), getOutletResource(channel), getHomeActivity(params), getGoodsList()]; 156 + const p = [getNavData(categoryId), getOutletResource(channel, code), getHomeActivity(params), getGoodsList()];
161 157
162 - return Promise.all(promises).then(data => { 158 + return Promise.all(p).then(data => {
163 floorsData.nav = data[0] || []; 159 floorsData.nav = data[0] || [];
164 floorsData.content = data[1] || []; 160 floorsData.content = data[1] || [];
165 floorsData.activity = {data: data[2]}; 161 floorsData.activity = {data: data[2]};
@@ -186,10 +182,6 @@ exports.getNearlyActivity = (channel, type, categoryId) => { @@ -186,10 +182,6 @@ exports.getNearlyActivity = (channel, type, categoryId) => {
186 type: type 182 type: type
187 }; 183 };
188 184
189 - if (channel === 'boys') {  
190 - params.yh_channel = 1;  
191 - }  
192 -  
193 return Promise.all([getNavData(categoryId), getHomeActivity(params)]).then(res => { 185 return Promise.all([getNavData(categoryId), getHomeActivity(params)]).then(res => {
194 var data = { 186 var data = {
195 nav: res[0] || [], 187 nav: res[0] || [],