...
|
...
|
@@ -34,8 +34,8 @@ const getRssArticle = (gender) => { |
|
|
break;
|
|
|
}
|
|
|
return articlePromise.then((article) => {
|
|
|
// 内容列表
|
|
|
if (article.data.list.artList) {
|
|
|
// 内容列表
|
|
|
if (article && article.data && article.data.list && article.data.list.artList) {
|
|
|
let build = {};
|
|
|
|
|
|
let artListFunc = (i, len, resolve) => {
|
...
|
...
|
@@ -43,22 +43,22 @@ const getRssArticle = (gender) => { |
|
|
let value = article.data.list.artList[i];
|
|
|
if (typeof value.id !== 'undefined') {
|
|
|
build = guangProcess.formatArticle(value, false, false, true);
|
|
|
build.author.name = build.author.name || '';
|
|
|
build.author.name = (build.author && build.author.name) || '';
|
|
|
return _genIntro(value.id).then((intro) => {
|
|
|
build.intro = intro;
|
|
|
result.push(build);
|
|
|
artListFunc(++i, len, resolve);
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
resolve(result);
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
};
|
|
|
return new Promise((resolve) => {
|
|
|
artListFunc(0, article.data.list.artList.length, resolve);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
@@ -75,20 +75,20 @@ const _genIntro = (id) => { |
|
|
resData.data.forEach((value) => {
|
|
|
if (value.text) { // 文字
|
|
|
result += htmlProcess.removeHtml(htmlProcess.escapeToHtml(value.text.data.text)) + '<br/>';
|
|
|
} else if (value.singleImage) { // 单张图
|
|
|
result += `<img src="${helpers.image(value.singleImage.data[0].src, 640, 640)}"/><br/>`;
|
|
|
} else if (value.smallPic && value.smallPic.data) { // 多张小图
|
|
|
value.smallPic.data.forEach((small) => {
|
|
|
result += `<img src="${helpers.image(small.src, 315, 420)}"/>`;
|
|
|
});
|
|
|
result += '<br/>';
|
|
|
}
|
|
|
});
|
|
|
} else if (value.singleImage) { // 单张图
|
|
|
result += `<img src="${helpers.image(value.singleImage.data[0].src, 640, 640)}"/><br/>`;
|
|
|
} else if (value.smallPic && value.smallPic.data) { // 多张小图
|
|
|
value.smallPic.data.forEach((small) => {
|
|
|
result += `<img src="${helpers.image(small.src, 315, 420)}"/>`;
|
|
|
});
|
|
|
result += '<br/>';
|
|
|
}
|
|
|
});
|
|
|
return result;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
};
|
|
|
module.exports = {
|
|
|
getRssArticle
|
|
|
}; |
|
|
}; |
|
|
\ No newline at end of file |
...
|
...
|
|