|
@@ -190,8 +190,8 @@ const _processHeadData = (list) => { |
|
@@ -190,8 +190,8 @@ const _processHeadData = (list) => { |
190
|
}
|
190
|
}
|
191
|
});
|
191
|
});
|
192
|
|
192
|
|
193
|
- // newData.headData.time = newData.headData.time.replace(/-/g, '/');
|
|
|
194
|
- // newData.headData.time = newData.headData.time.replace(':00', '', 2);
|
193
|
+ newData.headData.time = newData.headData.time.replace(/-/g, '/');
|
|
|
194
|
+ newData.headData.time = newData.headData.time.replace(':00', '', 2);
|
195
|
|
195
|
|
196
|
let id = newData.headData.authorId;
|
196
|
let id = newData.headData.authorId;
|
197
|
|
197
|
|
|
@@ -447,13 +447,58 @@ const _getArticlePre = (id, appType) => { |
|
@@ -447,13 +447,58 @@ const _getArticlePre = (id, appType) => { |
447
|
id: id,
|
447
|
id: id,
|
448
|
app_type: appType
|
448
|
app_type: appType
|
449
|
}).then((result) => {
|
449
|
}).then((result) => {
|
450
|
- // console.log(result.message)
|
450
|
+
|
451
|
if (result && result.code === 200) {
|
451
|
if (result && result.code === 200) {
|
452
|
- // console.log(result)
|
452
|
+ let perArticle = {};
|
|
|
453
|
+
|
|
|
454
|
+ perArticle.href = `${config.siteUrl}/editorial/${result.data.articleIdPre}.html`;
|
|
|
455
|
+
|
|
|
456
|
+ _getHeadData(result.data.articleIdPre, appType).then((list) => {
|
|
|
457
|
+
|
|
|
458
|
+ perArticle.lastChapter = list.title;
|
|
|
459
|
+
|
|
|
460
|
+ }).then(() => {
|
|
|
461
|
+
|
|
|
462
|
+ return perArticle;
|
|
|
463
|
+ });
|
|
|
464
|
+
|
|
|
465
|
+ return perArticle;
|
|
|
466
|
+ } else {
|
|
|
467
|
+ logger.error('In the previous is not 200');
|
|
|
468
|
+ return {};
|
|
|
469
|
+ }
|
|
|
470
|
+ });
|
|
|
471
|
+};
|
|
|
472
|
+
|
|
|
473
|
+/**
|
|
|
474
|
+ * 获取详情页下一篇
|
|
|
475
|
+ * @param id
|
|
|
476
|
+ * @returns {*}
|
|
|
477
|
+ */
|
|
|
478
|
+const _getArticleNext = (id, appType) => {
|
|
|
479
|
+ return serviceAPI.get('/guang/api/*/article/getArticleNext', {
|
|
|
480
|
+ id: id,
|
|
|
481
|
+ app_type: appType
|
|
|
482
|
+ }).then((result) => {
|
|
|
483
|
+
|
|
|
484
|
+ if (result && result.code === 200) {
|
|
|
485
|
+
|
|
|
486
|
+ let nextArticle = {};
|
|
|
487
|
+
|
|
|
488
|
+ nextArticle.href = `${config.siteUrl}/editorial/${result.data.articleIdNext}.html`;
|
|
|
489
|
+
|
|
|
490
|
+ _getHeadData(result.data.articleIdNext, appType).then((list) => {
|
|
|
491
|
+
|
|
|
492
|
+ nextArticle.lastChapter = list.title;
|
|
|
493
|
+ }).then(() => {
|
|
|
494
|
+
|
|
|
495
|
+ return nextArticle;
|
|
|
496
|
+ });
|
|
|
497
|
+
|
|
|
498
|
+ return nextArticle;
|
453
|
|
499
|
|
454
|
- return camelCase(result.data);
|
|
|
455
|
} else {
|
500
|
} else {
|
456
|
- logger.error('上一篇 is not 200');
|
501
|
+ logger.error('The next article is not 200');
|
457
|
return {};
|
502
|
return {};
|
458
|
}
|
503
|
}
|
459
|
});
|
504
|
});
|
|
@@ -573,6 +618,7 @@ const getDetailData = (id, appType) => { |
|
@@ -573,6 +618,7 @@ const getDetailData = (id, appType) => { |
573
|
_getContentData(id),
|
618
|
_getContentData(id),
|
574
|
_getCommentsData(id),
|
619
|
_getCommentsData(id),
|
575
|
_getArticlePre(id, appType),
|
620
|
_getArticlePre(id, appType),
|
|
|
621
|
+ _getArticleNext(id, appType),
|
576
|
_getRelateBrand(id)]);
|
622
|
_getRelateBrand(id)]);
|
577
|
let res = yield _processHeadData([result[0], result[1], result[3]]);
|
623
|
let res = yield _processHeadData([result[0], result[1], result[3]]);
|
578
|
|
624
|
|
|
@@ -581,7 +627,9 @@ const getDetailData = (id, appType) => { |
|
@@ -581,7 +627,9 @@ const getDetailData = (id, appType) => { |
581
|
tags: res.tags,
|
627
|
tags: res.tags,
|
582
|
content: result[2],
|
628
|
content: result[2],
|
583
|
comment: result[3],
|
629
|
comment: result[3],
|
584
|
- brands: result[5]
|
630
|
+ brands: result[6],
|
|
|
631
|
+ nextArticle: result[4],
|
|
|
632
|
+ perArticle: result[5]
|
585
|
};
|
633
|
};
|
586
|
})();
|
634
|
})();
|
587
|
};
|
635
|
};
|