From 73a01a1ff047576365d7c81caeea9b2bb20f253b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=89=E5=87=89?= Date: Tue, 11 Dec 2018 11:32:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=EF=BC=9A=E5=9B=BD=E5=AE=B6?= =?UTF-8?q?=E7=94=B5=E7=BD=91=E5=81=9C=E7=94=B5=E9=80=9A=E7=9F=A5=20(#1260?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #1117 --- docs/README.md | 6 +++++ router.js | 3 +++ routes/tingdiantz/95598.js | 48 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 routes/tingdiantz/95598.js 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, + }; +};