From 571f878b3a45511bdca580e3d528813dc9d3c242 Mon Sep 17 00:00:00 2001
From: Fatpandac <1779196284@qq.com>
Date: Sun, 23 Jan 2022 03:10:00 +0800
Subject: [PATCH] =?UTF-8?q?Add(route):=20add=20=E6=BE=B3=E9=96=80=20?=
=?UTF-8?q?=E8=A1=9B=E7=94=9F=E5=B1=80=20(#8777)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/government.md | 6 ++++++
lib/v2/ssm/maintainer.js | 3 +++
lib/v2/ssm/news.js | 38 +++++++++++++++++++++++++++++++++++
lib/v2/ssm/radar.js | 13 ++++++++++++
lib/v2/ssm/router.js | 3 +++
lib/v2/ssm/templates/news.art | 1 +
6 files changed, 64 insertions(+)
create mode 100644 lib/v2/ssm/maintainer.js
create mode 100644 lib/v2/ssm/news.js
create mode 100644 lib/v2/ssm/radar.js
create mode 100644 lib/v2/ssm/router.js
create mode 100644 lib/v2/ssm/templates/news.art
diff --git a/docs/government.md b/docs/government.md
index f77b30a92..8b466a663 100644
--- a/docs/government.md
+++ b/docs/government.md
@@ -16,6 +16,12 @@ pageClass: routes
+## 澳门卫生局
+
+### 最新消息
+
+
+
## 北京市卫生健康委员会
### 新闻中心
diff --git a/lib/v2/ssm/maintainer.js b/lib/v2/ssm/maintainer.js
new file mode 100644
index 000000000..89c40d4d5
--- /dev/null
+++ b/lib/v2/ssm/maintainer.js
@@ -0,0 +1,3 @@
+module.exports = {
+ '/news': ['Fatpandac'],
+};
diff --git a/lib/v2/ssm/news.js b/lib/v2/ssm/news.js
new file mode 100644
index 000000000..f3a0091c1
--- /dev/null
+++ b/lib/v2/ssm/news.js
@@ -0,0 +1,38 @@
+const got = require('@/utils/got');
+const cheerio = require('cheerio');
+const { parseDate } = require('@/utils/parse-date');
+const path = require('path');
+const { art } = require('@/utils/render');
+
+const rootUrl = `https://www.ssm.gov.mo`;
+const newsUrl = `${rootUrl}/apps1/content/ch/973/itemlist.aspx?defaultcss=false&dlimit=20&showdate=true&dorder=cridate%20desc,displaydate%20desc&withattach=true`;
+
+module.exports = async (ctx) => {
+ const response = await got.get(newsUrl);
+ const $ = cheerio.load(response.data);
+ const list = $('body > div > div > ul > li');
+
+ const item = list
+ .map((_, item) => {
+ const title = $(item).find('a').text();
+ const link = $(item).find('a').attr('href');
+ const pubDate = parseDate($(item).find('small').text().split(':')[1].trim(), 'DD/MM/YYYY');
+ const desc = art(path.join(__dirname, 'templates/news.art'), {
+ link,
+ });
+
+ return {
+ title,
+ link,
+ description: desc,
+ pubDate,
+ };
+ })
+ .get();
+
+ ctx.state.data = {
+ title: '澳门卫生局-最新消息',
+ link: rootUrl,
+ item,
+ };
+};
diff --git a/lib/v2/ssm/radar.js b/lib/v2/ssm/radar.js
new file mode 100644
index 000000000..57a032a59
--- /dev/null
+++ b/lib/v2/ssm/radar.js
@@ -0,0 +1,13 @@
+module.exports = {
+ 'ssm.gov.mo': {
+ _name: '澳门卫生局',
+ www: [
+ {
+ title: '最新消息',
+ docs: 'https://docs.rsshub.app/government.html#ao-men-wei-sheng-ju-zui-xin-xiao-xi',
+ source: ['/', '/portal'],
+ target: '/ssm/news',
+ },
+ ],
+ },
+};
diff --git a/lib/v2/ssm/router.js b/lib/v2/ssm/router.js
new file mode 100644
index 000000000..69a5972f6
--- /dev/null
+++ b/lib/v2/ssm/router.js
@@ -0,0 +1,3 @@
+module.exports = function (router) {
+ router.get('/news', require('./news'));
+};
diff --git a/lib/v2/ssm/templates/news.art b/lib/v2/ssm/templates/news.art
new file mode 100644
index 000000000..053f7482e
--- /dev/null
+++ b/lib/v2/ssm/templates/news.art
@@ -0,0 +1 @@
+