From b34d69cfeada9e1fde425960b150398701241485 Mon Sep 17 00:00:00 2001 From: junbaor Date: Tue, 30 Jul 2019 11:43:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=88=A0=E9=99=A4=20Artand,=20?= =?UTF-8?q?=E5=AE=98=E6=96=B9=E5=B7=B2=E6=9C=89=E6=BA=90=20(#2714)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/shopping.md | 6 ----- lib/router.js | 3 --- lib/routes/artand/user/work.js | 42 ---------------------------------- 3 files changed, 51 deletions(-) delete mode 100644 lib/routes/artand/user/work.js diff --git a/docs/shopping.md b/docs/shopping.md index 2295ec343..0ecf80ef8 100644 --- a/docs/shopping.md +++ b/docs/shopping.md @@ -4,12 +4,6 @@ pageClass: routes # 购物 -## Artand - -### 用户新作 - - - ## Westore ### 新品 diff --git a/lib/router.js b/lib/router.js index c73bc3153..c62a6299d 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1563,9 +1563,6 @@ router.get('/getitfree/search/:keyword?', require('./routes/getitfree/search.js' // 万联网 router.get('/10000link/news/:category?', require('./routes/10000link/news')); -// Artand -router.get('/artand/user/work/:uid', require('./routes/artand/user/work')); - // 站酷 router.get('/zcool/recommend/:type', require('./routes/zcool/recommend')); router.get('/zcool/top', require('./routes/zcool/top')); diff --git a/lib/routes/artand/user/work.js b/lib/routes/artand/user/work.js deleted file mode 100644 index 44ed3f81e..000000000 --- a/lib/routes/artand/user/work.js +++ /dev/null @@ -1,42 +0,0 @@ -const got = require('@/utils/got'); - -module.exports = async (ctx) => { - const uid = ctx.params.uid; - - const url = `https://ios2.artand.cn/user1/index?tab=work&uid=${uid}`; - const response = await got({ method: 'get', url }); - const dataUser = response.data.user; - const dataList = response.data.list; - - const result = await Promise.all( - dataList.map(async (item) => { - const voItem = { - title: item.name, - author: dataUser.uname, - description: '', - pubDate: new Date(item.mtime * 1000).toUTCString(), - link: `https://artand.cn/artid/${Number(item.id) + 100000}`, // +100000 的逻辑挺奇怪 - }; - - const link = 'https://ios2.artand.cn/works/index?post_id=' + item.id; - - const cache = await ctx.cache.get(link); - if (cache) { - return Promise.resolve(JSON.parse(cache)); - } - - const itemReponse = await got.get(link); - voItem.description = itemReponse.data.data.work.desc; - - ctx.cache.set(link, JSON.stringify(voItem)); - return Promise.resolve(voItem); - }) - ); - - ctx.state.data = { - title: `${dataUser.uname} 的 Artand 新作`, - link: `https://artand.cn/${dataUser.uid}`, - description: `${dataUser.uname} 的 Artand 新作`, - item: result, - }; -};