mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-11 23:59:56 +08:00
* refactor: add no-implicit-coercion rule for ESLint * fix: errors from deepscan * fix: errors from deepscan * fix: errors from deepscan * fix: errors from deepscan * fix: errors from deepscan * Update docs/en/joinus/quick-start.md Co-authored-by: Sukka <isukkaw@gmail.com> * Update docs/joinus/quick-start.md Co-authored-by: Sukka <isukkaw@gmail.com> * Update lib/routes/av01/tag.js Co-authored-by: Sukka <isukkaw@gmail.com> * Update lib/routes/gov/taiwan/mnd.js Co-authored-by: Sukka <isukkaw@gmail.com> * Update lib/routes/ps/product.js Co-authored-by: Sukka <isukkaw@gmail.com> * refactor: minify html string Co-authored-by: Sukka <isukkaw@gmail.com>
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
const got = require('@/utils/got');
|
|
|
|
module.exports = async (ctx) => {
|
|
const { type, category } = ctx.params;
|
|
let url, title;
|
|
if (type.startsWith('xcx')) {
|
|
url = `https://developers.weixin.qq.com/community/ngi/question/list?page=1&tag=${category}`;
|
|
title = `微信开放社区的小程序问题 - ${category}`;
|
|
} else if (type.startsWith('xyx')) {
|
|
url = `https://developers.weixin.qq.com/community/ngi/timeline/2/1/${category}?page=1&limit=10`;
|
|
title = `微信开放社区的小游戏问题 - ${category}`;
|
|
}
|
|
|
|
const response = await got.get(url);
|
|
|
|
const data = response.data.data;
|
|
|
|
ctx.state.data = {
|
|
// 源标题
|
|
title,
|
|
// 源链接
|
|
link: url,
|
|
// 源说明
|
|
description: title,
|
|
// 遍历此前获取的数据
|
|
item: data.rows.map((item) => ({
|
|
// 文章标题
|
|
title: item.Title,
|
|
// 文章正文
|
|
description: item.Content,
|
|
// 文章发布时间
|
|
pubDate: new Date(item.CreateTime * 1000).toUTCString(),
|
|
// 文章链接
|
|
link: `https://developers.weixin.qq.com/community/develop/doc/${item.DocId}`,
|
|
})),
|
|
};
|
|
};
|