feat: add 小游戏问答 (#3103)

This commit is contained in:
HuanCheng Bai 2019-09-18 11:16:27 +08:00 committed by DIYgod
parent b82e8fe713
commit 479cf6b3bc
3 changed files with 45 additions and 1 deletions

View File

@ -516,6 +516,14 @@ GitHub 官方也提供了一些 RSS:
<Route author="phantomk" example="/wechat-open/community/pay-announce" path="/wechat-open/community/pay-announce"/>
### 微信开放社区-小游戏问答
<Route author="bestony" example="/wechat-open/community/xyx-question/0" path="/wechat-open/community/xyx-question/:category" :paramsDesc="['0','hot','topic']">
| 全部 | 游戏引擎 | 规则 | 账号 | 运营 | 游戏审核 | API 和组件 | 框架 | 管理后台 | 开发者工具 | 客户端 | 插件 | 云开发 | 教程反馈 | 其他 |
| ---- | -------- | ---- | ----- | ---- | -------- | ---------- | ---- | -------- | ---------- | ------ | ---- | ------ | -------- | ---- |
| 0 | 4096 | 8192 | 16384 | 2048 | 1 | 2 | 64 | 4 | 8 | 16 | 256 | 1024 | 128 | 32 |
### 微信开放社区-小程序问答
<Route author="bestony" example="/wechat-open/community/xcx-question/new" path="/wechat-open/community/xcx-question/:tag" :paramsDesc="['new','hot','topic']">

View File

@ -1648,13 +1648,14 @@ 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/xyx-question/:category', require('./routes/wechat-open/community/xyx-question'));
router.get('/wechat-open/community/xcx-question/:tag', require('./routes/wechat-open/community/xcx-question'));
// 微店
router.get('/weidian/goods/:id', require('./routes/weidian/goods'));
// 有赞
router.get('/youzan/goods/:id', require('./routes/youzan/goods'));
// 币世界快讯
router.get('/bishijie/kuaixun', require('./routes/bishijie/kuaixun'));

View File

@ -0,0 +1,35 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const category = ctx.params.category;
const response = await got({
method: 'get',
url: `https://developers.weixin.qq.com/community/ngi/timeline/2/1/${category}?page=1&limit=10`,
headers: {
Referer: `https://developers.weixin.qq.com/community/minigame/question?type=${category}`,
},
});
const data = response.data.data;
ctx.state.data = {
// 源标题
title: `微信开放社区的小程序问题 - ${category}`,
// 源链接
link: `https://developers.weixin.qq.com/community/develop/question?tag=${category}`,
// 源说明
description: `微信开放社区的小程序问题 - ${category}`,
// 遍历此前获取的数据
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}`,
})),
};
};