...
|
...
|
@@ -6,7 +6,6 @@ |
|
|
'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/';
|
...
|
...
|
@@ -84,14 +83,6 @@ 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 = {
|
...
|
...
|
@@ -108,10 +99,19 @@ const packageData = (id, isApp) => { |
|
|
cache: true
|
|
|
}));
|
|
|
}
|
|
|
|
|
|
if (isApp) {
|
|
|
promises.push(api.get('', {
|
|
|
method: 'app.resources.getSingleTemplate',
|
|
|
module: 'wechat',
|
|
|
key: 'guang_detail_wechat'
|
|
|
}));
|
|
|
}
|
|
|
|
|
|
return Promise.all(promises).then(datas => {
|
|
|
let getArticleContent = datas[1].data;
|
|
|
|
|
|
if (datas[3].data) {
|
|
|
if (isApp && datas[4].data) {
|
|
|
|
|
|
let preCount = 0;
|
|
|
let i;
|
...
|
...
|
@@ -122,14 +122,14 @@ const packageData = (id, isApp) => { |
|
|
}
|
|
|
}
|
|
|
|
|
|
getArticleContent.splice(preCount, 0, {weixinPublic: datas[3].data});
|
|
|
getArticleContent.splice(preCount, 0, {weixinPublic: datas[4].data});
|
|
|
}
|
|
|
|
|
|
result.getAuthor = datas[0].data;
|
|
|
result.getArticleContent = getArticleContent;
|
|
|
result.getBrand = datas[2].data;
|
|
|
if (datas.length === 5) {
|
|
|
result.getOtherArticle = datas[4].data;
|
|
|
if (datas.length === 5 && isApp || datas.length === 4 && !isApp) {
|
|
|
result.getOtherArticle = datas[3].data;
|
|
|
}
|
|
|
return result;
|
|
|
});
|
...
|
...
|
|