diff --git a/docs/new-media.md b/docs/new-media.md index dc8351480..820ae0b90 100644 --- a/docs/new-media.md +++ b/docs/new-media.md @@ -1578,6 +1578,12 @@ area 分区选项 +## 樊登读书 + +### 樊登福州运营中心 + + + ## 飞雪娱乐网 diff --git a/lib/v2/dushu/fuzhou/index.js b/lib/v2/dushu/fuzhou/index.js new file mode 100644 index 000000000..9a2abf904 --- /dev/null +++ b/lib/v2/dushu/fuzhou/index.js @@ -0,0 +1,42 @@ +const got = require('@/utils/got'); +const { art } = require('@/utils/render'); +const path = require('path'); + +const host = 'https://gateway-api-ipv4.dushu365.com/compose-orch/offlineActivity/v100/activity/list'; +const itemLink = 'https://card.dushu.io/requirement/offline-activity/activity-detail/v/index.html'; +const link = 'https://card.dushu.io/requirement/offline-activity/host-home/v/index.html?webview-type=rn&hostId=xtntzsnwsnkw511r'; + +const transformTime = (item) => { + const startTime = new Date(item.startTime); + item.startTime = `${startTime.getFullYear()}-${startTime.getMonth() + 1}-${startTime.getDate()} ${startTime.getHours()}:${startTime.getMinutes()}`; + const endTime = new Date(item.endTime); + item.endTime = `${endTime.getFullYear()}-${endTime.getMonth() + 1}-${endTime.getDate()} ${endTime.getHours()}:${endTime.getMinutes()}`; +}; + +module.exports = async (ctx) => { + const response = await got + .post(host, { + json: { + channelTid: 'xtntzsnwsnkw511r', + pageNo: 1, + pageSize: 10, + type: 0, + }, + }) + .json(); + + const data = response.data.activityListVOS; + data.map(transformTime); + + ctx.state.data = { + title: '樊登福州运营中心', + link, + item: data.map((item) => ({ + title: item.activityName, + link: itemLink + '?productId=' + item.activityId + '&type=' + item.type, + description: art(path.join(__dirname, 'templates/message.art'), { + item, + }), + })), + }; +}; diff --git a/lib/v2/dushu/fuzhou/templates/message.art b/lib/v2/dushu/fuzhou/templates/message.art new file mode 100644 index 000000000..1574c4e04 --- /dev/null +++ b/lib/v2/dushu/fuzhou/templates/message.art @@ -0,0 +1,9 @@ +地区:{{item.areaName}} +
+地点:{{item.address}} +
+开始时间: {{item.startTime}} +
+结束时间: {{item.endTime}} +
+ diff --git a/lib/v2/dushu/maintainer.js b/lib/v2/dushu/maintainer.js new file mode 100644 index 000000000..379984bc1 --- /dev/null +++ b/lib/v2/dushu/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/fuzhou': ['Fatpandac'], +}; diff --git a/lib/v2/dushu/radar.js b/lib/v2/dushu/radar.js new file mode 100644 index 000000000..561b4f40d --- /dev/null +++ b/lib/v2/dushu/radar.js @@ -0,0 +1,24 @@ +module.exports = { + 'dushu.io': { + _name: '樊登读书会', + card: [ + { + title: '福州运营中心', + docs: 'https://docs.rsshub.app/new-media.html#fan-deng-du-shu-fan-deng-fu-zhou-yun-ying-zhong-xin', + source: ['*'], + target: '/dushu/fuzhou', + }, + ], + }, + 'dushu365.com': { + _name: '樊登读书会', + www: [ + { + title: '福州运营中心', + docs: 'https://docs.rsshub.app/new-media.html#fan-deng-du-shu-fan-deng-fu-zhou-yun-ying-zhong-xin', + source: ['*'], + target: '/dushu/fuzhou', + }, + ], + }, +}; diff --git a/lib/v2/dushu/router.js b/lib/v2/dushu/router.js new file mode 100644 index 000000000..a2c4438fb --- /dev/null +++ b/lib/v2/dushu/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/fuzhou', require('./fuzhou/index')); +};