From 57ec52bfa751b031b715fbd99be60c6d9fefb945 Mon Sep 17 00:00:00 2001 From: Ethan Shen Date: Sun, 6 Feb 2022 19:00:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(route):=20=E8=81=94=E5=90=88=E6=97=A9?= =?UTF-8?q?=E6=8A=A5=20(#9001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/v2/zaobao/index.js | 4 ++-- lib/v2/zaobao/maintainer.js | 2 +- lib/v2/zaobao/realtime.js | 2 +- lib/v2/zaobao/router.js | 4 ++-- lib/v2/zaobao/templates/zaobao.art | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/v2/zaobao/index.js b/lib/v2/zaobao/index.js index 9b42d849b..6e5053845 100644 --- a/lib/v2/zaobao/index.js +++ b/lib/v2/zaobao/index.js @@ -2,8 +2,8 @@ const { parseList } = require('./util'); const baseUrl = 'https://www.zaobao.com'; module.exports = async (ctx) => { - const type = ctx.params.type || 'realtime'; - const section = ctx.params.section || 'china'; + const type = ctx.params.type ?? 'realtime'; + const section = ctx.params.section ?? 'china'; const sectionLink = `/${type}/${section}`; const { title, resultList } = await parseList(ctx, sectionLink); diff --git a/lib/v2/zaobao/maintainer.js b/lib/v2/zaobao/maintainer.js index 277082273..33f35b9a6 100644 --- a/lib/v2/zaobao/maintainer.js +++ b/lib/v2/zaobao/maintainer.js @@ -1,6 +1,6 @@ module.exports = { + '/interactive-graphics': ['shunf4'], '/realtime/:section?': ['shunf4'], '/znews/:section?': ['shunf4'], '/:type/:section': ['shunf4'], - '/interactive-graphics': ['shunf4'], }; diff --git a/lib/v2/zaobao/realtime.js b/lib/v2/zaobao/realtime.js index 03d7dd892..bee3f0dab 100644 --- a/lib/v2/zaobao/realtime.js +++ b/lib/v2/zaobao/realtime.js @@ -2,7 +2,7 @@ const { parseList } = require('./util'); const baseUrl = 'https://www.zaobao.com'; module.exports = async (ctx) => { - const section = ctx.params.section || 'china'; + const section = ctx.params.section ?? 'china'; let name = '中港台'; let sectionLink = '/realtime/china'; diff --git a/lib/v2/zaobao/router.js b/lib/v2/zaobao/router.js index 15debe274..24b929824 100644 --- a/lib/v2/zaobao/router.js +++ b/lib/v2/zaobao/router.js @@ -1,6 +1,6 @@ module.exports = function (router) { + router.get('/interactive-graphics', require('./interactive')); router.get('/realtime/:section?', require('./realtime')); router.get('/znews/:section?', require('./znews')); - router.get('/:type/:section', require('./index')); - router.get('/interactive-graphics', require('./interactive')); + router.get('/:type?/:section?', require('./index')); }; diff --git a/lib/v2/zaobao/templates/zaobao.art b/lib/v2/zaobao/templates/zaobao.art index ed4f381f2..b331fe3d5 100644 --- a/lib/v2/zaobao/templates/zaobao.art +++ b/lib/v2/zaobao/templates/zaobao.art @@ -13,5 +13,5 @@ {{ /each }} {{ if articleBody }} - {{ articleBody }} + {{@ articleBody }} {{ /if }}