From 88e8b4900d3c70daa97c1341ea63e468f9fd5d04 Mon Sep 17 00:00:00 2001 From: MoonBegonia Date: Sun, 19 May 2019 17:25:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=9B=BD=E5=AE=B6?= =?UTF-8?q?=E7=94=B5=E7=BD=91=E9=80=9A=E7=9F=A5=20(#2175)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 国家电网通知失效,抓取时间错误 * update: 国家电网 --- docs/forecast.md | 4 ++-- lib/routes/tingdiantz/95598.js | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/forecast.md b/docs/forecast.md index f22919895..8b94532ef 100644 --- a/docs/forecast.md +++ b/docs/forecast.md @@ -10,9 +10,9 @@ pageClass: routes ### 国家电网 - + -> 以上参数可从[查询页面](http://m.95598.cn/95598/woutageNotice/winitOutageNotice)打开控制台抓包获得 +> 以上参数可从[查询页面](http://www.95598.cn/95598/outageNotice/initOutageNotice)打开控制台抓包获得 ### 南京市 diff --git a/lib/routes/tingdiantz/95598.js b/lib/routes/tingdiantz/95598.js index 25e207d67..03a877206 100644 --- a/lib/routes/tingdiantz/95598.js +++ b/lib/routes/tingdiantz/95598.js @@ -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, }; };