fix: 修复国家电网通知 (#2175)

* fix: 国家电网通知失效,抓取时间错误

* update: 国家电网
This commit is contained in:
MoonBegonia
2019-05-19 17:25:23 +08:00
committed by DIYgod
parent 6c1e54205b
commit 88e8b4900d
2 changed files with 10 additions and 8 deletions
+2 -2
View File
@@ -10,9 +10,9 @@ pageClass: routes
### 国家电网
<Route author="xyqfer" example="/tingdiantz/95598/36401/36101" path="/tingdiantz/95598/:orgNo/:provinceNo/:scope?" :paramsDesc="['所属省供电公司编码', '所属地市供电公司编码', '停电范围关键字']"/>
<Route author="xyqfer moonbegonia" example="/tingdiantz/95598/36401/36101" path="/tingdiantz/95598/:orgNo/:provinceNo/:scope?" :paramsDesc="['所属省供电公司编码', '所属地市供电公司编码', '停电范围关键字']"/>
> 以上参数可从[查询页面](http://m.95598.cn/95598/woutageNotice/winitOutageNotice)打开控制台抓包获得
> 以上参数可从[查询页面](http://www.95598.cn/95598/outageNotice/initOutageNotice)打开控制台抓包获得
### 南京市
+8 -6
View File
@@ -2,27 +2,29 @@ const axios = require('@/utils/axios');
const qs = require('querystring');
module.exports = async (ctx) => {
const { orgNo, provinceNo, scope = '' } = ctx.params;
const { orgNo, provinceNo, scope = '', typeCode = '', lineName = '' } = ctx.params;
let { outageStartTime, outageEndTime } = ctx.params;
if (!outageStartTime) {
outageStartTime = new Date(Date.now() - 86400000).toISOString().slice(0, 10);
outageStartTime = new Date(Date.now()).toISOString().slice(0, 10);
}
if (!outageEndTime) {
outageEndTime = new Date(Date.now() - 86400000).toISOString().slice(0, 10);
outageEndTime = new Date(Date.now() + 86400000).toISOString().slice(0, 10);
}
const anHui = provinceNo === '34101' ? '01' : '02';
const response = await axios({
method: 'post',
url: 'http://m.95598.cn/95598/woutageNotice/wqueryOutageNoticeList?partNo=BM08001',
url: 'http://www.95598.cn/95598/outageNotice/queryOutageNoticeList',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
data: qs.stringify({
orgNo,
provinceNo,
outageStartTime,
outageEndTime,
scope,
provinceNo,
typeCode,
lineName,
anHui,
}),
});
@@ -49,7 +51,7 @@ module.exports = async (ctx) => {
ctx.state.data = {
title: '国家电网停电通知',
link: 'http://m.95598.cn/95598/woutageNotice/winitOutageNotice',
link: 'http://www.95598.cn/95598/outageNotice/initOutageNotice',
item: items,
};
};