From 4fbe648ddeb6cb9cd5447d1c167dec96baf5ebab Mon Sep 17 00:00:00 2001 From: Fatpandac <1779196284@qq.com> Date: Fri, 11 Feb 2022 05:37:03 +0800 Subject: [PATCH] fix(route): item's desc is same but guid is different (#9042) fix(route): 12306 item's desc is same but guid is different --- docs/travel.md | 2 +- lib/v2/12306/index.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/travel.md b/docs/travel.md index 47ae09ac61..e74f9df314 100644 --- a/docs/travel.md +++ b/docs/travel.md @@ -12,7 +12,7 @@ pageClass: routes ### 售票信息 - + ## All the Flight Deals diff --git a/lib/v2/12306/index.js b/lib/v2/12306/index.js index 84e0f53b34..8f9d14c75a 100644 --- a/lib/v2/12306/index.js +++ b/lib/v2/12306/index.js @@ -61,11 +61,11 @@ module.exports = async (ctx) => { Cookie: await getJSESSIONID(linkUrl), }, }); - const data = response.data.data.result; - const map = response.data.data.map; - if (data.length === 0) { + if (response.data.data === undefined || response.data.data.length === 0) { throw '没有找到相关车次,请检查参数是否正确'; } + const data = response.data.data.result; + const map = response.data.data.map; const items = data.map((item) => { const itemData = item.split('|'); @@ -96,7 +96,7 @@ module.exports = async (ctx) => { trainInfo, }), link: linkUrl, - guid: item, + guid: Object.values(trainInfo).join('|'), }; });