From 7521ef2232e7935d27f633324934b5ccf1bbb788 Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 16 Nov 2022 02:17:27 +0700 Subject: [PATCH] feat(route): cdzjryb (#11281) --- docs/other.md | 6 +++ lib/v2/cdzjryb/maintainer.js | 3 ++ lib/v2/cdzjryb/projectList.js | 49 ++++++++++++++++++++++++ lib/v2/cdzjryb/radar.js | 13 +++++++ lib/v2/cdzjryb/router.js | 3 ++ lib/v2/cdzjryb/templates/projectList.art | 23 +++++++++++ 6 files changed, 97 insertions(+) create mode 100644 lib/v2/cdzjryb/maintainer.js create mode 100644 lib/v2/cdzjryb/projectList.js create mode 100644 lib/v2/cdzjryb/radar.js create mode 100644 lib/v2/cdzjryb/router.js create mode 100644 lib/v2/cdzjryb/templates/projectList.art diff --git a/docs/other.md b/docs/other.md index b468f3262..d23ccc8d5 100644 --- a/docs/other.md +++ b/docs/other.md @@ -402,6 +402,12 @@ type 为 all 时,category 参数不支持 cost 和 free +## 成都住建蓉 e 办 + +### 商品住房购房登记 + + + ## 滴答清单 ### 习惯打卡 diff --git a/lib/v2/cdzjryb/maintainer.js b/lib/v2/cdzjryb/maintainer.js new file mode 100644 index 000000000..4d2c48498 --- /dev/null +++ b/lib/v2/cdzjryb/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/zw/projectList': ['TonyRL'], +}; diff --git a/lib/v2/cdzjryb/projectList.js b/lib/v2/cdzjryb/projectList.js new file mode 100644 index 000000000..58c283875 --- /dev/null +++ b/lib/v2/cdzjryb/projectList.js @@ -0,0 +1,49 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const { parseDate } = require('@/utils/parse-date'); +const timezone = require('@/utils/timezone'); +const { art } = require('@/utils/render'); +const path = require('path'); + +module.exports = async (ctx) => { + const url = 'https://zw.cdzjryb.com/lottery/accept/projectList'; + const { data: response } = await got(url); + const $ = cheerio.load(response); + + const list = $('#_projectInfo tr') + .toArray() + .map((item) => + $(item) + .find('td') + .toArray() + .map((td) => $(td).text().trim()) + ); + + const items = await Promise.all( + list.map((item) => + ctx.cache.tryGet(`cdzjryb:zw:projectList${item[0]}`, async () => { + const { data: notice } = await got.post('https://zw.cdzjryb.com/lottery/accept/getProjectRule', { + form: { + projectUuid: item[0], + }, + }); + return { + title: item[3], + description: art(path.join(__dirname, 'templates/projectList.art'), { + item, + notice: notice.message, + }), + link: url, + guid: `cdzjryb:zw:projectList:${item[0]}`, + pubDate: timezone(parseDate(item[8]), 8), + }; + }) + ) + ); + + ctx.state.data = { + title: $('head title').text(), + link: url, + item: items, + }; +}; diff --git a/lib/v2/cdzjryb/radar.js b/lib/v2/cdzjryb/radar.js new file mode 100644 index 000000000..bc6d99999 --- /dev/null +++ b/lib/v2/cdzjryb/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'cdzjryb.com': { + _name: '成都住建蓉 e 办', + zw: [ + { + title: '商品住房购房登记', + docs: 'https://docs.rsshub.app/other.html#cheng-dou-zhu-jian-rong-e-ban', + source: ['/lottery/accept/projectList', '/'], + target: '/cdzjryb/zw/projectList', + }, + ], + }, +}; diff --git a/lib/v2/cdzjryb/router.js b/lib/v2/cdzjryb/router.js new file mode 100644 index 000000000..ecf2a25c0 --- /dev/null +++ b/lib/v2/cdzjryb/router.js @@ -0,0 +1,3 @@ +module.exports = (router) => { + router.get('/zw/projectList', require('./projectList')); +}; diff --git a/lib/v2/cdzjryb/templates/projectList.art b/lib/v2/cdzjryb/templates/projectList.art new file mode 100644 index 000000000..52b02f201 --- /dev/null +++ b/lib/v2/cdzjryb/templates/projectList.art @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + <% for(let i = 2; i < item.length - 1; i++){ %> + + <% } %> + +
区域项目名称预售证号预售范围住房套数开发商咨询电话登记开始时间登记结束时间名单外人员资格已释放时间名单内人员资格已释放时间预审码取得截止时间项目报名状态
<%= item[i] %>
+

登记规则

+{{@ notice }}