diff --git a/docs/programming.md b/docs/programming.md index 96ad8e0c1b..254a463c2c 100644 --- a/docs/programming.md +++ b/docs/programming.md @@ -516,6 +516,16 @@ GitHub 官方也提供了一些 RSS: +### 微信开放社区-小程序问答 + + + +| 最新 | 最热 | 热门话题 | +| ---- | ---- | -------- | +| new | hot | topic | + + + ### 微信支付-商户平台公告 diff --git a/lib/router.js b/lib/router.js index 5aa87478a2..3ab705ee1a 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1648,7 +1648,7 @@ router.get('/wechat-open/community/xcx-announce', require('./routes/wechat-open/ router.get('/wechat-open/community/xyx-announce', require('./routes/wechat-open/community/xyx-announce')); router.get('/wechat-open/community/pay-announce', require('./routes/wechat-open/community/pay-announce')); router.get('/wechat-open/pay/announce', require('./routes/wechat-open/pay/announce')); - +router.get('/wechat-open/community/xcx-question/:tag', require('./routes/wechat-open/community/xcx-question')); // 微店 router.get('/weidian/goods/:id', require('./routes/weidian/goods')); diff --git a/lib/routes/wechat-open/community/xcx-question.js b/lib/routes/wechat-open/community/xcx-question.js new file mode 100644 index 0000000000..2be10d023a --- /dev/null +++ b/lib/routes/wechat-open/community/xcx-question.js @@ -0,0 +1,35 @@ +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const tag = ctx.params.tag; + + const response = await got({ + method: 'get', + url: `https://developers.weixin.qq.com/community/ngi/question/list?page=1&tag=${tag}`, + headers: { + Referer: `https://developers.weixin.qq.com/community/develop/question`, + }, + }); + + const data = response.data.data; + + ctx.state.data = { + // 源标题 + title: `微信开放社区的小程序问题 - ${tag}`, + // 源链接 + link: `https://developers.weixin.qq.com/community/develop/question?tag=${tag}`, + // 源说明 + description: `微信开放社区的小程序问题 - ${tag}`, + // 遍历此前获取的数据 + 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}`, + })), + }; +};