diff --git a/docs/README.md b/docs/README.md
index 744d10eff..676f66998 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -735,6 +735,11 @@ GitHub 官方也提供了一些 RSS:
+### 老司机
+
+
+
+
## 图片
### 妹子图
@@ -945,20 +950,22 @@ GitHub 官方也提供了一些 RSS:
### 西南科技大学
-
+
+
-| 通知公告 | 学校新闻 |
-| -------- | -------- |
-| 1 | 2 |
+| 创新创业教育 | 学生学业 | 建设与改革 | 教学质量保障 | 教学运行 | 教师教学 |
+| ------------ | -------- | ---------- | ------------ | -------- | -------- |
+| 1 | 2 | 3 | 4 | 5 | 6 |
-
+
| 新闻动态 | 学术动态 | 通知公告 | 教研动态 |
| -------- | -------- | -------- | -------- |
| 1 | 2 | 3 | 4 |
+
### 北京大学
@@ -1391,6 +1398,18 @@ Category 列表:
+### 多维新闻网
+
+
+
+| 全部 | 国际 | 中国 | 香港 | 台湾 |
+| ------ | ------ | ----- | -------- | ------ |
+| yaowen | global | china | hongkong | taiwan |
+
+
+
+
+
## 预报预警
### 停水通知
@@ -1851,3 +1870,17 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运
### 观止(每日一文)
+
+### 知晓程序
+
+
+
+| 全部 | 小程序资讯 | 知晓云 | 小程序推荐 | 榜单 | 晓组织 | 新能力 | 小程序问答 |
+| ---- | ---------- | ------ | -------------- | ---- | ------ | ---------- | ---------- |
+| all | news | cloud | recommendation | rank | group | capability | qa |
+
+
+
+### 后续
+
+
diff --git a/router.js b/router.js
index 270546ef6..caf3d9753 100644
--- a/router.js
+++ b/router.js
@@ -505,8 +505,9 @@ router.get('/shmtu/notes', require('./routes/universities/shmtu/notes'));
router.get('/shmtu/jwc/:type', require('./routes/universities/shmtu/jwc'));
// 西南科技大学
-router.get('/swust/jwc/:type', require('./routes/universities/swust/jwc'));
-router.get('/swust/cs/:type', require('./routes/universities/swust/cs'));
+router.get('/swust/jwc/news', require('./routes/universities/swust/jwc_news'));
+router.get('/swust/jwc/notice/:type?', require('./routes/universities/swust/jwc_notice'));
+router.get('/swust/cs/:type?', require('./routes/universities/swust/cs'));
// 华南师范大学
router.get('/scnu/jw', require('./routes/universities/scnu/jw'));
@@ -628,4 +629,18 @@ router.get('/pediy/topic/:category?/:type?', require('./routes/pediy/topic'));
// 观止(每日一文)
router.get('/guanzhi', require('./routes/guanzhi/guanzhi'));
+// 多维新闻网
+router.get('/dwnews/yaowen/:region?', require('./routes/dwnews/yaowen'));
+router.get('/dwnews/rank/:type/:range', require('./routes/dwnews/rank'));
+
+// 知晓程序
+router.get('/miniapp/article/:category', require('./routes/miniapp/article'));
+
+// 后续
+router.get('/houxu/:type/:id', require('./routes/houxu/houxu'));
+
+// 老司机
+router.get('/laosiji/hot', require('./routes/laosiji/hot'));
+router.get('/laosiji/feed', require('./routes/laosiji/feed'));
+
module.exports = router;
diff --git a/routes/dwnews/rank.js b/routes/dwnews/rank.js
new file mode 100644
index 000000000..b69253efe
--- /dev/null
+++ b/routes/dwnews/rank.js
@@ -0,0 +1,65 @@
+const axios = require('../../utils/axios');
+const cheerio = require('cheerio');
+const utils = require('./utils');
+
+module.exports = async (ctx) => {
+ const response = await axios.get('http://www.dwnews.com/html/share/24-7topnews.js');
+
+ const data = JSON.parse(response.data.replace('var rankingData = ', ''));
+
+ let list, title;
+ switch (ctx.params.type) {
+ case 'news':
+ if (ctx.params.range === '1') {
+ list = data.newsRanklist['24H'];
+ title = '新闻 24 小时排行';
+ } else {
+ list = data.newsRanklist['7D'];
+ title = '新闻 7 日排行';
+ }
+ break;
+ case 'photo':
+ if (ctx.params.range === '1') {
+ list = data.photoRanklist['24H'];
+ title = '图集 24 小时排行';
+ } else {
+ list = data.photoRanklist['7D'];
+ title = '图集 7 日排行';
+ }
+
+ break;
+ default:
+ break;
+ }
+
+ const out = await Promise.all(
+ list.slice(0, 10).map(async (item) => {
+ const cache = await ctx.cache.get(item.url);
+ if (cache) {
+ return Promise.resolve(JSON.parse(cache));
+ }
+ item.url = 'http://news.dwnews.com/global/news/2018-10-08/60089463.html';
+ const response = await axios.get(item.url.replace('.html', '_all.html'));
+ const $ = cheerio.load(response.data);
+
+ const result = utils.ProcessRank($, item);
+
+ const single = {
+ title: item.title,
+ link: item.url,
+ author: result.author,
+ description: result.description,
+ pubDate: result.pubDate,
+ };
+ ctx.cache.set(item.url, JSON.stringify(single), 2 * 60 * 60);
+ return Promise.resolve(single);
+ })
+ );
+
+ ctx.state.data = {
+ title: `多维新闻网 - ${title}`,
+ description: '多维新闻网—记住世界的轨迹 更需多维的视线,海外华人首选的中文门户新闻网站,及时全面的向全球海外华人更新世界各地时事政治、经济、科技、人文历史、图片、视频等新闻内容,是海外华人必上的新闻门户网站。',
+ link: 'http://www.dwnews.com/',
+ item: out,
+ };
+};
diff --git a/routes/dwnews/utils.js b/routes/dwnews/utils.js
new file mode 100644
index 000000000..8d20abeed
--- /dev/null
+++ b/routes/dwnews/utils.js
@@ -0,0 +1,78 @@
+const ProcessFeed = ($, item) => {
+ let content;
+ if (item.filetype === 'TJ') {
+ const images = $('div#slider_component_4_0 > img');
+
+ $('div.captions > p').each((i, e) => {
+ $(images[i]).insertBefore(e);
+ });
+
+ content = $('div.captions');
+ } else {
+ content = $('div.dia-lead-one');
+ }
+
+ ProcessQuote($, content);
+ ProcessImage($, content);
+ Clean($, content);
+
+ return content.html();
+};
+
+const ProcessRank = ($) => {
+ let content, author;
+
+ const pubDate = new Date($('div.time').text());
+ pubDate.setHours(pubDate.getHours() - 8);
+
+ content = $('div.dia-lead-one');
+
+ if (content.length === 0) {
+ content = $('div.container');
+
+ author = $('div.author').text();
+ } else {
+ author = $('div.nw').text();
+ }
+
+ ProcessQuote($, content);
+ ProcessImage($, content);
+ Clean($, content);
+
+ return {
+ description: content.html(),
+ author,
+ pubDate,
+ };
+};
+
+const ProcessQuote = ($, content) => {
+ content.find('div.ed-top').each((i, e) => {
+ const quote = $(e).siblings('p');
+ if (quote.length > 0) {
+ $(`${quote.text()}
`).insertBefore(e);
+
+ $(quote).remove();
+ $(e).remove();
+ }
+ });
+};
+
+const ProcessImage = ($, content) => {
+ content.find('a[href="javascript:;"]').each((i, e) => {
+ const img = $(e).find('img');
+ $(img).insertBefore(e);
+ $(e).remove();
+ });
+};
+
+const Clean = ($, content) => {
+ content.find('div.clear, div.badoo, div.hu-bqsm, div.sign, div.xyy, div#component_14_0').each((i, e) => {
+ $(e).remove();
+ });
+};
+
+module.exports = {
+ ProcessFeed,
+ ProcessRank,
+};
diff --git a/routes/dwnews/yaowen.js b/routes/dwnews/yaowen.js
new file mode 100644
index 000000000..f024dc436
--- /dev/null
+++ b/routes/dwnews/yaowen.js
@@ -0,0 +1,69 @@
+const axios = require('../../utils/axios');
+const cheerio = require('cheerio');
+const utils = require('./utils');
+
+module.exports = async (ctx) => {
+ const link = 'http://news.dwnews.com';
+ let region,
+ host,
+ title = '要闻';
+
+ if (ctx.params.region) {
+ region = ctx.params.region.toLowerCase();
+ switch (region) {
+ case 'china':
+ title = `中国${title}`;
+ break;
+ case 'global':
+ title = `国际${title}`;
+ break;
+ case 'hongkong':
+ title = `香港${title}`;
+ break;
+ case 'taiwan':
+ title = `台湾${title}`;
+ break;
+ default:
+ break;
+ }
+ host = `${link}/html/news/${region}/list0.json`;
+ } else {
+ region = 'yaowen';
+ host = `${link}/html/news/yaowen/list0.json`;
+ }
+
+ const list = await axios.get(host);
+
+ const out = await Promise.all(
+ list.data.slice(0, 10).map(async (item) => {
+ const cache = await ctx.cache.get(item.url);
+ if (cache) {
+ return Promise.resolve(JSON.parse(cache));
+ }
+ const response = await axios.get(item.url.replace('.html', '_all.html'));
+ const $ = cheerio.load(response.data);
+
+ const pubDate = new Date(item.showTime);
+ pubDate.setHours(pubDate.getHours() - 8);
+
+ const description = utils.ProcessFeed($, item);
+
+ const single = {
+ title: item.title,
+ link: item.url,
+ author: $('div.nw').text(),
+ description,
+ pubDate: pubDate.toUTCString(),
+ };
+ ctx.cache.set(item.url, JSON.stringify(single), 2 * 60 * 60);
+ return Promise.resolve(single);
+ })
+ );
+
+ ctx.state.data = {
+ title: `多维新闻网 - ${title}`,
+ description: '多维新闻网—记住世界的轨迹 更需多维的视线,海外华人首选的中文门户新闻网站,及时全面的向全球海外华人更新世界各地时事政治、经济、科技、人文历史、图片、视频等新闻内容,是海外华人必上的新闻门户网站。',
+ link: `${region === 'yaowen' ? link : link + '/' + region}`,
+ item: out,
+ };
+};
diff --git a/routes/houxu/houxu.js b/routes/houxu/houxu.js
new file mode 100644
index 000000000..4996df5ff
--- /dev/null
+++ b/routes/houxu/houxu.js
@@ -0,0 +1,35 @@
+const axios = require('../../utils/axios');
+const cheerio = require('cheerio');
+
+module.exports = async (ctx) => {
+ const { type, id } = ctx.params;
+ const baseUrl = `https://houxu.app/${type}/${id}`;
+ const res = await axios.get(baseUrl);
+ const data = res.data;
+ const $ = cheerio.load(data);
+
+ const list = $('section.threads > div').get();
+ const descriptionSelector = type === 'live' ? '.summary' : '.readable';
+ const out = list.map((item) => {
+ const each = $(item);
+ return {
+ title: each
+ .find('a')
+ .text()
+ .trim(),
+ description: each
+ .find(descriptionSelector)
+ .text()
+ .trim(),
+ link: each.find('a').attr('href'),
+ };
+ });
+ ctx.state.data = {
+ title: $('.large-title').text(),
+ description: $('title')
+ .text()
+ .trim(),
+ link: baseUrl,
+ item: out,
+ };
+};
diff --git a/routes/ifanr/index.js b/routes/ifanr/index.js
index 0fc9d3259..5d09f58e5 100644
--- a/routes/ifanr/index.js
+++ b/routes/ifanr/index.js
@@ -1,9 +1,9 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
-let host = 'http://www.ifanr.com';
-
module.exports = async (ctx) => {
+ let host = 'http://www.ifanr.com';
+
if (ctx.params.channel) {
let channel = ctx.params.channel.toLowerCase();
channel = channel.split('-').join('/');
diff --git a/routes/laosiji/feed.js b/routes/laosiji/feed.js
new file mode 100644
index 000000000..5462ab705
--- /dev/null
+++ b/routes/laosiji/feed.js
@@ -0,0 +1,22 @@
+const axios = require('../../utils/axios');
+
+module.exports = async (ctx) => {
+ const response = await axios({
+ method: 'post',
+ url: 'http://www.laosiji.com/api/topic/feed/list',
+ });
+
+ const data = response.data.body.sns.list;
+
+ ctx.state.data = {
+ title: '老司机-首页',
+ link: 'http://www.laosiji.com/new_web/index.html',
+ description: '老司机-首页',
+ item: data.map(({ title, resourceid, image, publishtime }) => ({
+ title,
+ link: `http://www.laosiji.com/thread/${resourceid}.html`,
+ description: `
`,
+ pubDate: publishtime,
+ })),
+ };
+};
diff --git a/routes/laosiji/hot.js b/routes/laosiji/hot.js
new file mode 100644
index 000000000..e4d84e156
--- /dev/null
+++ b/routes/laosiji/hot.js
@@ -0,0 +1,22 @@
+const axios = require('../../utils/axios');
+
+module.exports = async (ctx) => {
+ const response = await axios({
+ method: 'get',
+ url: 'http://www.laosiji.com/thread/hotList',
+ });
+
+ const data = response.data;
+
+ ctx.state.data = {
+ title: '老司机-24小时热门',
+ link: 'http://www.laosiji.com/new_web/index.html',
+ description: '老司机-24小时热门',
+ item: data.map(({ title, id, imageInfo, createtime }) => ({
+ title,
+ link: `http://www.laosiji.com/thread/${id}.html`,
+ description: `
`,
+ pubDate: new Date(createtime).toUTCString(),
+ })),
+ };
+};
diff --git a/routes/miniapp/article.js b/routes/miniapp/article.js
new file mode 100644
index 000000000..9c53a53ba
--- /dev/null
+++ b/routes/miniapp/article.js
@@ -0,0 +1,57 @@
+const axios = require('../../utils/axios');
+
+module.exports = async (ctx) => {
+ const category = ctx.params.category.toLowerCase();
+
+ let host = `https://minapp.com/api/v5/trochili/post/?category=${category}&post_type=article&limit=10`;
+
+ if (category === 'all') {
+ host = 'https://minapp.com/api/v5/trochili/post/?post_type=article&limit=10';
+ }
+
+ let title;
+ switch (category) {
+ case 'news':
+ title = '小程序资讯';
+ break;
+ case 'cloud':
+ title = '知晓云';
+ break;
+ case 'recommendation':
+ title = '小程序推荐';
+ break;
+ case 'rank':
+ title = '榜单';
+ break;
+ case 'group':
+ title = '晓组织';
+ break;
+ case 'capability':
+ title = '新能力';
+ break;
+ case 'qa':
+ title = '小程序问答';
+ break;
+ default:
+ break;
+ }
+
+ const response = await axios.get(host);
+
+ const list = response.data.objects;
+
+ const out = list.map((item) => ({
+ title: item.title,
+ link: `https://minapp.com/article/${item.id}`,
+ author: item.created_by.nickname,
+ description: item.content,
+ pubDate: new Date(item.created_at * 1000),
+ }));
+
+ ctx.state.data = {
+ title: `知晓程序${title ? ' - ' + title : ''}`,
+ description: '知晓程序 | 一扫即用的小程序大全',
+ link: `https://minapp.com/article/?page=1&category=${category}`,
+ item: out,
+ };
+};
diff --git a/routes/pediy/topic.js b/routes/pediy/topic.js
index 043c14c9a..3b5a862d2 100644
--- a/routes/pediy/topic.js
+++ b/routes/pediy/topic.js
@@ -1,5 +1,5 @@
const axios = require('../../utils/axios');
-const dateHelper = require('../../utils/date');
+const pediyUtils = require('./utils');
const cheerio = require('cheerio');
const baseUrl = 'https://bbs.pediy.com/';
@@ -56,40 +56,42 @@ module.exports = async (ctx) => {
},
});
- const data = response.data;
- const $ = cheerio.load(data);
+ const $ = cheerio.load(response.data);
+ const list = $('.thread');
ctx.state.data = {
title: `${title}`,
link: baseUrl + path,
- item: $('.thread')
- .map((_, elem) => {
- const subject = $('.subject a', elem).eq(1);
- const author = $('.username', elem).eq(0);
+ item:
+ list &&
+ list
+ .map((_, elem) => {
+ const subject = $('.subject a', elem).eq(1);
+ const author = $('.username', elem).eq(0);
- let pubDate = $('.date', elem).eq(0);
- if (pubDate.text().indexOf('前') !== -1) {
- pubDate = dateHelper(pubDate.text(), 8);
- } else {
- pubDate = pubDate.text();
- }
+ const pubDate = pediyUtils.dateParser(
+ $('.date', elem)
+ .eq(0)
+ .text(),
+ 8
+ );
- let topic;
- if (isSpecific) {
- topic = categoryId[category][1];
- } else {
- topic = $('.subject a.small', elem)
- .eq(0)
- .text();
- }
+ let topic;
+ if (isSpecific) {
+ topic = categoryId[category][1];
+ } else {
+ topic = $('.subject a.small', elem)
+ .eq(0)
+ .text();
+ }
- return {
- title: subject.text(),
- link: baseUrl + subject.attr('href'),
- pubDate: pubDate,
- description: `作者: ${author.text()} 版块: ${topic}`,
- };
- })
- .get(),
+ return {
+ title: subject.text(),
+ link: baseUrl + subject.attr('href'),
+ pubDate: `${pubDate}`,
+ description: `作者: ${author.text()} 版块: ${topic}`,
+ };
+ })
+ .get(),
};
};
diff --git a/routes/pediy/utils.js b/routes/pediy/utils.js
new file mode 100644
index 000000000..ce37785d7
--- /dev/null
+++ b/routes/pediy/utils.js
@@ -0,0 +1,27 @@
+const pediyUtils = {
+ dateParser: (html, timeZone) => {
+ let math;
+ let date = new Date();
+ if (/(\d+)分钟前/.exec(html)) {
+ math = /(\d+)分钟前/.exec(html);
+ date.setMinutes(date.getMinutes() - math[1]);
+ return date.toUTCString();
+ } else if (/(\d+)小时前/.exec(html)) {
+ math = /(\d+)小时前/.exec(html);
+ date.setHours(date.getHours() - math[1]);
+ return date.toUTCString();
+ } else if (/(\d+)天前/.exec(html)) {
+ math = /(\d+)天前/.exec(html);
+ date.setDate(date.getDate() - math[1]);
+ return date.toUTCString();
+ } else if (/(\d+)-(\d+)-(\d+) (\d+):(\d+)/.exec(html)) {
+ math = /(\d+)-(\d+)-(\d+) (\d+):(\d+)/.exec(html);
+ date = new Date(math[1], parseInt(math[2]) - 1, math[3], math[4], math[5]);
+ const serverOffset = new Date().getTimezoneOffset() / 60;
+ return new Date(date.getTime() - 60 * 60 * 1000 * (timeZone + serverOffset)).toUTCString();
+ }
+ return html;
+ },
+};
+
+module.exports = pediyUtils;
diff --git a/routes/universities/swust/cs.js b/routes/universities/swust/cs.js
index 825aecca9..11aa3e37a 100644
--- a/routes/universities/swust/cs.js
+++ b/routes/universities/swust/cs.js
@@ -10,7 +10,7 @@ module.exports = async (ctx) => {
responseType: 'arraybuffer',
});
- let type = ctx.params.type;
+ let type = ctx.params.type || 1;
let info = '新闻动态';
let word = 'news';
if (type === '2') {
diff --git a/routes/universities/swust/jwc.js b/routes/universities/swust/jwc.js
deleted file mode 100644
index 73fdb9584..000000000
--- a/routes/universities/swust/jwc.js
+++ /dev/null
@@ -1,63 +0,0 @@
-const axios = require('../../../utils/axios');
-const cheerio = require('cheerio');
-
-module.exports = async (ctx) => {
- const host = 'http://www.dean.swust.edu.cn';
- let type = ctx.params.type;
-
- let info = '通知公告';
- let word = 'notices/';
-
- if (type === '2') {
- info = '站点新闻';
- word = 'news/';
- } else {
- type = '1';
- }
-
- const web = 'http://www.dean.swust.edu.cn/xml/' + word + 'index.xml';
- const response = await axios({
- method: 'get',
- url: web,
- headers: {
- Referer: host,
- },
- });
-
- const data = response.data;
-
- const $ = cheerio.load(data, {
- xmlMode: true,
- });
- const list = $('entrity');
-
- ctx.state.data = {
- title: '西南科技大学 教务处 ' + info,
- link: web,
- description: $('title')
- .first()
- .text(),
- item:
- list &&
- list
- .map((index, item) => {
- item = $(item);
- return {
- title: item.find('title').text(),
- description: item.find('summary').text(),
- pubDate: new Date(
- Date.parse(
- item
- .find('date')
- .text()
- .replace('年', '-')
- .replace('月', '-')
- .replace('日', '')
- )
- ).toUTCString(),
- link: host + '/xml/' + word + item.attr('id') + '.xml',
- };
- })
- .get(),
- };
-};
diff --git a/routes/universities/swust/jwc_news.js b/routes/universities/swust/jwc_news.js
new file mode 100644
index 000000000..2754cd256
--- /dev/null
+++ b/routes/universities/swust/jwc_news.js
@@ -0,0 +1,53 @@
+const axios = require('../../../utils/axios');
+
+// 转码需要设定返回数据的格式,其可选项是arraybuffer,blob,document,json,text,stream
+// 默认为json
+const axios_ins = axios.create({ responseType: 'blob' });
+
+const api = 'http://www.dean.swust.edu.cn/cms/portal/news.json';
+const host = 'http://www.dean.swust.edu.cn/';
+const page = 'http://www.dean.swust.edu.cn/news/';
+
+function evil(fn) {
+ const Fn = Function; // 一个变量指向Function,防止有些前端编译工具报错
+ return new Fn('return ' + fn)();
+}
+
+module.exports = async (ctx) => {
+ const response = await axios_ins.get(api);
+ const data = evil(response.data);
+
+ const resultItems = await Promise.all(
+ data.map(async (item) => {
+ const title = item.title;
+ const date = item.outdate;
+ const link = page + item.id;
+ const author = item.publisher;
+
+ let resultItem = {};
+
+ const value = await ctx.cache.get(link);
+ if (value) {
+ resultItem = JSON.parse(value);
+ } else {
+ resultItem = {
+ title: title,
+ link: link,
+ pubDate: new Date(date),
+ author: author,
+ };
+
+ ctx.cache.set(link, JSON.stringify(resultItem), 24 * 60 * 60);
+ }
+
+ return Promise.resolve(resultItem);
+ })
+ );
+
+ ctx.state.data = {
+ title: '西南科技大学教务处 新闻',
+ link: host,
+ description: '西南科技大学教务处 新闻',
+ item: resultItems,
+ };
+};
diff --git a/routes/universities/swust/jwc_notice.js b/routes/universities/swust/jwc_notice.js
new file mode 100644
index 000000000..2893ea1d2
--- /dev/null
+++ b/routes/universities/swust/jwc_notice.js
@@ -0,0 +1,59 @@
+const axios = require('../../../utils/axios');
+
+// 转码需要设定返回数据的格式,其可选项是arraybuffer,blob,document,json,text,stream
+// 默认为json
+const axios_ins = axios.create({ responseType: 'blob' });
+
+const api = 'http://www.dean.swust.edu.cn/cms/portal/notice.json';
+const page = 'http://www.dean.swust.edu.cn/notice/page/';
+const tag = 'http://www.dean.swust.edu.cn/notice/tag/';
+
+function evil(fn) {
+ const Fn = Function; // 一个变量指向Function,防止有些前端编译工具报错
+ return new Fn('return ' + fn)();
+}
+
+module.exports = async (ctx) => {
+ const type = ctx.params.type || 1;
+
+ const response = await axios_ins.get(api);
+ const responsedata = evil(response.data);
+ const data = responsedata[type - 1];
+
+ const info = data.name || '';
+ const tag_url = data.id || '';
+
+ const resultItems = await Promise.all(
+ data.items.map(async (item) => {
+ const link = page + item.id;
+ const author = item.publisher;
+ const date = item.outdate;
+ const title = item.title;
+
+ let resultItem = {};
+
+ const value = await ctx.cache.get(link);
+ if (value) {
+ resultItem = JSON.parse(value);
+ } else {
+ resultItem = {
+ title: title,
+ link: link,
+ pubDate: new Date(date),
+ author: author,
+ };
+
+ ctx.cache.set(link, JSON.stringify(resultItem), 24 * 60 * 60);
+ }
+
+ return Promise.resolve(resultItem);
+ })
+ );
+
+ ctx.state.data = {
+ title: '西南科技大学教务处 ' + info,
+ link: tag + tag_url,
+ description: `西南科技大学教务处 ${info}`,
+ item: resultItems,
+ };
+};
diff --git a/routes/xueqiu/fund.js b/routes/xueqiu/fund.js
index 35d9367dd..14e45e853 100644
--- a/routes/xueqiu/fund.js
+++ b/routes/xueqiu/fund.js
@@ -31,11 +31,12 @@ module.exports = async (ctx) => {
});
const data = response.data.data.fund_nav_growth.pop();
+ const yesterday = response.data.data.fund_nav_growth.pop();
let description = `${fundNameShort}
最新净值 ${data.nav}
今日`;
let title = `${fundNameShort} ${data.date.substring(5)} `;
- const value = parseFloat(data.value);
+ const value = (parseFloat(data.nav) - parseFloat(yesterday.nav)).toFixed(4);
if (value > 0) {
description += '涨幅';
@@ -48,7 +49,7 @@ module.exports = async (ctx) => {
title += '持平';
}
- description += ` ${data.percentage}%(¥${data.value})`;
+ description += ` ${data.percentage}%(¥${value})`;
const single = {
title,