Authored by yyq

异常处理

@@ -180,36 +180,33 @@ exports.getOutletsChannelData = (params, channel) => { @@ -180,36 +180,33 @@ exports.getOutletsChannelData = (params, channel) => {
180 exports.getOutletsSpecialData = (params, channel) => { 180 exports.getOutletsSpecialData = (params, channel) => {
181 return api.all([ 181 return api.all([
182 headerModel.requestHeaderData('outlets'), 182 headerModel.requestHeaderData('outlets'),
183 - outletsApi.getOutletsActivityOrigin({ 183 + outletsApi.getOutletsActivityOrigin({ // 获取活动信息
184 id: params.id 184 id: params.id
185 }) 185 })
186 ]).then(result => { 186 ]).then(result => {
187 let specialData = {}; 187 let specialData = {};
188 188
189 - specialData.headerData = {};  
190 - specialData.headerData = result[0].headerData;  
191 - specialData.headerData.header = true; 189 + Object.assign(specialData, result[0]);
192 specialData.headerData.headType = 'outlets'; 190 specialData.headerData.headType = 'outlets';
193 191
194 - specialData.pageErr = true;  
195 - if (result[1].code === 200) {  
196 - delete specialData.pageErr;  
197 - Object.assign(specialData,  
198 - outletsProcess.handleOutletsSpecilData(result[1].data[0]));  
199 -  
200 - return api.all([  
201 - list.getListData(Object.assign({  
202 - productPool: result[1].data[0].productPoolId,  
203 - saleType: 4  
204 - }, params), channel)  
205 - ]).then(data => {  
206 - specialData.specialHead.count = data[0].totalCount;  
207 - Object.assign(specialData, data[0]);  
208 - return specialData;  
209 - }); 192 + if (result[1].code !== 200) {
  193 + // 活动信息获取异常
  194 + throw new Error('fail_to_get_special_info_with_ID:' + params.id);
210 } 195 }
211 196
212 - return specialData; 197 + Object.assign(specialData,
  198 + outletsProcess.handleOutletsSpecilData(result[1].data[0]));
  199 +
  200 + return api.all([
  201 + list.getListData(Object.assign({
  202 + productPool: result[1].data[0].productPoolId,
  203 + saleType: 4
  204 + }, params), channel)
  205 + ]).then(data => {
  206 + specialData.specialHead.count = data[0].totalCount;
  207 + Object.assign(specialData, data[0]);
  208 + return specialData;
  209 + });
213 }); 210 });
214 }; 211 };
215 212