mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 14:40:23 +08:00
feat: add 湖南省政府采购网 rss (#3436)
This commit is contained in:
@@ -89,6 +89,10 @@ pageClass: routes
|
|||||||
|
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
### 湖南省政府采购网-公告
|
||||||
|
|
||||||
|
<Route author="Jeason0228" example="/gov/hunan/notice/all" path="/gov/hunan/notice/:type" :paramsDesc="['all=全部,cg=采购公告,zb=中标公告,fb=废标公告,ht=合同公告,gz=更正公告,zz=终止公告,qt=其他公告']" />
|
||||||
|
|
||||||
### 江苏省人民政府
|
### 江苏省人民政府
|
||||||
|
|
||||||
<Route author="ocleo1" example="/gov/province/jiangsu/important-news" path="/gov/province/jiangsu/:category" :paramsDesc="['分类名']">
|
<Route author="ocleo1" example="/gov/province/jiangsu/important-news" path="/gov/province/jiangsu/:category" :paramsDesc="['分类名']">
|
||||||
|
|||||||
@@ -1075,6 +1075,7 @@ router.get('/gov/news/:uid', require('./routes/gov/news'));
|
|||||||
router.get('/gov/suzhou/news/:uid', require('./routes/gov/suzhou/news'));
|
router.get('/gov/suzhou/news/:uid', require('./routes/gov/suzhou/news'));
|
||||||
router.get('/gov/suzhou/doc', require('./routes/gov/suzhou/doc'));
|
router.get('/gov/suzhou/doc', require('./routes/gov/suzhou/doc'));
|
||||||
router.get('/gov/shanxi/rst/:category', require('./routes/gov/shanxi/rst'));
|
router.get('/gov/shanxi/rst/:category', require('./routes/gov/shanxi/rst'));
|
||||||
|
router.get('/gov/hunan/notice/:type', require('./routes/gov/hunan/notice'));
|
||||||
|
|
||||||
// 中华人民共和国-海关总署
|
// 中华人民共和国-海关总署
|
||||||
router.get('/gov/customs/list/:gchannel', require('./routes/gov/customs/list'));
|
router.get('/gov/customs/list/:gchannel', require('./routes/gov/customs/list'));
|
||||||
|
|||||||
80
lib/routes/gov/hunan/notice.js
Normal file
80
lib/routes/gov/hunan/notice.js
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const type = ctx.params.type || 'all';
|
||||||
|
const rssData = {
|
||||||
|
isType: ctx.params.type ? true : false,
|
||||||
|
Title: `湖南省政府采购网`,
|
||||||
|
Desc: `湖南省政府采购网`,
|
||||||
|
Link: `http://www.ccgp-hunan.gov.cn/page/notice/more.jsp`,
|
||||||
|
Category: new Map([
|
||||||
|
['all', { name: '全部', id: '' }],
|
||||||
|
['cg', { name: '采购公告', id: 'prcmNotices' }],
|
||||||
|
['zb', { name: '中标(成交)公告', id: 'dealNotices' }],
|
||||||
|
['fb', { name: '废标公告', id: 'invalidNotices' }],
|
||||||
|
['ht', { name: '合同公告', id: 'contractNotices' }],
|
||||||
|
['gz', { name: '更正公告', id: 'modfiyNotices' }],
|
||||||
|
['zz', { name: '终止公告', id: 'endNotices' }],
|
||||||
|
['qt', { name: '其他公告', id: 'otherNotices' }],
|
||||||
|
]),
|
||||||
|
typeName: function(type) {
|
||||||
|
return rssData.Category.get(type).name;
|
||||||
|
},
|
||||||
|
typeid: function(type) {
|
||||||
|
return rssData.Category.get(type).id;
|
||||||
|
},
|
||||||
|
ProcessFeed: async (id) => {
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: `http://www.ccgp-hunan.gov.cn/mvc/viewNoticeContent.do?noticeId=` + id,
|
||||||
|
headers: {
|
||||||
|
Referer: rssData.itemUrl + id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const htmlContent = response.data;
|
||||||
|
return htmlContent;
|
||||||
|
},
|
||||||
|
ItemsSingle: async function(item) {
|
||||||
|
const cache = await ctx.cache.get(rssData.itemUrl);
|
||||||
|
if (cache) {
|
||||||
|
return Promise.resolve(JSON.parse(cache));
|
||||||
|
}
|
||||||
|
|
||||||
|
const single = {
|
||||||
|
title: item.NOTICE_TITLE,
|
||||||
|
link: rssData.itemUrl + item.NOTICE_ID,
|
||||||
|
author: item.NOTICE_NAME,
|
||||||
|
description: await rssData.ProcessFeed(item.NOTICE_ID),
|
||||||
|
guid: item.NOTICE_ID,
|
||||||
|
category: item.NOTICE_NAME,
|
||||||
|
pubDate: new Date(`${item.NEWWORK_DATE} GMT`).toUTCString(),
|
||||||
|
};
|
||||||
|
ctx.cache.set(rssData.itemUrl, JSON.stringify(single));
|
||||||
|
return Promise.resolve(single);
|
||||||
|
},
|
||||||
|
referUrl: `http://www.ccgp-hunan.gov.cn/page/notice/more.jsp`,
|
||||||
|
apiUrl: `http://www.ccgp-hunan.gov.cn/mvc/getNoticeList4Web.do`,
|
||||||
|
itemUrl: `http://www.ccgp-hunan.gov.cn/page/notice/notice.jsp?noticeId=`,
|
||||||
|
};
|
||||||
|
// 结束rssData定义
|
||||||
|
// 配置api日期参数
|
||||||
|
const now = new Date();
|
||||||
|
const startDate = now.getFullYear() + '-' + now.getMonth() + '-01';
|
||||||
|
const endDate = now.toLocaleDateString().replace(/\//g, '-');
|
||||||
|
rssData.apiResponse = await got({
|
||||||
|
method: 'post',
|
||||||
|
url: `http://www.ccgp-hunan.gov.cn/mvc/getNoticeList4Web.do?nType=${rssData.typeid(type)}&startDate=${startDate}&endDate=${endDate}&page=1&pageSize=18`,
|
||||||
|
responseType: 'buffer',
|
||||||
|
headers: {
|
||||||
|
Referer: rssData.referUrl,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
rssData.apiData = rssData.apiResponse.data.rows;
|
||||||
|
rssData.Items = await Promise.all(rssData.apiData.map((item) => rssData.ItemsSingle(item)));
|
||||||
|
ctx.state.data = {
|
||||||
|
title: rssData.Title,
|
||||||
|
link: rssData.Link,
|
||||||
|
description: rssData.Desc,
|
||||||
|
item: rssData.Items,
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user