diff --git a/docs/README.md b/docs/README.md index bc337aa07..7b2200103 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1853,6 +1853,12 @@ Solidot 提供的 feed: +### 停电通知 + + + +> 以上参数可从[查询页面](http://m.95598.cn/95598/woutageNotice/winitOutageNotice)打开控制台抓包获得 + ### 中央气象台 diff --git a/router.js b/router.js index 7619dd321..3b06be580 100644 --- a/router.js +++ b/router.js @@ -911,4 +911,7 @@ router.get('/shanbay/checkin/:id', require('./routes/shanbay/checkin')); // Facebook router.get('/facebook/page/:id', require('./routes/facebook/page')); +// 停电通知 +router.get('/tingdiantz/95598/:orgNo/:provinceNo/:outageStartTime/:outageEndTime/:scope?', require('./routes/tingdiantz/95598')); + module.exports = router; diff --git a/routes/tingdiantz/95598.js b/routes/tingdiantz/95598.js new file mode 100644 index 000000000..da3f0602b --- /dev/null +++ b/routes/tingdiantz/95598.js @@ -0,0 +1,48 @@ +const axios = require('../../utils/axios'); +const qs = require('querystring'); + +module.exports = async (ctx) => { + const { orgNo, provinceNo, outageStartTime, outageEndTime, scope = '' } = ctx.params; + const anHui = provinceNo === '34101' ? '01' : '02'; + const response = await axios({ + method: 'post', + url: 'http://m.95598.cn/95598/woutageNotice/wqueryOutageNoticeList?partNo=BM08001', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + data: qs.stringify({ + orgNo, + provinceNo, + outageStartTime, + outageEndTime, + scope, + anHui, + }), + }); + + const items = (response.data.seleList || []).map((item) => { + const title = `${item.subsName} | ${item.typeCode || ''}`; + const description = ` + 停电时间:${item.startTime} - ${item.stopTime}
+ 停电范围:${item.scope}
+ 停电线路:${item.lineName}
+ 公变名称:${item.pubTranName}
+ 停电原因:${item.poweroffReason}
+ `; + const guid = item.powerOffId; + const pubDate = new Date(item.startTime).toUTCString(); + + return { + title, + description, + guid, + pubDate, + }; + }); + + ctx.state.data = { + title: '国家电网停电通知', + link: 'http://m.95598.cn/95598/woutageNotice/winitOutageNotice', + item: items, + }; +};