diff --git a/lib/routes/erbingapp/news.js b/lib/routes/erbingapp/news.js
index b09d19920..411474b34 100644
--- a/lib/routes/erbingapp/news.js
+++ b/lib/routes/erbingapp/news.js
@@ -1,42 +1,51 @@
const got = require('@/utils/got');
+const timezone = require('@/utils/timezone');
+const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: `https://api.diershoubing.com:5001/feed/tag/?pn=0&rn=20&tag_type=0&src=ios`,
- resolveBodyOnly: true,
- responseType: 'json',
});
- const data = response.feeds;
+ const data = JSON.parse(response.body).feeds;
+ const items = data.map((item) => {
+ let description = `
${item.content}
`;
+ const acontent = item.acontent.toString();
+ const ProcessDesc = (link, type) => {
+ if (type) {
+ description += `More
`;
+ } else {
+ for (const item of link) {
+ description += `
`;
+ }
+ }
+ };
+
+ if (item.video_img !== null) {
+ ProcessDesc([item.video_img]);
+ } else if (acontent.indexOf('104129') !== -1) {
+ ProcessDesc([item.article.humb.split('?')[0]]);
+ } else if (acontent.indexOf('.html') !== -1) {
+ ProcessDesc([acontent], 'html');
+ } else if (acontent.indexOf('"imgs') !== -1) {
+ const imgs = JSON.parse(acontent).imgs.split(',');
+ ProcessDesc(imgs);
+ } else {
+ const imgs = acontent.split(',');
+ ProcessDesc(imgs);
+ }
+ return {
+ title: item.title,
+ link: item.share.url,
+ description,
+ pubDate: timezone(parseDate(item.create_time), +8),
+ };
+ });
ctx.state.data = {
title: `二柄APP`,
- link: `https://www.diershoubing.com/`,
+ link: `https://www.diershoubing.com`,
description: `二柄APP新闻`,
- item: data.map((item) => {
- let description = item.content;
- if (item.video_img !== null) {
- description += `
`;
- } else if (item.acontent.indexOf('104129') !== -1) {
- description += `
`;
- } else if (item.acontent.indexOf('.html') !== -1) {
- description += `
More`;
- } else if (item.acontent.indexOf('"imgs') !== -1) {
- const imgs = item.acontent.split(',');
- for (let i = 1; i < imgs.length; i++) {
- description += `
`;
- }
- } else {
- const imgs = item.acontent.split(',');
- for (let i = 0; i < imgs.length; i++) {
- description += `
`;
- }
- }
- return {
- description,
- link: item.share.url,
- title: item.title,
- };
- }),
+ item: items,
};
};