feat(route): add 深圳停水通知 Shenzhen (#12543)

* feat(route): add 深圳停水通知 Shenzhen

* feat(route): add 深圳停水通知 Shenzhen water shut-off notice

* feat(route): add 深圳停水通知 Shenzhen water shut-off notice

* feat(route): add 深圳停水通知 Shenzhen water shut-off notice

* feat(route): add 深圳停水通知 Shenzhen water shut-off notice

* feat(route): add 深圳停水通知 Shenzhen water shut-off notice

* feat(route): add 深圳停水通知 Shenzhen water shut-off notice

* feat(route): add 深圳停水通知 Shenzhen water shut-off notice

* insert new entries in alphabetical order

* feat(route): add 深圳停水通知 Shenzhen water shut-off notice
This commit is contained in:
lilPiper 2023-05-22 21:39:54 +08:00 committed by GitHub
parent 5e3a580917
commit 385237e0d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 58 additions and 0 deletions

View File

@ -171,6 +171,14 @@ pageClass: routes
</Route>
### 深圳市
<Route author="lilPiper" example="/tingshuitz/shenzhen" path="/tingshuitz/shenzhen">
可能仅限中国大陆服务器访问,以实际情况为准。
</Route>
## 香港天文台
### Current Weather Report

View File

@ -5,6 +5,7 @@ module.exports = {
'/guangzhou': ['xyqfer'],
'/hangzhou': ['znhocn'],
'/nanjing': ['ocleo1'],
'/shenzhen': ['lilPiper'],
'/wuhan': ['MoonBegonia'],
'/xian': ['ciaranchen'],
'/xiaoshan': ['znhocn'],

View File

@ -42,6 +42,17 @@ module.exports = {
},
],
},
'sz-water.com.cn': {
_name: '停水通知',
'.': [
{
title: '深圳市',
docs: 'https://docs.rsshub.app/forecast.html#ting-shui-tong-zhi',
source: ['/*'],
target: '/tingshuitz/shenzhen',
},
],
},
'whwater.com': {
_name: '停水通知',
'.': [

View File

@ -5,6 +5,7 @@ module.exports = (router) => {
router.get('/guangzhou', require('./guangzhou'));
router.get('/hangzhou', require('./hangzhou'));
router.get('/nanjing', require('./nanjing'));
router.get('/shenzhen', require('./shenzhen'));
router.get('/wuhan/:channelId?', require('./wuhan'));
router.get('/xian', require('./xian'));
router.get('/xiaoshan', require('./xiaoshan'));

View File

@ -0,0 +1,29 @@
const got = require('@/utils/got');
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://szgk.sz-water.com.cn/api/wechat/op/getStopWaterNotice';
const response = await got({
method: 'get',
url,
});
const data = response.data.data;
ctx.state.data = {
title: '停水通知 - 深圳水务',
link: 'https://www.sz-water.com.cn/',
item: data.map((item) => ({
title: `${item.position}${item.stoptime}`,
description: art(path.join(__dirname, 'templates/shenzhen.art'), {
item
}),
pubDate: timezone(parseDate(item.createdOn, 'YYYY-MM-DD HH:mm:ss'), +8),
link: 'https://szgk.sz-water.com.cn/wechat_web/Water_stop.html',
guid: `${item.position}${item.stopStartTime}`,
})),
};
};

View File

@ -0,0 +1,8 @@
<p>{{ item.title }}</p>
<p>{{if item.reginName }}
【{{ item.reginName }}】
{{ /if }}
(影响用户{{ item.affectUser }}),
{{if item.stopwaterType }}
[{{ item.stopwaterType }}]
{{ /if }}原因:{{ item.reason }},停水开始时间{{ item.stopStartTime }},停水结束时间{{ item.stopEndTime }}</p>