...
|
...
|
@@ -190,8 +190,8 @@ const _processHeadData = (list) => { |
|
|
}
|
|
|
});
|
|
|
|
|
|
// newData.headData.time = newData.headData.time.replace(/-/g, '/');
|
|
|
// newData.headData.time = newData.headData.time.replace(':00', '', 2);
|
|
|
newData.headData.time = newData.headData.time.replace(/-/g, '/');
|
|
|
newData.headData.time = newData.headData.time.replace(':00', '', 2);
|
|
|
|
|
|
let id = newData.headData.authorId;
|
|
|
|
...
|
...
|
@@ -447,13 +447,58 @@ const _getArticlePre = (id, appType) => { |
|
|
id: id,
|
|
|
app_type: appType
|
|
|
}).then((result) => {
|
|
|
// console.log(result.message)
|
|
|
|
|
|
if (result && result.code === 200) {
|
|
|
// console.log(result)
|
|
|
let perArticle = {};
|
|
|
|
|
|
perArticle.href = `${config.siteUrl}/editorial/${result.data.articleIdPre}.html`;
|
|
|
|
|
|
_getHeadData(result.data.articleIdPre, appType).then((list) => {
|
|
|
|
|
|
perArticle.lastChapter = list.title;
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
return perArticle;
|
|
|
});
|
|
|
|
|
|
return perArticle;
|
|
|
} else {
|
|
|
logger.error('In the previous is not 200');
|
|
|
return {};
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取详情页下一篇
|
|
|
* @param id
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
const _getArticleNext = (id, appType) => {
|
|
|
return serviceAPI.get('/guang/api/*/article/getArticleNext', {
|
|
|
id: id,
|
|
|
app_type: appType
|
|
|
}).then((result) => {
|
|
|
|
|
|
if (result && result.code === 200) {
|
|
|
|
|
|
let nextArticle = {};
|
|
|
|
|
|
nextArticle.href = `${config.siteUrl}/editorial/${result.data.articleIdNext}.html`;
|
|
|
|
|
|
_getHeadData(result.data.articleIdNext, appType).then((list) => {
|
|
|
|
|
|
nextArticle.lastChapter = list.title;
|
|
|
}).then(() => {
|
|
|
|
|
|
return nextArticle;
|
|
|
});
|
|
|
|
|
|
return nextArticle;
|
|
|
|
|
|
return camelCase(result.data);
|
|
|
} else {
|
|
|
logger.error('上一篇 is not 200');
|
|
|
logger.error('The next article is not 200');
|
|
|
return {};
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -573,6 +618,7 @@ const getDetailData = (id, appType) => { |
|
|
_getContentData(id),
|
|
|
_getCommentsData(id),
|
|
|
_getArticlePre(id, appType),
|
|
|
_getArticleNext(id, appType),
|
|
|
_getRelateBrand(id)]);
|
|
|
let res = yield _processHeadData([result[0], result[1], result[3]]);
|
|
|
|
...
|
...
|
@@ -581,7 +627,9 @@ const getDetailData = (id, appType) => { |
|
|
tags: res.tags,
|
|
|
content: result[2],
|
|
|
comment: result[3],
|
|
|
brands: result[5]
|
|
|
brands: result[6],
|
|
|
nextArticle: result[4],
|
|
|
perArticle: result[5]
|
|
|
};
|
|
|
})();
|
|
|
};
|
...
|
...
|
|