diff --git a/docs/programming.md b/docs/programming.md index 040dbaacb5..90744c2990 100644 --- a/docs/programming.md +++ b/docs/programming.md @@ -252,6 +252,16 @@ GitHub 官方也提供了一些 RSS: +## 饿了么开放平台 + +### 商家开放平台公告 + + + +### 饿百零售开放平台公告 + + + ## 极客时间 ### 专栏文章 @@ -507,6 +517,24 @@ GitHub 官方也提供了一些 RSS: +## 微信开放平台 + +### 微信开放社区-小程序公告 + + + +### 微信开放社区-小游戏公告 + + + +### 微信开放社区-微信支付公告 + + + +### 微信支付-商户平台公告 + + + ## 印记中文周刊 ### 最新一期 diff --git a/lib/router.js b/lib/router.js index c11d0f7f2d..a84243151c 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1641,4 +1641,14 @@ router.get('/soul/:id', require('./routes/soul')); // 单向空间 router.get('/owspace/read/:type?', require('./routes/owspace/read')); +// eleme +router.get('/eleme/open/announce', require('./routes/eleme/open/announce')); +router.get('/eleme/open-be/announce', require('./routes/eleme/open-be/announce')); + +// wechat-open +router.get('/wechat-open/community/xcx-announce', require('./routes/wechat-open/community/xcx-announce')); +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')); + module.exports = router; diff --git a/lib/routes/eleme/open-be/announce.js b/lib/routes/eleme/open-be/announce.js new file mode 100644 index 0000000000..7286c063a5 --- /dev/null +++ b/lib/routes/eleme/open-be/announce.js @@ -0,0 +1,19 @@ +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const data = (await got({ + method: 'get', + url: 'https://open-be.ele.me/dev/notice/list?curpage=1&perpage=200', + })).data; + + ctx.state.data = { + title: '饿百零售开放平台-公告', + link: 'https://open-be.ele.me/dev/notice', + item: data.data.body.notice_info.map((item) => ({ + title: item.title, + description: `更新时间: ${item.update_time}`, + pubDate: item.create_time, + link: `https://open-be.ele.me/dev/notice?id=${item.id}`, + })), + }; +}; diff --git a/lib/routes/eleme/open/announce.js b/lib/routes/eleme/open/announce.js new file mode 100644 index 0000000000..dffdd94739 --- /dev/null +++ b/lib/routes/eleme/open/announce.js @@ -0,0 +1,34 @@ +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const data = (await got({ + method: 'post', + url: 'https://app-api.shop.ele.me/arena/invoke/?method=NoticeKeeperService.getBroadcastList', + json: true, + data: { + id: '5CC2B32FA6F24CF78CB300DDE2F370BE|1565511577423', + metas: { + appName: 'Odin', + appVersion: '4.4.0', + }, + service: 'NoticeKeeperService', + method: 'getBroadcastList', + params: { + offset: 0, + limit: 999, + }, + ncp: '2.0.0', + }, + })).data; + + ctx.state.data = { + title: '饿了么商家开放平台-公告', + link: 'https://open.shop.ele.me/openapi/publicnotice/0', + item: data.result.broadcastList.map((item) => ({ + title: item.title, + description: '', + pubDate: item.beginDate, + link: `https://open.shop.ele.me/openapi/publicnotice/${item.templateId}`, + })), + }; +}; diff --git a/lib/routes/wechat-open/community/pay-announce.js b/lib/routes/wechat-open/community/pay-announce.js new file mode 100644 index 0000000000..650d9c745e --- /dev/null +++ b/lib/routes/wechat-open/community/pay-announce.js @@ -0,0 +1,30 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const { data: htmlString } = await got({ + method: 'get', + url: 'https://developers.weixin.qq.com/community/pay/list/2', + }); + const $ = cheerio.load(htmlString); + const announceList = []; + $('#article_frame > div > ul > li').each(function() { + const $item = $(this); + const $link = $item.find('a').attr('href'); + const time = $item.find('div > em').text(); + const title = $item.find('h2 > meta').attr('content'); + + announceList.push({ + title: title, + link: `https://developers.weixin.qq.com${$link}`, + description: title, + pubDate: time, + }); + }); + + ctx.state.data = { + title: '微信开放社区-微信支付公告', + link: 'https://developers.weixin.qq.com/community/pay/list/2', + item: announceList, + }; +}; diff --git a/lib/routes/wechat-open/community/xcx-announce.js b/lib/routes/wechat-open/community/xcx-announce.js new file mode 100644 index 0000000000..05e93ad059 --- /dev/null +++ b/lib/routes/wechat-open/community/xcx-announce.js @@ -0,0 +1,30 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const { data: htmlString } = await got({ + method: 'get', + url: 'https://developers.weixin.qq.com/community/develop/list/2', + }); + const $ = cheerio.load(htmlString); + const announceList = []; + $('#article_frame > div > ul > li').each(function() { + const $item = $(this); + const $link = $item.find('a').attr('href'); + const time = $item.find('div > em').text(); + const title = $item.find('h2 > meta').attr('content'); + + announceList.push({ + title: title, + link: `https://developers.weixin.qq.com${$link}`, + description: title, + pubDate: time, + }); + }); + + ctx.state.data = { + title: '微信开放社区-小程序公告', + link: 'https://developers.weixin.qq.com/community/develop/list/2', + item: announceList, + }; +}; diff --git a/lib/routes/wechat-open/community/xyx-announce.js b/lib/routes/wechat-open/community/xyx-announce.js new file mode 100644 index 0000000000..9755117568 --- /dev/null +++ b/lib/routes/wechat-open/community/xyx-announce.js @@ -0,0 +1,30 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const { data: htmlString } = await got({ + method: 'get', + url: 'https://developers.weixin.qq.com/community/minigame/list/2', + }); + const $ = cheerio.load(htmlString); + const announceList = []; + $('#article_frame > div > ul > li').each(function() { + const $item = $(this); + const $link = $item.find('a').attr('href'); + const time = $item.find('div > em').text(); + const title = $item.find('h2 > meta').attr('content'); + + announceList.push({ + title: title, + link: `https://developers.weixin.qq.com${$link}`, + description: title, + pubDate: time, + }); + }); + + ctx.state.data = { + title: '微信开放社区-小游戏公告', + link: 'https://developers.weixin.qq.com/community/minigame/list/2', + item: announceList, + }; +}; diff --git a/lib/routes/wechat-open/pay/announce.js b/lib/routes/wechat-open/pay/announce.js new file mode 100644 index 0000000000..162bf59bf3 --- /dev/null +++ b/lib/routes/wechat-open/pay/announce.js @@ -0,0 +1,28 @@ +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const data = (await got({ + method: 'get', + url: + 'https://pay.weixin.qq.com/index.php/public/cms/get_contents?id=6200&cmstype=1&url=https%253A%252F%252Fpay.weixin.qq.com%252Fpublic%252Fcms%252Fcontent_list%253Flang%253Dzh%2526id%253D6200&states=2&publishtimeend=1565537507&expiretimebeg=1565537507&propertyinclude=1&ordertype=4&field=contentId%2CcontentTitle%2CcontentPublishTime&g_ty=ajax', + })).data.data.contentlist; + + const data2 = (await got({ + method: 'get', + url: + 'https://pay.weixin.qq.com/index.php/public/cms/get_contents?pagenum=1&id=6200&cmstype=1&url=https%253A%252F%252Fpay.weixin.qq.com%252Fpublic%252Fcms%252Fcontent_list%253Flang%253Dzh%2526id%253D6200&states=2&publishtimeend=1565537507&expiretimebeg=1565537507&propertyexclude=1&ordertype=4&field=contentId%2CcontentTitle%2CcontentPublishTime&g_ty=ajax', + })).data.data.contentlist; + + data.push(...data2); + + ctx.state.data = { + title: '微信支付-商户平台公告', + link: 'https://pay.weixin.qq.com/public/cms/content_list?lang=zh&id=6200', + item: data.map((item) => ({ + title: item.contentTitle, + description: item.contentTitle, + pubDate: new Date(item.contentPublishTime * 1000).toUTCString(), + link: `https://pay.weixin.qq.com/index.php/public/cms/content_detail?platformType=0&lang=zh&id=${item.contentId}`, + })), + }; +};