Skip to content

Commit 1e25636

Browse files
authored
Merge pull request #587 from DIYgod/master
[pull] master from diygod:master
2 parents b560450 + bb184bd commit 1e25636

File tree

6 files changed

+78
-3
lines changed

6 files changed

+78
-3
lines changed

docs/government.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,16 @@ pageClass: routes
388388

389389
</Route>
390390

391+
## 湖南省人民政府
392+
393+
### 长沙市人民政府
394+
395+
#### 市长信箱
396+
397+
<Route author="shansing" example="/gov/hunan/changsha/major-email" path="/gov/hunan/changsha/major-email" />
398+
399+
可能仅限中国大陆服务器访问,以实际情况为准。
400+
391401
## 湖南省政府采购网
392402

393403
### 公告
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
const got = require('@/utils/got');
2+
const cheerio = require('cheerio');
3+
const iconv = require('iconv-lite');
4+
const { parseDate } = require('@/utils/parse-date');
5+
const baseUrl = 'http://wlwz.changsha.gov.cn';
6+
7+
module.exports = async (ctx) => {
8+
const listPage = await got('http://wlwz.changsha.gov.cn/webapp/cs2020/email/index.jsp', {
9+
responseType: 'buffer',
10+
});
11+
listPage.data = iconv.decode(listPage.data, 'gbk');
12+
const $ = cheerio.load(listPage.data);
13+
const list = $('.table1 tbody tr')
14+
.slice(1)
15+
.map((_, tr) => {
16+
tr = $(tr);
17+
18+
return {
19+
title: tr.find('td[title]').attr('title'),
20+
link: baseUrl + tr.find('td[title] > a').attr('href'),
21+
author: tr.find('td:last').text(),
22+
};
23+
})
24+
.get();
25+
26+
const items = await Promise.all(
27+
list.map((item) =>
28+
ctx.cache.tryGet(item.link, async () => {
29+
const postPage = await got(item.link, {
30+
responseType: 'buffer',
31+
});
32+
postPage.data = iconv.decode(postPage.data, 'gbk');
33+
const $ = cheerio.load(postPage.data);
34+
35+
const data = {
36+
title: item.title,
37+
description: $('.letter-details').html().trim(),
38+
pubDate: parseDate($('.letter-details div:first table tr:nth-child(2) > .td_label2').text() + ' +0800', 'YYYY-MM-DD HH:mm:ss ZZ'),
39+
link: item.link,
40+
author: item.author,
41+
};
42+
return data;
43+
})
44+
)
45+
);
46+
47+
ctx.state.data = {
48+
title: '来信反馈 - 长沙市市长信箱',
49+
link: `${baseUrl}/webapp/cs2020/email/index.jsp`,
50+
item: items,
51+
};
52+
};

lib/v2/gov/maintainer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ module.exports = {
4848
'/guangdong/tqyb/sncsyjxh': ['Fatpandac'],
4949
'/hebei/czt/xwdt/:category?': ['nczitzk'],
5050
'/huizhou/zwgk/:category?': ['Fatpandac'],
51+
'/hunan/changsha/major-email': ['shansing'],
5152
'/shaanxi/kjt/:id?': ['nczitzk'],
5253
'/shanghai/rsj/ksxm': ['Fatpandac'],
5354
'/shanghai/wsjkw/yqtb': ['zcf0508'],

lib/v2/gov/radar.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,17 @@ module.exports = {
319319
},
320320
],
321321
},
322+
'changsha.gov.cn': {
323+
_name: '湖南省人民政府',
324+
wlwz: [
325+
{
326+
title: '市长信箱',
327+
docs: 'https://docs.rsshub.app/government.html#hu-nan-sheng-ren-min-zheng-fu',
328+
source: ['/webapp/cs2020/email/*'],
329+
target: '/gov/hunan/changsha/major-email',
330+
},
331+
],
332+
},
322333
'cmse.gov.cn': {
323334
_name: '中国载人航天',
324335
www: [

lib/v2/gov/router.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ module.exports = function (router) {
3838
router.get('/beijing/kw/:channel', require('./beijing/kw/index'));
3939
router.get('/guangdong/tqyb/tfxtq', require('./guangdong/tqyb/tfxtq'));
4040
router.get('/guangdong/tqyb/sncsyjxh', require('./guangdong/tqyb/sncsyjxh'));
41-
router.get('/huizhou/zwgk/:category?', require('./huizhou/zwgk/index'));
4241
router.get('/hebei/czt/xwdt/:category?', require('./hebei/czt'));
42+
router.get('/huizhou/zwgk/:category?', require('./huizhou/zwgk/index'));
43+
router.get('/hunan/changsha/major-email', require('./hunan/changsha/major-email'));
4344
router.get('/shaanxi/kjt/:id?', require('./shaanxi/kjt'));
4445
router.get('/shanghai/rsj/ksxm', require('./shanghai/rsj/ksxm'));
4546
router.get('/shanghai/wsjkw/yqtb', require('./shanghai/wsjkw/yqtb'));
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<br>
2-
{{ each descData.structuredData.json.screenshot }}
3-
<img src="{{ $value }}">
2+
{{ each descData.structuredData.screenshot }}
3+
<img src="{{ $value }}">
44
{{ /each }}
55

0 commit comments

Comments
 (0)