...
|
...
|
@@ -5,6 +5,8 @@ |
|
|
*/
|
|
|
'use strict';
|
|
|
const serviceAPI = global.yoho.ServiceAPI;
|
|
|
const api = global.yoho.API;
|
|
|
const _ = require('lodash');
|
|
|
|
|
|
const URI_PACKAGE_ARTICLE = 'guang/service/v2/article/';
|
|
|
const URI_PACKAGE_AUTHOR = 'guang/service/v1/author/';
|
...
|
...
|
@@ -82,6 +84,14 @@ const packageData = (id, isApp) => { |
|
|
cache: true
|
|
|
}));
|
|
|
|
|
|
if (isApp) {
|
|
|
promises.push(api.get('', {
|
|
|
method: 'app.resources.getSingleTemplate',
|
|
|
module: 'wechat',
|
|
|
key: 'guang_detail_wechat'
|
|
|
}));
|
|
|
}
|
|
|
|
|
|
// 获取资讯相关的其它资讯
|
|
|
if (typeof article.tag !== 'undefined') {
|
|
|
param = {
|
...
|
...
|
@@ -99,11 +109,29 @@ const packageData = (id, isApp) => { |
|
|
}));
|
|
|
}
|
|
|
return Promise.all(promises).then(datas => {
|
|
|
let getArticleContent = datas[1].data;
|
|
|
|
|
|
if (datas[3].data) {
|
|
|
|
|
|
let preCount = 0;
|
|
|
let frontData = [];
|
|
|
let backData = [];
|
|
|
let i;
|
|
|
|
|
|
for(i = 0; i < getArticleContent.length; i++) {
|
|
|
if (getArticleContent[i].singleImage || getArticleContent[i].text || getArticleContent[i].smallPic) {
|
|
|
preCount++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
getArticleContent.splice(preCount, 0, {weixinPublic: datas[3].data});
|
|
|
}
|
|
|
|
|
|
result.getAuthor = datas[0].data;
|
|
|
result.getArticleContent = datas[1].data;
|
|
|
result.getArticleContent = getArticleContent;
|
|
|
result.getBrand = datas[2].data;
|
|
|
if (datas.length === 4) {
|
|
|
result.getOtherArticle = datas[3].data;
|
|
|
if (datas.length === 5) {
|
|
|
result.getOtherArticle = datas[4].data;
|
|
|
}
|
|
|
return result;
|
|
|
});
|
...
|
...
|
|