From ca28134850140ff3457a7bf45b3d20325b3a6fcd Mon Sep 17 00:00:00 2001 From: DIYgod Date: Mon, 28 Oct 2019 14:52:29 +0800 Subject: [PATCH] refactor: format --- lib/routes/guanchazhe/index.js | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/lib/routes/guanchazhe/index.js b/lib/routes/guanchazhe/index.js index ec9be15c3b..cee1fb001d 100644 --- a/lib/routes/guanchazhe/index.js +++ b/lib/routes/guanchazhe/index.js @@ -22,11 +22,9 @@ module.exports = async (ctx) => { function getData(jscontent, option) { switch (option) { case 'date': { - // eslint-disable-next-line - let jsoutput = String(jscontent) + const jsoutput = String(jscontent) .substr(-23, 10) - // eslint-disable-next-line - .replace(/\_/g, '-'); + .replace(/_/g, '-'); return new Date(jsoutput).toLocaleDateString(); } case 'urlid': { @@ -34,7 +32,6 @@ module.exports = async (ctx) => { return jsoutput; } default: { - // console.log('default'); break; } } @@ -42,6 +39,7 @@ module.exports = async (ctx) => { // 循环获取ptype每个请求的数据内容 for (const key in ptype) { const link = ptype[key].url; + // eslint-disable-next-line no-await-in-loop const response = await got({ method: 'get', url: link, @@ -213,9 +211,6 @@ module.exports = async (ctx) => { HomeFeeds.push(temp[i][k]); } } - // 检查数据获取条数 - // console.log(temp[0][3]); - console.log('HomeFeeds数组长度:' + HomeFeeds.length, '头条:' + temp[0].length, '左1列:' + temp[1].length, '中右2列:' + temp[2].length, '访谈、论坛' + temp[3].length, '历史、深度' + temp[4].length); break; case 'redian': list[1] = response.data.items; @@ -236,9 +231,6 @@ module.exports = async (ctx) => { RedianFeeds.push(temp[i][k]); } } - // 检查数据获取条数 - // console.log(RedianFeeds); - console.log('RedianFeeds数组长度:' + RedianFeeds.length, '热点:' + temp[0].length); break; case 'member': list[2] = response.data.items; @@ -260,9 +252,6 @@ module.exports = async (ctx) => { MemberFeeds.push(temp[i][k]); } } - // 检查数据获取条数 - // console.log(MemberFeeds); - console.log('MemberFeeds数组长度:' + MemberFeeds.length, '观察员:' + temp[0].length); break; case 'gundong': list[3] = response.data.fenghot; @@ -303,9 +292,6 @@ module.exports = async (ctx) => { GundongFeeds.push(temp[i][k]); } } - // 检查数据获取条数 - // console.log(GundongFeeds); - console.log('GundongFeeds数组长度:' + GundongFeeds.length, '滚动新闻:' + temp[0].length, '风闻7天最热:' + temp[1].length, '观察员付费:' + temp[2].length); break; } }