Authored by yyq

outlets error 处理

... ... @@ -8,6 +8,8 @@
const mRoot = '../models';
const outlets = require(`${mRoot}/outlets`);
const _ = require('lodash');
/**
* outlets 首页
* @param {[type]} req [description]
... ... @@ -61,8 +63,9 @@ exports.special = (req, res, next) => {
page: 'outlets'
};
if (!params.id) {
resData.pageErr = true;
// 判断活动id是否合法
if (!params.id || !+params.id || !_.isNumber(+params.id)) {
return next();
}
outlets.getOutletsSpecialData(params, channel).then(result => {
... ...
... ... @@ -134,7 +134,7 @@ exports.getOutletsIndexData = (params, channel) => {
exports.getOutletsChannelData = (params, channel) => {
// 频道资源位不存在
if (!channelCode[channel]) {
throw new Error('outlets channel resource not found');
return Promise.reject(`outlets channel-(${channel}) resource not found`);
}
let channelData = {};
... ... @@ -242,7 +242,7 @@ exports.getOutletsSpecialData = (params, channel) => {
// 活动信息获取异常
if (result[1].code !== 200) {
throw new Error('outlets special info not found-(ID:' + params.id + ')');
return Promise.reject(`outlets special info not found-(ID:${params.id})`);
}
Object.assign(specialData,
... ...