diff --git a/lib/v2/qweather/now.js b/lib/v2/qweather/now.js index b0982d605..626e3af84 100644 --- a/lib/v2/qweather/now.js +++ b/lib/v2/qweather/now.js @@ -15,7 +15,8 @@ module.exports = async (ctx) => { }); const requestUrl = rootUrl + 'key=' + config.hefeng.key + '&location=' + id; const responseData = await ctx.cache.tryGet( - ctx.params.location, + + ctx.params.location + '_now', async () => { const response = await got(requestUrl); return response.data; @@ -26,15 +27,19 @@ module.exports = async (ctx) => { const data = [responseData.now]; + const timeObj = parseDate(responseData.updateTime); + + const time_show = timeObj.getFullYear() + '-' + timeObj.getMonth() + '-' + timeObj.getDay() + ' ' + timeObj.getHours() + ':' + timeObj.getMinutes(); + ctx.state.data = { title: ctx.params.location + '实时天气', description: ctx.params.location + '实时天气状况', item: data.map((item) => ({ - title: '观测时间:' + parseDate(responseData.updateTime), + title: '观测时间:' + time_show, description: art(path.join(__dirname, './util/now.art'), { item }), - pubDate: parseDate(responseData.updateTime), - guid: '位置:' + ctx.params.location + '--时间:' + parseDate(responseData.updateTime), - link: item.fxLink, + pubDate: timeObj, + guid: '位置:' + ctx.params.location + '--时间:' + time_show, + link: responseData.fxLink, })), link: responseData.fxLink, };